From 2e214935ba72e1abe75f99f2f9731a752b459d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Bo=CC=88hm?= Date: Fri, 5 Jan 2024 17:31:13 +0100 Subject: [PATCH 1/2] Generated with JHipster 8.0.0 --- .devcontainer/Dockerfile | 25 + .devcontainer/devcontainer.json | 53 + .editorconfig | 23 + .eslintignore | 10 + .eslintrc.json | 99 + .gitattributes | 150 + .gitignore | 151 + .husky/pre-commit | 5 + .lintstagedrc.cjs | 3 + .prettierignore | 12 + .prettierrc | 22 + .yo-rc.json | 38 + README.md | 277 ++ angular.json | 110 + build.gradle | 293 ++ checkstyle.xml | 19 + gradle.properties | 69 + gradle/cache.gradle | 5 + gradle/docker.gradle | 29 + gradle/liquibase.gradle | 61 + gradle/profile_dev.gradle | 92 + gradle/profile_prod.gradle | 71 + gradle/sonar.gradle | 26 + gradle/swagger.gradle | 29 + gradle/war.gradle | 16 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 62076 bytes gradle/wrapper/gradle-wrapper.properties | 5 + gradle/zipkin.gradle | 4 + gradlew | 245 ++ gradlew.bat | 92 + jest.conf.js | 29 + ngsw-config.json | 21 + npmw | 42 + npmw.cmd | 31 + package.json | 145 + settings.gradle | 21 + sonar-project.properties | 37 + src/main/docker/app.yml | 29 + src/main/docker/config/mysql/my.cnf | 82 + .../grafana/provisioning/dashboards/JVM.json | 3778 +++++++++++++++++ .../provisioning/dashboards/dashboard.yml | 11 + .../provisioning/datasources/datasource.yml | 50 + .../docker/hazelcast-management-center.yml | 9 + src/main/docker/jhipster-control-center.yml | 51 + src/main/docker/jib/entrypoint.sh | 39 + src/main/docker/monitoring.yml | 31 + src/main/docker/mysql.yml | 21 + src/main/docker/prometheus/prometheus.yml | 31 + src/main/docker/services.yml | 7 + src/main/docker/sonar.yml | 15 + src/main/docker/swagger-editor.yml | 7 + .../de/tum/cit/ase/ApplicationWebXml.java | 19 + .../tum/cit/ase/ArtemisBenchmarkingApp.java | 109 + .../de/tum/cit/ase/GeneratedByJHipster.java | 13 + .../cit/ase/aop/logging/LoggingAspect.java | 111 + .../tum/cit/ase/aop/logging/package-info.java | 4 + .../cit/ase/config/ApplicationProperties.java | 16 + .../cit/ase/config/AsyncConfiguration.java | 48 + .../tum/cit/ase/config/CRLFLogConverter.java | 69 + .../cit/ase/config/CacheConfiguration.java | 125 + .../java/de/tum/cit/ase/config/Constants.java | 15 + .../cit/ase/config/DatabaseConfiguration.java | 12 + .../config/DateTimeFormatConfiguration.java | 20 + .../cit/ase/config/JacksonConfiguration.java | 34 + .../ase/config/LiquibaseConfiguration.java | 69 + .../cit/ase/config/LocaleConfiguration.java | 24 + .../config/LoggingAspectConfiguration.java | 17 + .../cit/ase/config/LoggingConfiguration.java | 47 + .../cit/ase/config/OpenApiConfiguration.java | 33 + .../cit/ase/config/SecurityConfiguration.java | 97 + .../ase/config/SecurityJwtConfiguration.java | 77 + .../StaticResourcesWebConfiguration.java | 59 + .../de/tum/cit/ase/config/WebConfigurer.java | 96 + .../ase/config/WebsocketConfiguration.java | 90 + .../WebsocketSecurityConfiguration.java | 40 + .../de/tum/cit/ase/config/package-info.java | 4 + .../ase/domain/AbstractAuditingEntity.java | 75 + .../java/de/tum/cit/ase/domain/Authority.java | 58 + src/main/java/de/tum/cit/ase/domain/User.java | 227 + .../de/tum/cit/ase/domain/package-info.java | 4 + .../ase/management/SecurityMetersService.java | 51 + .../tum/cit/ase/management/package-info.java | 4 + .../java/de/tum/cit/ase/package-info.java | 4 + .../ase/repository/AuthorityRepository.java | 9 + .../cit/ase/repository/UserRepository.java | 36 + .../tum/cit/ase/repository/package-info.java | 4 + .../ase/security/AuthoritiesConstants.java | 15 + .../security/DomainUserDetailsService.java | 62 + .../tum/cit/ase/security/SecurityUtils.java | 107 + .../security/SpringSecurityAuditorAware.java | 18 + .../security/UserNotActivatedException.java | 19 + .../de/tum/cit/ase/security/package-info.java | 4 + .../service/EmailAlreadyUsedException.java | 10 + .../ase/service/InvalidPasswordException.java | 10 + .../de/tum/cit/ase/service/MailService.java | 118 + .../de/tum/cit/ase/service/UserService.java | 327 ++ .../service/UsernameAlreadyUsedException.java | 10 + .../tum/cit/ase/service/dto/AdminUserDTO.java | 196 + .../ase/service/dto/PasswordChangeDTO.java | 39 + .../de/tum/cit/ase/service/dto/UserDTO.java | 51 + .../tum/cit/ase/service/dto/package-info.java | 4 + .../cit/ase/service/mapper/UserMapper.java | 147 + .../cit/ase/service/mapper/package-info.java | 4 + .../de/tum/cit/ase/service/package-info.java | 4 + .../tum/cit/ase/web/filter/SpaWebFilter.java | 34 + .../tum/cit/ase/web/filter/package-info.java | 4 + .../tum/cit/ase/web/rest/AccountResource.java | 181 + .../ase/web/rest/AuthenticateController.java | 124 + .../cit/ase/web/rest/PublicUserResource.java | 65 + .../de/tum/cit/ase/web/rest/UserResource.java | 212 + .../rest/errors/BadRequestAlertException.java | 50 + .../errors/EmailAlreadyUsedException.java | 11 + .../ase/web/rest/errors/ErrorConstants.java | 17 + .../web/rest/errors/ExceptionTranslator.java | 252 ++ .../cit/ase/web/rest/errors/FieldErrorVM.java | 32 + .../rest/errors/InvalidPasswordException.java | 24 + .../errors/LoginAlreadyUsedException.java | 11 + .../cit/ase/web/rest/errors/package-info.java | 4 + .../de/tum/cit/ase/web/rest/package-info.java | 4 + .../cit/ase/web/rest/vm/KeyAndPasswordVM.java | 27 + .../de/tum/cit/ase/web/rest/vm/LoginVM.java | 53 + .../cit/ase/web/rest/vm/ManagedUserVM.java | 35 + .../tum/cit/ase/web/rest/vm/package-info.java | 4 + .../ase/web/websocket/ActivityService.java | 46 + .../ase/web/websocket/dto/ActivityDTO.java | 71 + .../ase/web/websocket/dto/package-info.java | 4 + .../cit/ase/web/websocket/package-info.java | 4 + src/main/resources/banner.txt | 10 + src/main/resources/config/application-dev.yml | 110 + .../resources/config/application-prod.yml | 129 + src/main/resources/config/application-tls.yml | 19 + src/main/resources/config/application.yml | 212 + .../00000000000000_initial_schema.xml | 116 + .../config/liquibase/data/authority.csv | 3 + .../resources/config/liquibase/data/user.csv | 3 + .../config/liquibase/data/user_authority.csv | 4 + .../resources/config/liquibase/master.xml | 17 + src/main/resources/i18n/messages.properties | 21 + src/main/resources/logback-spring.xml | 76 + src/main/resources/swagger/api.yml | 72 + src/main/resources/templates/error.html | 94 + .../templates/mail/activationEmail.html | 20 + .../templates/mail/creationEmail.html | 20 + .../templates/mail/passwordResetEmail.html | 22 + src/main/webapp/404.html | 58 + src/main/webapp/WEB-INF/web.xml | 13 + src/main/webapp/app/account/account.route.ts | 19 + .../account/activate/activate.component.html | 16 + .../activate/activate.component.spec.ts | 68 + .../account/activate/activate.component.ts | 29 + .../app/account/activate/activate.route.ts | 11 + .../account/activate/activate.service.spec.ts | 47 + .../app/account/activate/activate.service.ts | 19 + .../password-reset-finish.component.html | 97 + .../password-reset-finish.component.spec.ts | 97 + .../finish/password-reset-finish.component.ts | 71 + .../finish/password-reset-finish.route.ts | 11 + .../password-reset-finish.service.spec.ts | 44 + .../finish/password-reset-finish.service.ts | 17 + .../init/password-reset-init.component.html | 53 + .../password-reset-init.component.spec.ts | 62 + .../init/password-reset-init.component.ts | 36 + .../init/password-reset-init.route.ts | 11 + .../init/password-reset-init.service.spec.ts | 43 + .../init/password-reset-init.service.ts | 17 + .../password-strength-bar.component.html | 10 + .../password-strength-bar.component.scss | 23 + .../password-strength-bar.component.spec.ts | 46 + .../password-strength-bar.component.ts | 79 + .../account/password/password.component.html | 110 + .../password/password.component.spec.ts | 103 + .../account/password/password.component.ts | 58 + .../app/account/password/password.route.ts | 13 + .../account/password/password.service.spec.ts | 44 + .../app/account/password/password.service.ts | 17 + .../account/register/register.component.html | 152 + .../register/register.component.spec.ts | 132 + .../account/register/register.component.ts | 85 + .../app/account/register/register.model.ts | 8 + .../app/account/register/register.route.ts | 11 + .../account/register/register.service.spec.ts | 48 + .../app/account/register/register.service.ts | 18 + .../account/settings/settings.component.html | 103 + .../settings/settings.component.spec.ts | 88 + .../account/settings/settings.component.ts | 60 + .../app/account/settings/settings.route.ts | 13 + .../webapp/app/admin/admin-routing.module.ts | 48 + .../configuration.component.html | 55 + .../configuration.component.spec.ts | 66 + .../configuration/configuration.component.ts | 40 + .../configuration/configuration.model.ts | 40 + .../configuration.service.spec.ts | 71 + .../configuration/configuration.service.ts | 31 + .../webapp/app/admin/docs/docs.component.html | 10 + .../webapp/app/admin/docs/docs.component.scss | 6 + .../webapp/app/admin/docs/docs.component.ts | 9 + .../app/admin/health/health.component.html | 42 + .../app/admin/health/health.component.spec.ts | 65 + .../app/admin/health/health.component.ts | 50 + .../webapp/app/admin/health/health.model.ts | 15 + .../app/admin/health/health.service.spec.ts | 48 + .../webapp/app/admin/health/health.service.ts | 18 + .../health/modal/health-modal.component.html | 36 + .../modal/health-modal.component.spec.ts | 111 + .../health/modal/health-modal.component.ts | 37 + src/main/webapp/app/admin/logs/log.model.ts | 18 + .../webapp/app/admin/logs/logs.component.html | 78 + .../app/admin/logs/logs.component.spec.ts | 82 + .../webapp/app/admin/logs/logs.component.ts | 65 + .../app/admin/logs/logs.service.spec.ts | 31 + .../webapp/app/admin/logs/logs.service.ts | 22 + .../jvm-memory/jvm-memory.component.html | 28 + .../blocks/jvm-memory/jvm-memory.component.ts | 22 + .../jvm-threads/jvm-threads.component.html | 55 + .../jvm-threads/jvm-threads.component.ts | 58 + .../metrics-cache.component.html | 42 + .../metrics-cache/metrics-cache.component.ts | 26 + .../metrics-datasource.component.html | 57 + .../metrics-datasource.component.ts | 26 + .../metrics-endpoints-requests.component.html | 24 + .../metrics-endpoints-requests.component.ts | 22 + .../metrics-garbagecollector.component.html | 92 + .../metrics-garbagecollector.component.ts | 22 + .../metrics-modal-threads.component.html | 90 + .../metrics-modal-threads.component.spec.ts | 325 ++ .../metrics-modal-threads.component.ts | 62 + .../metrics-request.component.html | 26 + .../metrics-request.component.ts | 26 + .../metrics-system.component.html | 51 + .../metrics-system.component.ts | 46 + .../app/admin/metrics/metrics.component.html | 49 + .../admin/metrics/metrics.component.spec.ts | 146 + .../app/admin/metrics/metrics.component.ts | 66 + .../webapp/app/admin/metrics/metrics.model.ts | 159 + .../app/admin/metrics/metrics.service.spec.ts | 81 + .../app/admin/metrics/metrics.service.ts | 22 + .../app/admin/tracker/tracker.component.html | 25 + .../app/admin/tracker/tracker.component.ts | 52 + ...er-management-delete-dialog.component.html | 21 + ...management-delete-dialog.component.spec.ts | 51 + ...user-management-delete-dialog.component.ts | 32 + .../user-management-detail.component.html | 51 + .../user-management-detail.component.spec.ts | 56 + .../user-management-detail.component.ts | 23 + .../list/user-management.component.html | 106 + .../list/user-management.component.spec.ts | 103 + .../list/user-management.component.ts | 116 + .../service/user-management.service.spec.ts | 67 + .../service/user-management.service.ts | 43 + .../user-management-update.component.html | 100 + .../user-management-update.component.spec.ts | 94 + .../user-management-update.component.ts | 90 + .../user-management/user-management.model.ts | 31 + .../user-management/user-management.route.ts | 50 + .../webapp/app/app-page-title-strategy.ts | 17 + src/main/webapp/app/app-routing.module.ts | 55 + src/main/webapp/app/app.constants.ts | 9 + src/main/webapp/app/app.module.ts | 56 + .../webapp/app/config/authority.constants.ts | 4 + .../webapp/app/config/datepicker-adapter.ts | 20 + src/main/webapp/app/config/dayjs.ts | 11 + src/main/webapp/app/config/error.constants.ts | 3 + .../webapp/app/config/font-awesome-icons.ts | 83 + src/main/webapp/app/config/input.constants.ts | 2 + .../webapp/app/config/navigation.constants.ts | 5 + .../webapp/app/config/pagination.constants.ts | 3 + .../app/config/uib-pagination.config.ts | 14 + .../webapp/app/core/auth/account.model.ts | 12 + .../app/core/auth/account.service.spec.ts | 216 + .../webapp/app/core/auth/account.service.ts | 81 + .../app/core/auth/auth-jwt.service.spec.ts | 80 + .../webapp/app/core/auth/auth-jwt.service.ts | 42 + .../app/core/auth/state-storage.service.ts | 40 + .../core/auth/user-route-access.service.ts | 33 + .../config/application-config.service.spec.ts | 40 + .../core/config/application-config.service.ts | 28 + .../interceptor/auth-expired.interceptor.ts | 33 + .../app/core/interceptor/auth.interceptor.ts | 31 + .../interceptor/error-handler.interceptor.ts | 23 + src/main/webapp/app/core/interceptor/index.ts | 29 + .../interceptor/notification.interceptor.ts | 34 + .../webapp/app/core/request/request-util.ts | 23 + .../webapp/app/core/request/request.model.ts | 11 + .../core/tracker/tracker-activity.model.ts | 9 + .../app/core/tracker/tracker.service.ts | 109 + .../app/core/util/alert.service.spec.ts | 233 + .../webapp/app/core/util/alert.service.ts | 76 + .../app/core/util/data-util.service.spec.ts | 34 + .../webapp/app/core/util/data-util.service.ts | 130 + .../core/util/event-manager.service.spec.ts | 84 + .../app/core/util/event-manager.service.ts | 66 + .../webapp/app/core/util/operators.spec.ts | 18 + src/main/webapp/app/core/util/operators.ts | 9 + .../app/core/util/parse-links.service.spec.ts | 36 + .../app/core/util/parse-links.service.ts | 47 + .../app/entities/entity-navbar-items.ts | 3 + .../app/entities/entity-routing.module.ts | 11 + .../webapp/app/entities/user/user.model.ts | 15 + .../app/entities/user/user.service.spec.ts | 109 + .../webapp/app/entities/user/user.service.ts | 48 + src/main/webapp/app/home/home.component.html | 54 + src/main/webapp/app/home/home.component.scss | 23 + .../webapp/app/home/home.component.spec.ts | 111 + src/main/webapp/app/home/home.component.ts | 42 + .../app/layouts/error/error.component.html | 15 + .../app/layouts/error/error.component.ts | 23 + .../webapp/app/layouts/error/error.route.ts | 31 + .../app/layouts/footer/footer.component.html | 3 + .../app/layouts/footer/footer.component.ts | 8 + .../app/layouts/main/main.component.html | 13 + .../app/layouts/main/main.component.spec.ts | 117 + .../webapp/app/layouts/main/main.component.ts | 23 + .../webapp/app/layouts/main/main.module.ts | 13 + .../app/layouts/navbar/navbar-item.model.d.ts | 6 + .../app/layouts/navbar/navbar.component.html | 179 + .../app/layouts/navbar/navbar.component.scss | 36 + .../layouts/navbar/navbar.component.spec.ts | 95 + .../app/layouts/navbar/navbar.component.ts | 69 + .../profiles/page-ribbon.component.scss | 25 + .../profiles/page-ribbon.component.spec.ts | 39 + .../layouts/profiles/page-ribbon.component.ts | 27 + .../layouts/profiles/profile-info.model.ts | 15 + .../app/layouts/profiles/profile.service.ts | 44 + .../webapp/app/login/login.component.html | 55 + .../webapp/app/login/login.component.spec.ts | 152 + src/main/webapp/app/login/login.component.ts | 58 + src/main/webapp/app/login/login.model.ts | 7 + src/main/webapp/app/login/login.service.ts | 24 + .../shared/alert/alert-error.component.html | 7 + .../alert/alert-error.component.spec.ts | 158 + .../app/shared/alert/alert-error.component.ts | 102 + .../app/shared/alert/alert-error.model.ts | 3 + .../app/shared/alert/alert.component.html | 7 + .../app/shared/alert/alert.component.spec.ts | 44 + .../app/shared/alert/alert.component.ts | 37 + .../auth/has-any-authority.directive.spec.ts | 131 + .../auth/has-any-authority.directive.ts | 58 + .../webapp/app/shared/date/duration.pipe.ts | 16 + .../date/format-medium-date.pipe.spec.ts | 19 + .../shared/date/format-medium-date.pipe.ts | 13 + .../date/format-medium-datetime.pipe.spec.ts | 19 + .../date/format-medium-datetime.pipe.ts | 13 + src/main/webapp/app/shared/date/index.ts | 3 + .../app/shared/filter/filter.component.html | 12 + .../app/shared/filter/filter.component.ts | 21 + .../app/shared/filter/filter.model.spec.ts | 242 ++ .../webapp/app/shared/filter/filter.model.ts | 159 + src/main/webapp/app/shared/filter/index.ts | 2 + .../webapp/app/shared/pagination/index.ts | 1 + .../pagination/item-count.component.spec.ts | 64 + .../shared/pagination/item-count.component.ts | 32 + src/main/webapp/app/shared/shared.module.ts | 15 + src/main/webapp/app/shared/sort/index.ts | 2 + .../app/shared/sort/sort-by.directive.spec.ts | 140 + .../app/shared/sort/sort-by.directive.ts | 56 + .../app/shared/sort/sort.directive.spec.ts | 87 + .../webapp/app/shared/sort/sort.directive.ts | 40 + .../webapp/app/shared/sort/sort.service.ts | 13 + src/main/webapp/bootstrap.ts | 16 + src/main/webapp/content/css/loading.css | 152 + .../images/jhipster_family_member_0.svg | 1 + .../jhipster_family_member_0_head-192.png | Bin 0 -> 13439 bytes .../jhipster_family_member_0_head-256.png | Bin 0 -> 7037 bytes .../jhipster_family_member_0_head-384.png | Bin 0 -> 10350 bytes .../jhipster_family_member_0_head-512.png | Bin 0 -> 11431 bytes .../images/jhipster_family_member_1.svg | 1 + .../jhipster_family_member_1_head-192.png | Bin 0 -> 7046 bytes .../jhipster_family_member_1_head-256.png | Bin 0 -> 9505 bytes .../jhipster_family_member_1_head-384.png | Bin 0 -> 15054 bytes .../jhipster_family_member_1_head-512.png | Bin 0 -> 16456 bytes .../images/jhipster_family_member_2.svg | 1 + .../jhipster_family_member_2_head-192.png | Bin 0 -> 5423 bytes .../jhipster_family_member_2_head-256.png | Bin 0 -> 6687 bytes .../jhipster_family_member_2_head-384.png | Bin 0 -> 9682 bytes .../jhipster_family_member_2_head-512.png | Bin 0 -> 10514 bytes .../images/jhipster_family_member_3.svg | 1 + .../jhipster_family_member_3_head-192.png | Bin 0 -> 6148 bytes .../jhipster_family_member_3_head-256.png | Bin 0 -> 8028 bytes .../jhipster_family_member_3_head-384.png | Bin 0 -> 11998 bytes .../jhipster_family_member_3_head-512.png | Bin 0 -> 13555 bytes .../webapp/content/images/logo-jhipster.png | Bin 0 -> 605 bytes .../content/scss/_bootstrap-variables.scss | 45 + src/main/webapp/content/scss/global.scss | 239 ++ src/main/webapp/content/scss/vendor.scss | 12 + src/main/webapp/declarations.d.ts | 1 + src/main/webapp/favicon.ico | Bin 0 -> 1574 bytes src/main/webapp/index.html | 126 + src/main/webapp/main.ts | 1 + src/main/webapp/manifest.webapp | 31 + src/main/webapp/robots.txt | 10 + src/main/webapp/sockjs-client.polyfill.ts | 1 + .../swagger-ui/dist/images/throbber.gif | Bin 0 -> 9257 bytes src/main/webapp/swagger-ui/index.html | 96 + .../java/de/tum/cit/ase/IntegrationTest.java | 21 + .../tum/cit/ase/TechnicalStructureTest.java | 38 + .../ase/config/AsyncSyncConfiguration.java | 15 + .../de/tum/cit/ase/config/EmbeddedSQL.java | 11 + .../cit/ase/config/MysqlTestContainer.java | 42 + .../config/SpringBootTestClassOrderer.java | 22 + .../tum/cit/ase/config/SqlTestContainer.java | 9 + ...tainersSpringContextCustomizerFactory.java | 52 + .../StaticResourcesWebConfigurerTest.java | 76 + .../tum/cit/ase/config/WebConfigurerTest.java | 132 + .../config/WebConfigurerTestController.java | 14 + .../config/timezone/HibernateTimeZoneIT.java | 172 + .../SecurityMetersServiceTests.java | 70 + .../repository/timezone/DateTimeWrapper.java | 132 + .../timezone/DateTimeWrapperRepository.java | 10 + .../security/DomainUserDetailsServiceIT.java | 113 + .../ase/security/SecurityUtilsUnitTest.java | 101 + .../jwt/AuthenticationIntegrationTest.java | 35 + .../jwt/JwtAuthenticationTestUtils.java | 106 + .../security/jwt/TokenAuthenticationIT.java | 53 + .../TokenAuthenticationSecurityMetersIT.java | 87 + .../de/tum/cit/ase/service/MailServiceIT.java | 235 + .../de/tum/cit/ase/service/UserServiceIT.java | 180 + .../ase/service/mapper/UserMapperTest.java | 132 + .../cit/ase/web/filter/SpaWebFilterIT.java | 88 + .../cit/ase/web/rest/AccountResourceIT.java | 752 ++++ .../web/rest/AuthenticateControllerIT.java | 98 + .../ase/web/rest/PublicUserResourceIT.java | 99 + .../de/tum/cit/ase/web/rest/TestUtil.java | 206 + .../tum/cit/ase/web/rest/UserResourceIT.java | 557 +++ .../web/rest/WithUnauthenticatedMockUser.java | 23 + .../rest/errors/ExceptionTranslatorIT.java | 117 + .../ExceptionTranslatorTestController.java | 66 + src/test/resources/META-INF/spring.factories | 2 + .../resources/config/application-testdev.yml | 40 + .../resources/config/application-testprod.yml | 40 + src/test/resources/config/application.yml | 90 + .../resources/i18n/messages_en.properties | 1 + src/test/resources/junit-platform.properties | 4 + src/test/resources/logback.xml | 45 + .../templates/mail/activationEmail.html | 19 + .../templates/mail/creationEmail.html | 19 + .../templates/mail/passwordResetEmail.html | 21 + .../resources/templates/mail/testEmail.html | 1 + tsconfig.app.json | 9 + tsconfig.json | 35 + tsconfig.spec.json | 9 + webpack/environment.js | 6 + webpack/logo-jhipster.png | Bin 0 -> 3326 bytes webpack/proxy.conf.js | 19 + webpack/webpack.custom.js | 122 + 444 files changed, 27469 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .editorconfig create mode 100644 .eslintignore create mode 100644 .eslintrc.json create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100755 .husky/pre-commit create mode 100644 .lintstagedrc.cjs create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 .yo-rc.json create mode 100644 README.md create mode 100644 angular.json create mode 100644 build.gradle create mode 100644 checkstyle.xml create mode 100644 gradle.properties create mode 100644 gradle/cache.gradle create mode 100644 gradle/docker.gradle create mode 100644 gradle/liquibase.gradle create mode 100644 gradle/profile_dev.gradle create mode 100644 gradle/profile_prod.gradle create mode 100644 gradle/sonar.gradle create mode 100644 gradle/swagger.gradle create mode 100644 gradle/war.gradle create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradle/zipkin.gradle create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 jest.conf.js create mode 100644 ngsw-config.json create mode 100755 npmw create mode 100644 npmw.cmd create mode 100644 package.json create mode 100644 settings.gradle create mode 100644 sonar-project.properties create mode 100644 src/main/docker/app.yml create mode 100644 src/main/docker/config/mysql/my.cnf create mode 100644 src/main/docker/grafana/provisioning/dashboards/JVM.json create mode 100644 src/main/docker/grafana/provisioning/dashboards/dashboard.yml create mode 100644 src/main/docker/grafana/provisioning/datasources/datasource.yml create mode 100644 src/main/docker/hazelcast-management-center.yml create mode 100644 src/main/docker/jhipster-control-center.yml create mode 100644 src/main/docker/jib/entrypoint.sh create mode 100644 src/main/docker/monitoring.yml create mode 100644 src/main/docker/mysql.yml create mode 100644 src/main/docker/prometheus/prometheus.yml create mode 100644 src/main/docker/services.yml create mode 100644 src/main/docker/sonar.yml create mode 100644 src/main/docker/swagger-editor.yml create mode 100644 src/main/java/de/tum/cit/ase/ApplicationWebXml.java create mode 100644 src/main/java/de/tum/cit/ase/ArtemisBenchmarkingApp.java create mode 100644 src/main/java/de/tum/cit/ase/GeneratedByJHipster.java create mode 100644 src/main/java/de/tum/cit/ase/aop/logging/LoggingAspect.java create mode 100644 src/main/java/de/tum/cit/ase/aop/logging/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/config/ApplicationProperties.java create mode 100644 src/main/java/de/tum/cit/ase/config/AsyncConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/CRLFLogConverter.java create mode 100644 src/main/java/de/tum/cit/ase/config/CacheConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/Constants.java create mode 100644 src/main/java/de/tum/cit/ase/config/DatabaseConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/DateTimeFormatConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/JacksonConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/LiquibaseConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/LocaleConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/LoggingAspectConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/LoggingConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/OpenApiConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/SecurityConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/SecurityJwtConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/StaticResourcesWebConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/WebConfigurer.java create mode 100644 src/main/java/de/tum/cit/ase/config/WebsocketConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/WebsocketSecurityConfiguration.java create mode 100644 src/main/java/de/tum/cit/ase/config/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/domain/AbstractAuditingEntity.java create mode 100644 src/main/java/de/tum/cit/ase/domain/Authority.java create mode 100644 src/main/java/de/tum/cit/ase/domain/User.java create mode 100644 src/main/java/de/tum/cit/ase/domain/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/management/SecurityMetersService.java create mode 100644 src/main/java/de/tum/cit/ase/management/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/repository/AuthorityRepository.java create mode 100644 src/main/java/de/tum/cit/ase/repository/UserRepository.java create mode 100644 src/main/java/de/tum/cit/ase/repository/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/security/AuthoritiesConstants.java create mode 100644 src/main/java/de/tum/cit/ase/security/DomainUserDetailsService.java create mode 100644 src/main/java/de/tum/cit/ase/security/SecurityUtils.java create mode 100644 src/main/java/de/tum/cit/ase/security/SpringSecurityAuditorAware.java create mode 100644 src/main/java/de/tum/cit/ase/security/UserNotActivatedException.java create mode 100644 src/main/java/de/tum/cit/ase/security/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/service/EmailAlreadyUsedException.java create mode 100644 src/main/java/de/tum/cit/ase/service/InvalidPasswordException.java create mode 100644 src/main/java/de/tum/cit/ase/service/MailService.java create mode 100644 src/main/java/de/tum/cit/ase/service/UserService.java create mode 100644 src/main/java/de/tum/cit/ase/service/UsernameAlreadyUsedException.java create mode 100644 src/main/java/de/tum/cit/ase/service/dto/AdminUserDTO.java create mode 100644 src/main/java/de/tum/cit/ase/service/dto/PasswordChangeDTO.java create mode 100644 src/main/java/de/tum/cit/ase/service/dto/UserDTO.java create mode 100644 src/main/java/de/tum/cit/ase/service/dto/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/service/mapper/UserMapper.java create mode 100644 src/main/java/de/tum/cit/ase/service/mapper/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/service/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/web/filter/SpaWebFilter.java create mode 100644 src/main/java/de/tum/cit/ase/web/filter/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/AccountResource.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/AuthenticateController.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/PublicUserResource.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/UserResource.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/errors/BadRequestAlertException.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/errors/EmailAlreadyUsedException.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/errors/ErrorConstants.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslator.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/errors/FieldErrorVM.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/errors/InvalidPasswordException.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/errors/LoginAlreadyUsedException.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/errors/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/vm/KeyAndPasswordVM.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/vm/LoginVM.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/vm/ManagedUserVM.java create mode 100644 src/main/java/de/tum/cit/ase/web/rest/vm/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/web/websocket/ActivityService.java create mode 100644 src/main/java/de/tum/cit/ase/web/websocket/dto/ActivityDTO.java create mode 100644 src/main/java/de/tum/cit/ase/web/websocket/dto/package-info.java create mode 100644 src/main/java/de/tum/cit/ase/web/websocket/package-info.java create mode 100644 src/main/resources/banner.txt create mode 100644 src/main/resources/config/application-dev.yml create mode 100644 src/main/resources/config/application-prod.yml create mode 100644 src/main/resources/config/application-tls.yml create mode 100644 src/main/resources/config/application.yml create mode 100644 src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml create mode 100644 src/main/resources/config/liquibase/data/authority.csv create mode 100644 src/main/resources/config/liquibase/data/user.csv create mode 100644 src/main/resources/config/liquibase/data/user_authority.csv create mode 100644 src/main/resources/config/liquibase/master.xml create mode 100644 src/main/resources/i18n/messages.properties create mode 100644 src/main/resources/logback-spring.xml create mode 100644 src/main/resources/swagger/api.yml create mode 100644 src/main/resources/templates/error.html create mode 100644 src/main/resources/templates/mail/activationEmail.html create mode 100644 src/main/resources/templates/mail/creationEmail.html create mode 100644 src/main/resources/templates/mail/passwordResetEmail.html create mode 100644 src/main/webapp/404.html create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/main/webapp/app/account/account.route.ts create mode 100644 src/main/webapp/app/account/activate/activate.component.html create mode 100644 src/main/webapp/app/account/activate/activate.component.spec.ts create mode 100644 src/main/webapp/app/account/activate/activate.component.ts create mode 100644 src/main/webapp/app/account/activate/activate.route.ts create mode 100644 src/main/webapp/app/account/activate/activate.service.spec.ts create mode 100644 src/main/webapp/app/account/activate/activate.service.ts create mode 100644 src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html create mode 100644 src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.spec.ts create mode 100644 src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts create mode 100644 src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts create mode 100644 src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.spec.ts create mode 100644 src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts create mode 100644 src/main/webapp/app/account/password-reset/init/password-reset-init.component.html create mode 100644 src/main/webapp/app/account/password-reset/init/password-reset-init.component.spec.ts create mode 100644 src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts create mode 100644 src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts create mode 100644 src/main/webapp/app/account/password-reset/init/password-reset-init.service.spec.ts create mode 100644 src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts create mode 100644 src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.html create mode 100644 src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.scss create mode 100644 src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.spec.ts create mode 100644 src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts create mode 100644 src/main/webapp/app/account/password/password.component.html create mode 100644 src/main/webapp/app/account/password/password.component.spec.ts create mode 100644 src/main/webapp/app/account/password/password.component.ts create mode 100644 src/main/webapp/app/account/password/password.route.ts create mode 100644 src/main/webapp/app/account/password/password.service.spec.ts create mode 100644 src/main/webapp/app/account/password/password.service.ts create mode 100644 src/main/webapp/app/account/register/register.component.html create mode 100644 src/main/webapp/app/account/register/register.component.spec.ts create mode 100644 src/main/webapp/app/account/register/register.component.ts create mode 100644 src/main/webapp/app/account/register/register.model.ts create mode 100644 src/main/webapp/app/account/register/register.route.ts create mode 100644 src/main/webapp/app/account/register/register.service.spec.ts create mode 100644 src/main/webapp/app/account/register/register.service.ts create mode 100644 src/main/webapp/app/account/settings/settings.component.html create mode 100644 src/main/webapp/app/account/settings/settings.component.spec.ts create mode 100644 src/main/webapp/app/account/settings/settings.component.ts create mode 100644 src/main/webapp/app/account/settings/settings.route.ts create mode 100644 src/main/webapp/app/admin/admin-routing.module.ts create mode 100644 src/main/webapp/app/admin/configuration/configuration.component.html create mode 100644 src/main/webapp/app/admin/configuration/configuration.component.spec.ts create mode 100644 src/main/webapp/app/admin/configuration/configuration.component.ts create mode 100644 src/main/webapp/app/admin/configuration/configuration.model.ts create mode 100644 src/main/webapp/app/admin/configuration/configuration.service.spec.ts create mode 100644 src/main/webapp/app/admin/configuration/configuration.service.ts create mode 100644 src/main/webapp/app/admin/docs/docs.component.html create mode 100644 src/main/webapp/app/admin/docs/docs.component.scss create mode 100644 src/main/webapp/app/admin/docs/docs.component.ts create mode 100644 src/main/webapp/app/admin/health/health.component.html create mode 100644 src/main/webapp/app/admin/health/health.component.spec.ts create mode 100644 src/main/webapp/app/admin/health/health.component.ts create mode 100644 src/main/webapp/app/admin/health/health.model.ts create mode 100644 src/main/webapp/app/admin/health/health.service.spec.ts create mode 100644 src/main/webapp/app/admin/health/health.service.ts create mode 100644 src/main/webapp/app/admin/health/modal/health-modal.component.html create mode 100644 src/main/webapp/app/admin/health/modal/health-modal.component.spec.ts create mode 100644 src/main/webapp/app/admin/health/modal/health-modal.component.ts create mode 100644 src/main/webapp/app/admin/logs/log.model.ts create mode 100644 src/main/webapp/app/admin/logs/logs.component.html create mode 100644 src/main/webapp/app/admin/logs/logs.component.spec.ts create mode 100644 src/main/webapp/app/admin/logs/logs.component.ts create mode 100644 src/main/webapp/app/admin/logs/logs.service.spec.ts create mode 100644 src/main/webapp/app/admin/logs/logs.service.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/jvm-threads/jvm-threads.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/jvm-threads/jvm-threads.component.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.spec.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.ts create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.html create mode 100644 src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.ts create mode 100644 src/main/webapp/app/admin/metrics/metrics.component.html create mode 100644 src/main/webapp/app/admin/metrics/metrics.component.spec.ts create mode 100644 src/main/webapp/app/admin/metrics/metrics.component.ts create mode 100644 src/main/webapp/app/admin/metrics/metrics.model.ts create mode 100644 src/main/webapp/app/admin/metrics/metrics.service.spec.ts create mode 100644 src/main/webapp/app/admin/metrics/metrics.service.ts create mode 100644 src/main/webapp/app/admin/tracker/tracker.component.html create mode 100644 src/main/webapp/app/admin/tracker/tracker.component.ts create mode 100644 src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.html create mode 100644 src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.spec.ts create mode 100644 src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.ts create mode 100644 src/main/webapp/app/admin/user-management/detail/user-management-detail.component.html create mode 100644 src/main/webapp/app/admin/user-management/detail/user-management-detail.component.spec.ts create mode 100644 src/main/webapp/app/admin/user-management/detail/user-management-detail.component.ts create mode 100644 src/main/webapp/app/admin/user-management/list/user-management.component.html create mode 100644 src/main/webapp/app/admin/user-management/list/user-management.component.spec.ts create mode 100644 src/main/webapp/app/admin/user-management/list/user-management.component.ts create mode 100644 src/main/webapp/app/admin/user-management/service/user-management.service.spec.ts create mode 100644 src/main/webapp/app/admin/user-management/service/user-management.service.ts create mode 100644 src/main/webapp/app/admin/user-management/update/user-management-update.component.html create mode 100644 src/main/webapp/app/admin/user-management/update/user-management-update.component.spec.ts create mode 100644 src/main/webapp/app/admin/user-management/update/user-management-update.component.ts create mode 100644 src/main/webapp/app/admin/user-management/user-management.model.ts create mode 100644 src/main/webapp/app/admin/user-management/user-management.route.ts create mode 100644 src/main/webapp/app/app-page-title-strategy.ts create mode 100644 src/main/webapp/app/app-routing.module.ts create mode 100644 src/main/webapp/app/app.constants.ts create mode 100644 src/main/webapp/app/app.module.ts create mode 100644 src/main/webapp/app/config/authority.constants.ts create mode 100644 src/main/webapp/app/config/datepicker-adapter.ts create mode 100644 src/main/webapp/app/config/dayjs.ts create mode 100644 src/main/webapp/app/config/error.constants.ts create mode 100644 src/main/webapp/app/config/font-awesome-icons.ts create mode 100644 src/main/webapp/app/config/input.constants.ts create mode 100644 src/main/webapp/app/config/navigation.constants.ts create mode 100644 src/main/webapp/app/config/pagination.constants.ts create mode 100644 src/main/webapp/app/config/uib-pagination.config.ts create mode 100644 src/main/webapp/app/core/auth/account.model.ts create mode 100644 src/main/webapp/app/core/auth/account.service.spec.ts create mode 100644 src/main/webapp/app/core/auth/account.service.ts create mode 100644 src/main/webapp/app/core/auth/auth-jwt.service.spec.ts create mode 100644 src/main/webapp/app/core/auth/auth-jwt.service.ts create mode 100644 src/main/webapp/app/core/auth/state-storage.service.ts create mode 100644 src/main/webapp/app/core/auth/user-route-access.service.ts create mode 100644 src/main/webapp/app/core/config/application-config.service.spec.ts create mode 100644 src/main/webapp/app/core/config/application-config.service.ts create mode 100644 src/main/webapp/app/core/interceptor/auth-expired.interceptor.ts create mode 100644 src/main/webapp/app/core/interceptor/auth.interceptor.ts create mode 100644 src/main/webapp/app/core/interceptor/error-handler.interceptor.ts create mode 100644 src/main/webapp/app/core/interceptor/index.ts create mode 100644 src/main/webapp/app/core/interceptor/notification.interceptor.ts create mode 100644 src/main/webapp/app/core/request/request-util.ts create mode 100644 src/main/webapp/app/core/request/request.model.ts create mode 100644 src/main/webapp/app/core/tracker/tracker-activity.model.ts create mode 100644 src/main/webapp/app/core/tracker/tracker.service.ts create mode 100644 src/main/webapp/app/core/util/alert.service.spec.ts create mode 100644 src/main/webapp/app/core/util/alert.service.ts create mode 100644 src/main/webapp/app/core/util/data-util.service.spec.ts create mode 100644 src/main/webapp/app/core/util/data-util.service.ts create mode 100644 src/main/webapp/app/core/util/event-manager.service.spec.ts create mode 100644 src/main/webapp/app/core/util/event-manager.service.ts create mode 100644 src/main/webapp/app/core/util/operators.spec.ts create mode 100644 src/main/webapp/app/core/util/operators.ts create mode 100644 src/main/webapp/app/core/util/parse-links.service.spec.ts create mode 100644 src/main/webapp/app/core/util/parse-links.service.ts create mode 100644 src/main/webapp/app/entities/entity-navbar-items.ts create mode 100644 src/main/webapp/app/entities/entity-routing.module.ts create mode 100644 src/main/webapp/app/entities/user/user.model.ts create mode 100644 src/main/webapp/app/entities/user/user.service.spec.ts create mode 100644 src/main/webapp/app/entities/user/user.service.ts create mode 100644 src/main/webapp/app/home/home.component.html create mode 100644 src/main/webapp/app/home/home.component.scss create mode 100644 src/main/webapp/app/home/home.component.spec.ts create mode 100644 src/main/webapp/app/home/home.component.ts create mode 100644 src/main/webapp/app/layouts/error/error.component.html create mode 100644 src/main/webapp/app/layouts/error/error.component.ts create mode 100644 src/main/webapp/app/layouts/error/error.route.ts create mode 100644 src/main/webapp/app/layouts/footer/footer.component.html create mode 100644 src/main/webapp/app/layouts/footer/footer.component.ts create mode 100644 src/main/webapp/app/layouts/main/main.component.html create mode 100644 src/main/webapp/app/layouts/main/main.component.spec.ts create mode 100644 src/main/webapp/app/layouts/main/main.component.ts create mode 100644 src/main/webapp/app/layouts/main/main.module.ts create mode 100644 src/main/webapp/app/layouts/navbar/navbar-item.model.d.ts create mode 100644 src/main/webapp/app/layouts/navbar/navbar.component.html create mode 100644 src/main/webapp/app/layouts/navbar/navbar.component.scss create mode 100644 src/main/webapp/app/layouts/navbar/navbar.component.spec.ts create mode 100644 src/main/webapp/app/layouts/navbar/navbar.component.ts create mode 100644 src/main/webapp/app/layouts/profiles/page-ribbon.component.scss create mode 100644 src/main/webapp/app/layouts/profiles/page-ribbon.component.spec.ts create mode 100644 src/main/webapp/app/layouts/profiles/page-ribbon.component.ts create mode 100644 src/main/webapp/app/layouts/profiles/profile-info.model.ts create mode 100644 src/main/webapp/app/layouts/profiles/profile.service.ts create mode 100644 src/main/webapp/app/login/login.component.html create mode 100644 src/main/webapp/app/login/login.component.spec.ts create mode 100644 src/main/webapp/app/login/login.component.ts create mode 100644 src/main/webapp/app/login/login.model.ts create mode 100644 src/main/webapp/app/login/login.service.ts create mode 100644 src/main/webapp/app/shared/alert/alert-error.component.html create mode 100644 src/main/webapp/app/shared/alert/alert-error.component.spec.ts create mode 100644 src/main/webapp/app/shared/alert/alert-error.component.ts create mode 100644 src/main/webapp/app/shared/alert/alert-error.model.ts create mode 100644 src/main/webapp/app/shared/alert/alert.component.html create mode 100644 src/main/webapp/app/shared/alert/alert.component.spec.ts create mode 100644 src/main/webapp/app/shared/alert/alert.component.ts create mode 100644 src/main/webapp/app/shared/auth/has-any-authority.directive.spec.ts create mode 100644 src/main/webapp/app/shared/auth/has-any-authority.directive.ts create mode 100644 src/main/webapp/app/shared/date/duration.pipe.ts create mode 100644 src/main/webapp/app/shared/date/format-medium-date.pipe.spec.ts create mode 100644 src/main/webapp/app/shared/date/format-medium-date.pipe.ts create mode 100644 src/main/webapp/app/shared/date/format-medium-datetime.pipe.spec.ts create mode 100644 src/main/webapp/app/shared/date/format-medium-datetime.pipe.ts create mode 100644 src/main/webapp/app/shared/date/index.ts create mode 100644 src/main/webapp/app/shared/filter/filter.component.html create mode 100644 src/main/webapp/app/shared/filter/filter.component.ts create mode 100644 src/main/webapp/app/shared/filter/filter.model.spec.ts create mode 100644 src/main/webapp/app/shared/filter/filter.model.ts create mode 100644 src/main/webapp/app/shared/filter/index.ts create mode 100644 src/main/webapp/app/shared/pagination/index.ts create mode 100644 src/main/webapp/app/shared/pagination/item-count.component.spec.ts create mode 100644 src/main/webapp/app/shared/pagination/item-count.component.ts create mode 100644 src/main/webapp/app/shared/shared.module.ts create mode 100644 src/main/webapp/app/shared/sort/index.ts create mode 100644 src/main/webapp/app/shared/sort/sort-by.directive.spec.ts create mode 100644 src/main/webapp/app/shared/sort/sort-by.directive.ts create mode 100644 src/main/webapp/app/shared/sort/sort.directive.spec.ts create mode 100644 src/main/webapp/app/shared/sort/sort.directive.ts create mode 100644 src/main/webapp/app/shared/sort/sort.service.ts create mode 100644 src/main/webapp/bootstrap.ts create mode 100644 src/main/webapp/content/css/loading.css create mode 100644 src/main/webapp/content/images/jhipster_family_member_0.svg create mode 100644 src/main/webapp/content/images/jhipster_family_member_0_head-192.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_0_head-256.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_0_head-384.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_0_head-512.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_1.svg create mode 100644 src/main/webapp/content/images/jhipster_family_member_1_head-192.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_1_head-256.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_1_head-384.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_1_head-512.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_2.svg create mode 100644 src/main/webapp/content/images/jhipster_family_member_2_head-192.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_2_head-256.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_2_head-384.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_2_head-512.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_3.svg create mode 100644 src/main/webapp/content/images/jhipster_family_member_3_head-192.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_3_head-256.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_3_head-384.png create mode 100644 src/main/webapp/content/images/jhipster_family_member_3_head-512.png create mode 100644 src/main/webapp/content/images/logo-jhipster.png create mode 100644 src/main/webapp/content/scss/_bootstrap-variables.scss create mode 100644 src/main/webapp/content/scss/global.scss create mode 100644 src/main/webapp/content/scss/vendor.scss create mode 100644 src/main/webapp/declarations.d.ts create mode 100644 src/main/webapp/favicon.ico create mode 100644 src/main/webapp/index.html create mode 100644 src/main/webapp/main.ts create mode 100644 src/main/webapp/manifest.webapp create mode 100644 src/main/webapp/robots.txt create mode 100644 src/main/webapp/sockjs-client.polyfill.ts create mode 100644 src/main/webapp/swagger-ui/dist/images/throbber.gif create mode 100644 src/main/webapp/swagger-ui/index.html create mode 100644 src/test/java/de/tum/cit/ase/IntegrationTest.java create mode 100644 src/test/java/de/tum/cit/ase/TechnicalStructureTest.java create mode 100644 src/test/java/de/tum/cit/ase/config/AsyncSyncConfiguration.java create mode 100644 src/test/java/de/tum/cit/ase/config/EmbeddedSQL.java create mode 100644 src/test/java/de/tum/cit/ase/config/MysqlTestContainer.java create mode 100644 src/test/java/de/tum/cit/ase/config/SpringBootTestClassOrderer.java create mode 100644 src/test/java/de/tum/cit/ase/config/SqlTestContainer.java create mode 100644 src/test/java/de/tum/cit/ase/config/SqlTestContainersSpringContextCustomizerFactory.java create mode 100644 src/test/java/de/tum/cit/ase/config/StaticResourcesWebConfigurerTest.java create mode 100644 src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java create mode 100644 src/test/java/de/tum/cit/ase/config/WebConfigurerTestController.java create mode 100644 src/test/java/de/tum/cit/ase/config/timezone/HibernateTimeZoneIT.java create mode 100644 src/test/java/de/tum/cit/ase/management/SecurityMetersServiceTests.java create mode 100644 src/test/java/de/tum/cit/ase/repository/timezone/DateTimeWrapper.java create mode 100644 src/test/java/de/tum/cit/ase/repository/timezone/DateTimeWrapperRepository.java create mode 100644 src/test/java/de/tum/cit/ase/security/DomainUserDetailsServiceIT.java create mode 100644 src/test/java/de/tum/cit/ase/security/SecurityUtilsUnitTest.java create mode 100644 src/test/java/de/tum/cit/ase/security/jwt/AuthenticationIntegrationTest.java create mode 100644 src/test/java/de/tum/cit/ase/security/jwt/JwtAuthenticationTestUtils.java create mode 100644 src/test/java/de/tum/cit/ase/security/jwt/TokenAuthenticationIT.java create mode 100644 src/test/java/de/tum/cit/ase/security/jwt/TokenAuthenticationSecurityMetersIT.java create mode 100644 src/test/java/de/tum/cit/ase/service/MailServiceIT.java create mode 100644 src/test/java/de/tum/cit/ase/service/UserServiceIT.java create mode 100644 src/test/java/de/tum/cit/ase/service/mapper/UserMapperTest.java create mode 100644 src/test/java/de/tum/cit/ase/web/filter/SpaWebFilterIT.java create mode 100644 src/test/java/de/tum/cit/ase/web/rest/AccountResourceIT.java create mode 100644 src/test/java/de/tum/cit/ase/web/rest/AuthenticateControllerIT.java create mode 100644 src/test/java/de/tum/cit/ase/web/rest/PublicUserResourceIT.java create mode 100644 src/test/java/de/tum/cit/ase/web/rest/TestUtil.java create mode 100644 src/test/java/de/tum/cit/ase/web/rest/UserResourceIT.java create mode 100644 src/test/java/de/tum/cit/ase/web/rest/WithUnauthenticatedMockUser.java create mode 100644 src/test/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslatorIT.java create mode 100644 src/test/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslatorTestController.java create mode 100644 src/test/resources/META-INF/spring.factories create mode 100644 src/test/resources/config/application-testdev.yml create mode 100644 src/test/resources/config/application-testprod.yml create mode 100644 src/test/resources/config/application.yml create mode 100644 src/test/resources/i18n/messages_en.properties create mode 100644 src/test/resources/junit-platform.properties create mode 100644 src/test/resources/logback.xml create mode 100644 src/test/resources/templates/mail/activationEmail.html create mode 100644 src/test/resources/templates/mail/creationEmail.html create mode 100644 src/test/resources/templates/mail/passwordResetEmail.html create mode 100644 src/test/resources/templates/mail/testEmail.html create mode 100644 tsconfig.app.json create mode 100644 tsconfig.json create mode 100644 tsconfig.spec.json create mode 100644 webpack/environment.js create mode 100644 webpack/logo-jhipster.png create mode 100644 webpack/proxy.conf.js create mode 100644 webpack/webpack.custom.js diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..a914fd25 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,25 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/java/.devcontainer/base.Dockerfile + +# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 17, 17-bullseye, 17-buster +ARG VARIANT="17" +FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT} + +# [Option] Install Maven +ARG INSTALL_MAVEN="false" +ARG MAVEN_VERSION="" +# [Option] Install Gradle +ARG INSTALL_GRADLE="false" +ARG GRADLE_VERSION="" +RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \ + && if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi + +# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..78bbd390 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,53 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/java +{ + "name": "Artemis-benchmarking", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update the VARIANT arg to pick a Java version: 17, 19 + // Append -bullseye or -buster to pin to an OS version. + // Use the -bullseye variants on local arm64/Apple Silicon. + "VARIANT": "17-bullseye", + // Options + // maven and gradle wrappers are used by default, we don't need them installed globally + // "INSTALL_MAVEN": "false", + // "INSTALL_GRADLE": "true", + "NODE_VERSION": "18.18.2" + } + }, + + "customizations": { + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "java.jdt.ls.java.home": "/docker-java-home" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "angular.ng-template", + "christian-kohler.npm-intellisense", + "firsttris.vscode-jest-runner", + "ms-vscode.vscode-typescript-tslint-plugin", + "dbaeumer.vscode-eslint", + "vscjava.vscode-java-pack", + "pivotal.vscode-boot-dev-pack", + "esbenp.prettier-vscode" + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [4200, 3001, 9000, 8080], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "java -version", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "docker-in-docker": "latest", + "docker-from-docker": "latest" + } +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..c2fa6a2d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + +[*] + +# We recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# Change these settings to your own preference +indent_style = space +indent_size = 4 + +[*.{ts,tsx,js,jsx,json,css,scss,yml,html,vue}] +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..c858f1cc --- /dev/null +++ b/.eslintignore @@ -0,0 +1,10 @@ +node_modules/ +src/main/docker/ +jest.conf.js +webpack/ +target/ +build/ +node/ +coverage/ +postcss.config.js +build/resources/main/static/ diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..96996aea --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,99 @@ +{ + "parser": "@typescript-eslint/parser", + "plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@angular-eslint/recommended", + "prettier", + "eslint-config-prettier" + ], + "env": { + "browser": true, + "es6": true, + "commonjs": true + }, + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module", + "project": ["./tsconfig.app.json", "./tsconfig.spec.json"] + }, + "rules": { + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "jhi", + "style": "kebab-case" + } + ], + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "jhi", + "style": "camelCase" + } + ], + "@angular-eslint/relative-url-prefix": "error", + "@typescript-eslint/ban-types": [ + "error", + { + "extendDefaults": true, + "types": { + "{}": false + } + } + ], + "@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }], + "@typescript-eslint/explicit-module-boundary-types": "off", + "@typescript-eslint/member-ordering": [ + "error", + { + "default": [ + "public-static-field", + "protected-static-field", + "private-static-field", + "public-instance-field", + "protected-instance-field", + "private-instance-field", + "constructor", + "public-static-method", + "protected-static-method", + "private-static-method", + "public-instance-method", + "protected-instance-method", + "private-instance-method" + ] + } + ], + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-shadow": ["error"], + "@typescript-eslint/no-unnecessary-condition": "error", + "@typescript-eslint/no-unsafe-argument": "off", + "@typescript-eslint/no-unsafe-assignment": "off", + "@typescript-eslint/no-unsafe-call": "off", + "@typescript-eslint/no-unsafe-member-access": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/prefer-nullish-coalescing": "error", + "@typescript-eslint/prefer-optional-chain": "error", + "@typescript-eslint/unbound-method": "off", + "arrow-body-style": "error", + "curly": "error", + "eqeqeq": ["error", "always", { "null": "ignore" }], + "guard-for-in": "error", + "no-bitwise": "error", + "no-caller": "error", + "no-console": ["error", { "allow": ["warn", "error"] }], + "no-eval": "error", + "no-labels": "error", + "no-new": "error", + "no-new-wrappers": "error", + "object-shorthand": ["error", "always", { "avoidExplicitReturnArrows": true }], + "radix": "error", + "spaced-comment": ["warn", "always"] + } +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..ca61722d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,150 @@ +# This file is inspired by https://github.com/alexkaratarakis/gitattributes +# +# Auto detect text files and perform LF normalization +# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/ +* text=auto + +# The above will handle all files NOT found below +# These files are text and should be normalized (Convert crlf => lf) + +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf +*.coffee text +*.css text +*.cql text +*.df text +*.ejs text +*.html text +*.java text +*.js text +*.json text +*.less text +*.properties text +*.sass text +*.scss text +*.sh text eol=lf +*.sql text +*.txt text +*.ts text +*.xml text +*.yaml text +*.yml text + +# Documents +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.markdown text +*.md text +*.adoc text +*.textile text +*.mustache text +*.csv text +*.tab text +*.tsv text +*.txt text +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +copyright text +*COPYRIGHT* text +INSTALL text +license text +LICENSE text +NEWS text +readme text +*README* text +TODO text + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as an asset (binary) by default. If you want to treat it as text, +# comment-out the following line and uncomment the line after. +*.svg binary +#*.svg text +*.eps binary + +# These files are binary and should be left untouched +# (binary is a macro for -text -diff) +*.class binary +*.jar binary +*.war binary + +## LINTERS +.csslintrc text +.eslintrc text +.jscsrc text +.jshintrc text +.jshintignore text +.stylelintrc text + +## CONFIGS +*.conf text +*.config text +.editorconfig text +.gitattributes text +.gitconfig text +.gitignore text +.htaccess text +*.npmignore text + +## HEROKU +Procfile text +.slugignore text + +## AUDIO +*.kar binary +*.m4a binary +*.mid binary +*.midi binary +*.mp3 binary +*.ogg binary +*.ra binary + +## VIDEO +*.3gpp binary +*.3gp binary +*.as binary +*.asf binary +*.asx binary +*.fla binary +*.flv binary +*.m4v binary +*.mng binary +*.mov binary +*.mp4 binary +*.mpeg binary +*.mpg binary +*.swc binary +*.swf binary +*.webm binary + +## ARCHIVES +*.7z binary +*.gz binary +*.rar binary +*.tar binary +*.zip binary + +## FONTS +*.ttf binary +*.eot binary +*.otf binary +*.woff binary +*.woff2 binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..d543a07c --- /dev/null +++ b/.gitignore @@ -0,0 +1,151 @@ +###################### +# Node +###################### +/node/ +node_tmp/ +node_modules/ +npm-debug.log.* +/.awcache/* +/.cache-loader/* + +###################### +# SASS +###################### +.sass-cache/ + +###################### +# Eclipse +###################### +*.pydevproject +.project +.metadata +tmp/ +tmp/**/* +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath +.factorypath + +# External tool builders +.externalToolBuilders/** + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +# STS-specific +/.sts4-cache/* + +###################### +# IntelliJ +###################### +.idea/ +*.iml +*.iws +*.ipr +*.ids +*.orig +classes/ +out/ + +###################### +# Visual Studio Code +###################### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +###################### +# Maven +###################### +/log/ +/target/ + +###################### +# Gradle +###################### +.gradle/ +/build/ + +###################### +# Package Files +###################### +*.jar +*.war +*.ear +*.db + +###################### +# Windows +###################### +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + +###################### +# Mac OSX +###################### +.DS_Store +.svn + +# Thumbnails +._* + +# Files that might appear on external disk +.Spotlight-V100 +.Trashes + +###################### +# Directories +###################### +/bin/ +/deploy/ + +###################### +# Logs +###################### +*.log* + +###################### +# Others +###################### +*.class +*.*~ +*~ +.merge_file* + +###################### +# Gradle Wrapper +###################### +!gradle/wrapper/gradle-wrapper.jar + +###################### +# Maven Wrapper +###################### +!.mvn/wrapper/maven-wrapper.jar + +###################### +# ESLint +###################### +.eslintcache + +###################### +# Code coverage +###################### +/coverage/ +/.nyc_output/ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..adefefb3 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + + +"$(dirname "$0")/../npmw" exec --no-install lint-staged diff --git a/.lintstagedrc.cjs b/.lintstagedrc.cjs new file mode 100644 index 00000000..0531990f --- /dev/null +++ b/.lintstagedrc.cjs @@ -0,0 +1,3 @@ +module.exports = { + '{,**/}*.{md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,java}': ['prettier --write'], +}; diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..7c28f86e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,12 @@ +node_modules +package-lock.json +.git +build/ + +# Generated by jhipster:client +build/resources/main/static/ + +# Generated by jhipster:gradle +build +gradle +.gradle diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..003db80e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,22 @@ +# Prettier configuration + +printWidth: 140 +singleQuote: true +tabWidth: 2 +useTabs: false + +# js and ts rules: +arrowParens: avoid + +# jsx and tsx rules: +bracketSameLine: false + +plugins: + - prettier-plugin-packagejson + - prettier-plugin-java + +# java rules: +overrides: + - files: "*.java" + options: + tabWidth: 4 diff --git a/.yo-rc.json b/.yo-rc.json new file mode 100644 index 00000000..2b590cde --- /dev/null +++ b/.yo-rc.json @@ -0,0 +1,38 @@ +{ + "generator-jhipster": { + "applicationType": "monolith", + "authenticationType": "jwt", + "baseName": "artemis-benchmarking", + "buildTool": "gradle", + "cacheProvider": "hazelcast", + "clientFramework": "angular", + "clientTestFrameworks": [], + "clientTheme": "none", + "creationTimestamp": 1698053405319, + "databaseType": "sql", + "devDatabaseType": "mysql", + "devServerPort": 4200, + "enableGradleEnterprise": null, + "enableHibernateCache": false, + "enableSwaggerCodegen": true, + "enableTranslation": false, + "entities": [], + "gradleEnterpriseHost": null, + "jhipsterVersion": "8.0.0", + "jwtSecretKey": "YjQzZmE3YzMxODc2NDE1NDY1M2JlYjQxMjhjZWNiOGU1OWM1ZGFhYmY1OWU5ODI0MWMwMDYwY2ZlZDUwZWUzOWY2OGRmY2EwMDJlODY4NGFiNWNmZjhjMWUyZDRjY2IxZTIxOTBlZGI0NzRlMDJjNGNlMTcwZjE2ODRmMjUxNjc=", + "messageBroker": false, + "microfrontend": null, + "microfrontends": [], + "nativeLanguage": "en", + "packageName": "de.tum.cit.ase", + "prodDatabaseType": "mysql", + "reactive": false, + "searchEngine": false, + "serverPort": null, + "serverSideOptions": ["websocket:spring-websocket", "enableSwaggerCodegen:true"], + "serviceDiscoveryType": false, + "testFrameworks": [], + "websocket": "spring-websocket", + "withAdminUi": true + } +} diff --git a/README.md b/README.md new file mode 100644 index 00000000..e7358980 --- /dev/null +++ b/README.md @@ -0,0 +1,277 @@ +# artemis-benchmarking + +This application was generated using JHipster 8.0.0, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v8.0.0](https://www.jhipster.tech/documentation-archive/v8.0.0). + +## Project Structure + +Node is required for generation and recommended for development. `package.json` is always generated for a better development experience with prettier, commit hooks, scripts and so on. + +In the project root, JHipster generates configuration files for tools like git, prettier, eslint, husky, and others that are well known and you can find references in the web. + +`/src/*` structure follows default Java structure. + +- `.yo-rc.json` - Yeoman configuration file + JHipster configuration is stored in this file at `generator-jhipster` key. You may find `generator-jhipster-*` for specific blueprints configuration. +- `.yo-resolve` (optional) - Yeoman conflict resolver + Allows to use a specific action when conflicts are found skipping prompts for files that matches a pattern. Each line should match `[pattern] [action]` with pattern been a [Minimatch](https://github.com/isaacs/minimatch#minimatch) pattern and action been one of skip (default if ommited) or force. Lines starting with `#` are considered comments and are ignored. +- `.jhipster/*.json` - JHipster entity configuration files + +- `npmw` - wrapper to use locally installed npm. + JHipster installs Node and npm locally using the build tool by default. This wrapper makes sure npm is installed locally and uses it avoiding some differences different versions can cause. By using `./npmw` instead of the traditional `npm` you can configure a Node-less environment to develop or test your application. +- `/src/main/docker` - Docker configurations for the application and services that the application depends on + +## Development + +### Doing API-First development using openapi-generator-cli + +[OpenAPI-Generator]() is configured for this application. You can generate API code from the `src/main/resources/swagger/api.yml` definition file by running: + +```bash +./gradlew openApiGenerate +``` + +Then implements the generated delegate classes with `@Service` classes. + +To edit the `api.yml` definition file, you can use a tool such as [Swagger-Editor](). Start a local instance of the swagger-editor using docker by running: `docker compose -f src/main/docker/swagger-editor.yml up -d`. The editor will then be reachable at [http://localhost:7742](http://localhost:7742). + +Refer to [Doing API-First development][] for more details. +Before you can build this project, you must install and configure the following dependencies on your machine: + +1. [Node.js][]: We use Node to run a development web server and build the project. + Depending on your system, you can install Node either from source or as a pre-packaged bundle. + +After installing Node, you should be able to run the following command to install development tools. +You will only need to run this command when dependencies change in [package.json](package.json). + +``` +npm install +``` + +We use npm scripts and [Angular CLI][] with [Webpack][] as our build system. + +If you are using hazelcast as a cache, you will have to launch a cache server. +To start your cache server, run: + +``` +docker compose -f src/main/docker/hazelcast-management-center.yml up -d +``` + +Run the following commands in two separate terminals to create a blissful development experience where your browser +auto-refreshes when files change on your hard drive. + +``` +./gradlew -x webapp +npm start +``` + +Npm is also used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by +specifying a newer version in [package.json](package.json). You can also run `npm update` and `npm install` to manage dependencies. +Add the `help` flag on any command to see how you can use it. For example, `npm help update`. + +The `npm run` command will list all of the scripts available to run for this project. + +### PWA Support + +JHipster ships with PWA (Progressive Web App) support, and it's turned off by default. One of the main components of a PWA is a service worker. + +The service worker initialization code is disabled by default. To enable it, uncomment the following code in `src/main/webapp/app/app.module.ts`: + +```typescript +ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }), +``` + +### Managing dependencies + +For example, to add [Leaflet][] library as a runtime dependency of your application, you would run following command: + +``` +npm install --save --save-exact leaflet +``` + +To benefit from TypeScript type definitions from [DefinitelyTyped][] repository in development, you would run following command: + +``` +npm install --save-dev --save-exact @types/leaflet +``` + +Then you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them: +Edit [src/main/webapp/app/app.module.ts](src/main/webapp/app/app.module.ts) file: + +``` +import 'leaflet/dist/leaflet.js'; +``` + +Edit [src/main/webapp/content/scss/vendor.scss](src/main/webapp/content/scss/vendor.scss) file: + +``` +@import 'leaflet/dist/leaflet.css'; +``` + +Note: There are still a few other things remaining to do for Leaflet that we won't detail here. + +For further instructions on how to develop with JHipster, have a look at [Using JHipster in development][]. + +### Using Angular CLI + +You can also use [Angular CLI][] to generate some custom client code. + +For example, the following command: + +``` +ng generate component my-component +``` + +will generate few files: + +``` +create src/main/webapp/app/my-component/my-component.component.html +create src/main/webapp/app/my-component/my-component.component.ts +update src/main/webapp/app/app.module.ts +``` + +## Building for production + +### Packaging as jar + +To build the final jar and optimize the artemis-benchmarking application for production, run: + +``` +./gradlew -Pprod clean bootJar +``` + +This will concatenate and minify the client CSS and JavaScript files. It will also modify `index.html` so it references these new files. +To ensure everything worked, run: + +``` +java -jar build/libs/*.jar +``` + +Then navigate to [http://localhost:8080](http://localhost:8080) in your browser. + +Refer to [Using JHipster in production][] for more details. + +### Packaging as war + +To package your application as a war in order to deploy it to an application server, run: + +``` +./gradlew -Pprod -Pwar clean bootWar +``` + +### JHipster Control Center + +JHipster Control Center can help you manage and control your application(s). You can start a local control center server (accessible on http://localhost:7419) with: + +``` +docker compose -f src/main/docker/jhipster-control-center.yml up +``` + +## Testing + +### Spring Boot tests + +To launch your application's tests, run: + +``` +./gradlew test integrationTest jacocoTestReport +``` + +### Client tests + +Unit tests are run by [Jest][]. They're located in [src/test/javascript/](src/test/javascript/) and can be run with: + +``` +npm test +``` + +## Others + +### Code quality using Sonar + +Sonar is used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with: + +``` +docker compose -f src/main/docker/sonar.yml up -d +``` + +Note: we have turned off forced authentication redirect for UI in [src/main/docker/sonar.yml](src/main/docker/sonar.yml) for out of the box experience while trying out SonarQube, for real use cases turn it back on. + +You can run a Sonar analysis with using the [sonar-scanner](https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner) or by using the gradle plugin. + +Then, run a Sonar analysis: + +``` +./gradlew -Pprod clean check jacocoTestReport sonarqube -Dsonar.login=admin -Dsonar.password=admin +``` + +Additionally, Instead of passing `sonar.password` and `sonar.login` as CLI arguments, these parameters can be configured from [sonar-project.properties](sonar-project.properties) as shown below: + +``` +sonar.login=admin +sonar.password=admin +``` + +For more information, refer to the [Code quality page][]. + +### Using Docker to simplify development (optional) + +You can use Docker to improve your JHipster development experience. A number of docker-compose configuration are available in the [src/main/docker](src/main/docker) folder to launch required third party services. + +For example, to start a mysql database in a docker container, run: + +``` +docker compose -f src/main/docker/mysql.yml up -d +``` + +To stop it and remove the container, run: + +``` +docker compose -f src/main/docker/mysql.yml down +``` + +You can also fully dockerize your application and all the services that it depends on. +To achieve this, first build a docker image of your app by running: + +``` +npm run java:docker +``` + +Or build a arm64 docker image when using an arm64 processor os like MacOS with M1 processor family running: + +``` +npm run java:docker:arm64 +``` + +Then run: + +``` +docker compose -f src/main/docker/app.yml up -d +``` + +When running Docker Desktop on MacOS Big Sur or later, consider enabling experimental `Use the new Virtualization framework` for better processing performance ([disk access performance is worse](https://github.com/docker/roadmap/issues/7)). + +For more information refer to [Using Docker and Docker-Compose][], this page also contains information on the docker-compose sub-generator (`jhipster docker-compose`), which is able to generate docker configurations for one or several JHipster applications. + +## Continuous Integration (optional) + +To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information. + +[JHipster Homepage and latest documentation]: https://www.jhipster.tech +[JHipster 8.0.0 archive]: https://www.jhipster.tech/documentation-archive/v8.0.0 +[Using JHipster in development]: https://www.jhipster.tech/documentation-archive/v8.0.0/development/ +[Using Docker and Docker-Compose]: https://www.jhipster.tech/documentation-archive/v8.0.0/docker-compose +[Using JHipster in production]: https://www.jhipster.tech/documentation-archive/v8.0.0/production/ +[Running tests page]: https://www.jhipster.tech/documentation-archive/v8.0.0/running-tests/ +[Code quality page]: https://www.jhipster.tech/documentation-archive/v8.0.0/code-quality/ +[Setting up Continuous Integration]: https://www.jhipster.tech/documentation-archive/v8.0.0/setting-up-ci/ +[Node.js]: https://nodejs.org/ +[NPM]: https://www.npmjs.com/ +[OpenAPI-Generator]: https://openapi-generator.tech +[Swagger-Editor]: https://editor.swagger.io +[Doing API-First development]: https://www.jhipster.tech/documentation-archive/v8.0.0/doing-api-first-development/ +[Webpack]: https://webpack.github.io/ +[BrowserSync]: https://www.browsersync.io/ +[Jest]: https://facebook.github.io/jest/ +[Leaflet]: https://leafletjs.com/ +[DefinitelyTyped]: https://definitelytyped.org/ +[Angular CLI]: https://cli.angular.io/ diff --git a/angular.json b/angular.json new file mode 100644 index 00000000..99759295 --- /dev/null +++ b/angular.json @@ -0,0 +1,110 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "artemis-benchmarking": { + "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "style": "scss" + }, + "@schematics/angular:application": { + "strict": true + } + }, + "root": "", + "sourceRoot": "src/main/webapp", + "prefix": "jhi", + "architect": { + "build": { + "builder": "@angular-builders/custom-webpack:browser", + "options": { + "customWebpackConfig": { + "path": "./webpack/webpack.custom.js" + }, + "outputPath": "build/resources/main/static/", + "index": "src/main/webapp/index.html", + "main": "src/main/webapp/main.ts", + "polyfills": ["./src/main/webapp/sockjs-client.polyfill", "zone.js"], + "tsConfig": "tsconfig.app.json", + "inlineStyleLanguage": "scss", + "assets": [ + "src/main/webapp/content", + "src/main/webapp/favicon.ico", + "src/main/webapp/manifest.webapp", + "src/main/webapp/robots.txt" + ], + "styles": ["src/main/webapp/content/scss/vendor.scss", "src/main/webapp/content/scss/global.scss"], + "scripts": [] + }, + "configurations": { + "production": { + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "serviceWorker": true, + "ngswConfigPath": "ngsw-config.json", + "budgets": [ + { + "type": "initial", + "maximumWarning": "500kb", + "maximumError": "1mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "2kb", + "maximumError": "4kb" + } + ] + }, + "development": { + "buildOptimizer": false, + "optimization": false, + "vendorChunk": true, + "extractLicenses": false, + "sourceMap": true, + "namedChunks": true + } + }, + "defaultConfiguration": "production" + }, + "serve": { + "builder": "@angular-builders/custom-webpack:dev-server", + "options": { + "browserTarget": "artemis-benchmarking:build:development", + "port": 4200 + }, + "configurations": { + "production": { + "browserTarget": "artemis-benchmarking:build:production" + }, + "development": { + "browserTarget": "artemis-benchmarking:build:development" + } + }, + "defaultConfiguration": "development" + }, + "test": { + "builder": "@angular-builders/jest:run", + "options": { + "configPath": "jest.conf.js", + "tsConfig": "tsconfig.spec.json" + } + } + } + } + }, + "cli": { + "cache": { + "enabled": true, + "path": "./build/angular/", + "environment": "all" + }, + "packageManager": "npm" + } +} diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..19253437 --- /dev/null +++ b/build.gradle @@ -0,0 +1,293 @@ +plugins { + id "java" + id "maven-publish" + id "idea" + id "eclipse" + id "jacoco" + id "org.springframework.boot" + id "com.google.cloud.tools.jib" + id "com.gorylenko.gradle-git-properties" + id "org.openapi.generator" + id "com.github.node-gradle.node" + id "org.sonarqube" + id "com.diffplug.spotless" + id "io.spring.nohttp" + id "com.github.andygoossens.gradle-modernizer-plugin" + id "org.liquibase.gradle" + // jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here +} + +group = "de.tum.cit.ase" +version = "0.0.1-SNAPSHOT" + +description = "" + +sourceCompatibility=17 +targetCompatibility=17 +assert System.properties["java.specification.version"] == "17" || "18" || "19" || "20" || "21" + +ext { + springProfiles = "" + if (project.hasProperty("tls")) { + springProfiles += ",tls" + } + if (project.hasProperty("e2e")) { + springProfiles += ",e2e" + } +} + +apply from: "gradle/docker.gradle" +apply from: "gradle/sonar.gradle" + +spotless { + java { + target 'src/*/java/**/*.java' + // removeUnusedImports() + } +} + +apply from: "gradle/swagger.gradle" +apply from: "gradle/cache.gradle" +apply from: "gradle/liquibase.gradle" +// jhipster-needle-gradle-apply-from - JHipster will add additional gradle scripts to be applied here + +if (project.hasProperty("prod") || project.hasProperty("gae")) { + apply from: "gradle/profile_prod.gradle" +} else { + apply from: "gradle/profile_dev.gradle" +} + +if (project.hasProperty("war")) { + apply from: "gradle/war.gradle" +} + +if (project.hasProperty("gae")) { + apply plugin: 'maven' + apply plugin: 'org.springframework.boot.experimental.thin-launcher' + apply plugin: 'io.spring.dependency-management' + + dependencyManagement { + imports { + mavenBom "tech.jhipster:jhipster-dependencies:${jhipsterDependenciesVersion}" + } + } + appengineStage.dependsOn thinResolve +} + + +idea { + module { + excludeDirs += files("node_modules") + } +} + +eclipse { + sourceSets { + main { + java { + srcDirs += ["build/generated/sources/annotationProcessor/java/main"] + } + } + } +} + +defaultTasks "bootRun" + +springBoot { + mainClass = "de.tum.cit.ase.ArtemisBenchmarkingApp" +} + +test { + useJUnitPlatform() + exclude "**/*IT*", "**/*IntTest*" + testLogging { + events 'FAILED', 'SKIPPED' + } + jvmArgs += '-Djava.security.egd=file:/dev/./urandom -Xmx512m' + // uncomment if the tests reports are not generated + // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484 + // ignoreFailures true + reports.html.required = false +} + +modernizer { + failOnViolations = true + includeTestClasses = true +} + + + +check.dependsOn integrationTest +task testReport(type: TestReport) { + destinationDirectory = file("$buildDir/reports/tests") + testResults.from(test) +} + +task integrationTestReport(type: TestReport) { + destinationDirectory = file("$buildDir/reports/tests") + testResults.from(integrationTest) +} + +gitProperties { + failOnNoGitDirectory = false + keys = ["git.branch", "git.commit.id.abbrev", "git.commit.id.describe"] +} + +tasks.withType(com.gorylenko.GenerateGitPropertiesTask).configureEach { + outputs.doNotCacheIf("Task is always executed") { true } +} + +checkstyle { + toolVersion "${checkstyleVersion}" + configFile file("checkstyle.xml") + checkstyleTest.enabled = false +} +nohttp { + source.include "build.gradle", "README.md" +} + +configurations { + providedRuntime + implementation.exclude module: "spring-boot-starter-tomcat" +} + +repositories { + // Local maven repository is required for libraries built locally with maven like development jhipster-bom. + // mavenLocal() + mavenCentral() + // jhipster-needle-gradle-repositories - JHipster will add additional repositories +} + +dependencies { + // import JHipster dependencies BOM + if (!project.hasProperty("gae")) { + implementation platform("tech.jhipster:jhipster-dependencies:${jhipsterDependenciesVersion}") + } + + // Use ", version: jhipsterDependenciesVersion, changing: true" if you want + // to use a SNAPSHOT release instead of a stable release + implementation "tech.jhipster:jhipster-framework" + implementation "jakarta.annotation:jakarta.annotation-api" + implementation "com.fasterxml.jackson.module:jackson-module-jaxb-annotations" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-hibernate6" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-hppc" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" + testImplementation "org.testcontainers:junit-jupiter" + testImplementation "org.testcontainers:testcontainers" + implementation "org.springdoc:springdoc-openapi-starter-webmvc-api" + implementation "com.zaxxer:HikariCP" + implementation "org.apache.commons:commons-lang3" + implementation "org.openapitools:jackson-databind-nullable:${jacksonDatabindNullableVersion}" + // Openapi generator uses javax namespace for now https://github.com/OpenAPITools/openapi-generator/pull/13593 + implementation "javax.annotation:javax.annotation-api:1.3.2" + implementation "javax.validation:validation-api:2.0.1.Final" + annotationProcessor "org.hibernate.orm:hibernate-jpamodelgen:${hibernateVersion}" + implementation "org.hibernate.orm:hibernate-core" + implementation "org.hibernate.validator:hibernate-validator" + implementation "org.mapstruct:mapstruct:${mapstructVersion}" + annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}" + annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}" + implementation "org.springframework.boot:spring-boot-loader-tools" + implementation "org.springframework.boot:spring-boot-starter-actuator" + implementation "org.springframework.boot:spring-boot-starter-data-jpa" + testImplementation "org.testcontainers:jdbc" + implementation "org.springframework.boot:spring-boot-starter-logging" + implementation "org.springframework.boot:spring-boot-starter-mail" + implementation "org.springframework.boot:spring-boot-starter-security" + implementation "org.springframework.boot:spring-boot-starter-thymeleaf" + implementation "org.springframework.boot:spring-boot-starter-web" + testImplementation "org.springframework.boot:spring-boot-starter-test" + testImplementation "org.springframework.boot:spring-boot-test" + testImplementation "org.springframework.security:spring-security-test" + testImplementation("com.tngtech.archunit:archunit-junit5-api:${archunitJunit5Version}") { + exclude group: "org.slf4j", module: "slf4j-api" + } + testRuntimeOnly("com.tngtech.archunit:archunit-junit5-engine:${archunitJunit5Version}") { + exclude group: "org.slf4j", module: "slf4j-api" + } + implementation "org.springframework.boot:spring-boot-starter-undertow" + implementation "org.springframework.boot:spring-boot-starter-websocket" + implementation "org.springframework.boot:spring-boot-starter-oauth2-resource-server" + implementation "org.springframework.security:spring-security-data" + implementation "io.micrometer:micrometer-registry-prometheus" + implementation "io.dropwizard.metrics:metrics-core" + implementation "org.springframework.security:spring-security-messaging" + // jhipster-needle-gradle-dependency - JHipster will add additional dependencies here +} + +if (project.hasProperty("gae")) { + task createPom { + def basePath = 'build/resources/main/META-INF/maven' + doLast { + pom { + withXml(dependencyManagement.pomConfigurer) + }.writeTo("${basePath}/${project.group}/${project.name}/pom.xml") + } + } + bootJar.dependsOn = [createPom] +} + +task cleanResources(type: Delete) { + delete "build/resources" +} + +wrapper { + gradleVersion = "8.4" +} + +task webapp_test(type: NpmTask) { + inputs.property('appVersion', project.version) + inputs.files("package-lock.json") + .withPropertyName('package-lock') + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.files("build.gradle") + .withPropertyName('build.gradle') + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.files("angular.json") + .withPropertyName('angular.json') + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.files("tsconfig.json", "tsconfig.app.json") + .withPropertyName("tsconfig") + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.dir("webpack/") + .withPropertyName("webpack/") + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.dir("src/main/webapp/") + .withPropertyName("webapp-source-dir") + .withPathSensitivity(PathSensitivity.RELATIVE) + + outputs.dir("build/test-results/jest/") + .withPropertyName("jest-result-dir") + outputs.file("build/test-results/TESTS-results-jest.xml") + .withPropertyName("jest-result") + outputs.file("build/test-results/clover.xml") + .withPropertyName("clover-result") + + dependsOn npmInstall,compileTestJava + args = ["run", "webapp:test"] +} + +if (project.hasProperty("nodeInstall")) { + node { + version = "18.18.2" + npmVersion = "10.2.2" + download = true + } + + // Copy local node and npm to a fixed location for npmw + def fixedNode = tasks.register("fixedNode", Copy) { + from nodeSetup + into 'build/node' + } + tasks.named("nodeSetup").configure { finalizedBy fixedNode } + + def fixedNpm = tasks.register("fixedNpm", Copy) { + from npmSetup + into 'build/node' + } + tasks.named("npmSetup").configure { finalizedBy fixedNpm } +} + +test.dependsOn webapp_test +compileJava.dependsOn processResources +processResources.dependsOn bootBuildInfo diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 00000000..4c6a0410 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..feed280c --- /dev/null +++ b/gradle.properties @@ -0,0 +1,69 @@ +rootProject.name=artemis-benchmarking +profile=dev + +# Dependency versions +jhipsterDependenciesVersion=8.0.0 +# The spring-boot version should match the one managed by +# https://mvnrepository.com/artifact/tech.jhipster/jhipster-dependencies/8.0.0 +springBootVersion=3.1.5 +# The hibernate version should match the one managed by +# https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/3.1.5 --> +hibernateVersion=6.2.13.Final +mapstructVersion=1.5.5.Final +archunitJunit5Version=1.1.0 +jacksonDatabindNullableVersion=0.2.6 +hazelcastSpringVersion=5.3.5 + + + +jaxbRuntimeVersion=4.0.4 + +# gradle plugin version +jibPluginVersion=3.4.0 +gitPropertiesPluginVersion=2.4.1 +gradleNodePluginVersion=7.0.1 +sonarqubePluginVersion=4.4.1.3373 +spotlessPluginVersion=6.22.0 +openapiPluginVersion=7.0.1 +noHttpCheckstyleVersion=0.0.11 +checkstyleVersion=10.12.4 +modernizerPluginVersion=1.9.0 + +liquibaseTaskPrefix=liquibase +liquibasePluginVersion=2.2.0 +liquibaseVersion=4.24.0 +liquibaseHibernate6Version=4.24.0 +# jhipster-needle-gradle-property - JHipster will add additional properties here + +## below are some of the gradle performance improvement settings that can be used as required, these are not enabled by default + +## The Gradle daemon aims to improve the startup and execution time of Gradle. +## The daemon is enabled by default in Gradle 3+ setting this to false will disable this. +## https://docs.gradle.org/current/userguide/gradle_daemon.html#sec:ways_to_disable_gradle_daemon +## uncomment the below line to disable the daemon + +#org.gradle.daemon=false + +## Specifies the JVM arguments used for the daemon process. +## The setting is particularly useful for tweaking memory settings. +## Default value: -Xmx1024m -XX:MaxPermSize=256m +## uncomment the below line to override the daemon defaults + +#org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +## When configured, Gradle will run in incubating parallel mode. +## This option should only be used with decoupled projects. More details, visit +## http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +## uncomment the below line to enable parallel mode + +#org.gradle.parallel=true + +## Enables new incubating mode that makes Gradle selective when configuring projects. +## Only relevant projects are configured which results in faster builds for large multi-projects. +## http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand +## uncomment the below line to enable the selective mode + +#org.gradle.configureondemand=true + +## Install and use a local version of node and npm. +nodeInstall diff --git a/gradle/cache.gradle b/gradle/cache.gradle new file mode 100644 index 00000000..4fd0f3f6 --- /dev/null +++ b/gradle/cache.gradle @@ -0,0 +1,5 @@ +dependencies { + implementation "org.springframework.boot:spring-boot-starter-cache" + implementation "javax.cache:cache-api" + implementation "com.hazelcast:hazelcast-spring:${hazelcastSpringVersion}" +} diff --git a/gradle/docker.gradle b/gradle/docker.gradle new file mode 100644 index 00000000..81aae868 --- /dev/null +++ b/gradle/docker.gradle @@ -0,0 +1,29 @@ +jib { + from { + image = "eclipse-temurin:17-jre-focal" + platforms { + platform { + architecture = "${findProperty('jibArchitecture') ?: 'amd64'}" + os = "linux" + } + } + } + to { + image = "artemis-benchmarking:latest" + } + container { + entrypoint = ["bash", "-c", "/entrypoint.sh"] + ports = ["8080", "5701/udp" ] + environment = [ + SPRING_OUTPUT_ANSI_ENABLED: "ALWAYS", + JHIPSTER_SLEEP: "0" + ] + creationTime = "USE_CURRENT_TIMESTAMP" + user = 1000 + } + extraDirectories { + paths = file("src/main/docker/jib") + permissions = ["/entrypoint.sh": "755"] + } +} + diff --git a/gradle/liquibase.gradle b/gradle/liquibase.gradle new file mode 100644 index 00000000..c28a67dc --- /dev/null +++ b/gradle/liquibase.gradle @@ -0,0 +1,61 @@ +configurations { + liquibaseRuntime.extendsFrom sourceSets.main.compileClasspath +} + +dependencies { + implementation "org.liquibase:liquibase-core" + liquibaseRuntime "org.liquibase:liquibase-core" + // Dependency required to parse options. Refer to https://github.com/liquibase/liquibase-gradle-plugin/tree/Release_2.2.0#news. + liquibaseRuntime "info.picocli:picocli:4.7.5" + + liquibaseRuntime "org.liquibase.ext:liquibase-hibernate6:${liquibaseHibernate6Version}" + liquibaseRuntime "com.mysql:mysql-connector-j" +} + +project.ext.diffChangelogFile = "src/main/resources/config/liquibase/changelog/" + new Date().format("yyyyMMddHHmmss") + "_changelog.xml" +if (!project.hasProperty("runList")) { + project.ext.runList = "main" +} + +liquibase { + activities { + main { + driver "com.mysql.cj.jdbc.Driver" + url "jdbc:mysql://localhost:3306/artemis-benchmarking" + username "root" + changelogFile "src/main/resources/config/liquibase/master.xml" + logLevel "debug" + classpath "src/main/resources/" + } + diffLog { + driver "com.mysql.cj.jdbc.Driver" + url "jdbc:mysql://localhost:3306/artemis-benchmarking" + username "root" + changelogFile project.ext.diffChangelogFile + referenceUrl "hibernate:spring:de.tum.cit.ase.domain?dialect=org.hibernate.dialect.MySQL8Dialect&hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy" + logLevel "debug" + classpath "$buildDir/classes/java/main" + } + } + + runList = project.ext.runList +} + +liquibaseDiff.dependsOn compileJava +liquibaseDiffChangelog.dependsOn compileJava + +configurations { + all { + resolutionStrategy { + // Inherited version from Spring Boot can't be used because of regressions: + // To be removed as soon as spring-boot use the same version + force 'org.liquibase:liquibase-core:4.24.0' + } + } +} + +ext { + if (project.hasProperty("no-liquibase")) { + springProfiles += ",no-liquibase" + } +} diff --git a/gradle/profile_dev.gradle b/gradle/profile_dev.gradle new file mode 100644 index 00000000..0a409365 --- /dev/null +++ b/gradle/profile_dev.gradle @@ -0,0 +1,92 @@ + +configurations { + all { + resolutionStrategy { + // TODO drop forced version. Refer to https://github.com/jhipster/generator-jhipster/issues/22579 + force "org.hibernate.orm:hibernate-core:${hibernateVersion}" + } + } +} + +dependencies { + developmentOnly "org.springframework.boot:spring-boot-devtools:${springBootVersion}" + implementation "com.mysql:mysql-connector-j" + testImplementation "org.testcontainers:mysql" +} + +ext { + springProfiles = "dev" + springProfiles +} + +springBoot { + buildInfo { + excludes = ['time'] + } +} + +bootRun { + args = ["--spring.profiles.active=${springProfiles}"] +} + +task webapp(type: NpmTask) { + inputs.property('appVersion', project.version) + inputs.files("package-lock.json") + .withPropertyName('package-lock') + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.files("build.gradle") + .withPropertyName('build.gradle') + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.files("angular.json") + .withPropertyName('angular.json') + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.files("tsconfig.json", "tsconfig.app.json") + .withPropertyName("tsconfig") + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.dir("webpack/") + .withPropertyName("webpack/") + .withPathSensitivity(PathSensitivity.RELATIVE) + inputs.dir("src/main/webapp/") + .withPropertyName("webapp-source-dir") + .withPathSensitivity(PathSensitivity.RELATIVE) + outputs.dir("build/resources/main/static/") + .withPropertyName("webapp-build-dir") + + dependsOn npmInstall + + args = ["run", "webapp:build"] + environment = [APP_VERSION: project.version] +} + +processResources { + inputs.property('version', version) + inputs.property('springProfiles', springProfiles) + filesMatching("**/application.yml") { + filter { + it.replace("#project.version#", version) + } + filter { + it.replace("#spring.profiles.active#", springProfiles) + } + } +} + +task integrationTest(type: Test) { + maxHeapSize = "1G" + useJUnitPlatform() + description = "Execute integration tests." + group = "verification" + include "**/*IT*", "**/*IntTest*" + testLogging { + events 'FAILED', 'SKIPPED' + } + systemProperty('spring.profiles.active', 'testdev') + systemProperty('java.security.egd', 'file:/dev/./urandom') + // uncomment if the tests reports are not generated + // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484 + // ignoreFailures true + reports.html.required = false +} +integrationTest.dependsOn test + +processResources.dependsOn webapp +bootJar.dependsOn processResources diff --git a/gradle/profile_prod.gradle b/gradle/profile_prod.gradle new file mode 100644 index 00000000..bb9a2c37 --- /dev/null +++ b/gradle/profile_prod.gradle @@ -0,0 +1,71 @@ + +configurations { + all { + resolutionStrategy { + // TODO drop forced version. Refer to https://github.com/jhipster/generator-jhipster/issues/22579 + force "org.hibernate.orm:hibernate-core:${hibernateVersion}" + } + } +} + +dependencies { + implementation "com.mysql:mysql-connector-j" + testImplementation "org.testcontainers:mysql" +} + +ext { + springProfiles = "prod" + springProfiles + + if (project.hasProperty("api-docs")) { + springProfiles += ",api-docs" + } +} + +springBoot { + buildInfo() +} + +bootRun { + args = ["--spring.profiles.active=${springProfiles}"] +} + +task webapp(type: NpmTask) { + dependsOn npmInstall + args = ["run", "webapp:prod"] + environment = [APP_VERSION: project.version] +} + +processResources { + inputs.property('version', version) + inputs.property('springProfiles', springProfiles) + filesMatching("**/application.yml") { + filter { + it.replace("#project.version#", version) + } + filter { + it.replace("#spring.profiles.active#", springProfiles) + } + } +} + +task integrationTest(type: Test) { + maxHeapSize = "1G" + useJUnitPlatform() + description = "Execute integration tests." + group = "verification" + include "**/*IT*", "**/*IntTest*" + testLogging { + events 'FAILED', 'SKIPPED' + } + systemProperty('spring.profiles.active', 'testprod') + systemProperty('java.security.egd', 'file:/dev/./urandom') + // uncomment if the tests reports are not generated + // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484 + // ignoreFailures true + reports.html.required = false +} +integrationTest.dependsOn test + + +processResources.dependsOn webapp +bootJar.dependsOn processResources diff --git a/gradle/sonar.gradle b/gradle/sonar.gradle new file mode 100644 index 00000000..948eee38 --- /dev/null +++ b/gradle/sonar.gradle @@ -0,0 +1,26 @@ +jacoco { + toolVersion = "0.8.11" +} + +jacocoTestReport { + executionData tasks.withType(Test) + classDirectories.from = files(sourceSets.main.output.classesDirs) + sourceDirectories.from = files(sourceSets.main.java.srcDirs) + + reports { + xml.required = true + } +} + +file("sonar-project.properties").withReader { + Properties sonarProperties = new Properties() + sonarProperties.load(it) + + sonarProperties.each { key, value -> + sonarqube { + properties { + property key, value + } + } + } +} diff --git a/gradle/swagger.gradle b/gradle/swagger.gradle new file mode 100644 index 00000000..2f2a7c8f --- /dev/null +++ b/gradle/swagger.gradle @@ -0,0 +1,29 @@ +/* + * Plugin that provides API-first development using OpenAPI-generator to + * generate Spring-MVC endpoint stubs at compile time from an OpenAPI definition file + */ +apply plugin: "org.openapi.generator" + +openApiGenerate { + generatorName = "spring" + inputSpec = "$rootDir/src/main/resources/swagger/api.yml".toString() + outputDir = "$buildDir/openapi".toString() + apiPackage = "de.tum.cit.ase.web.api" + modelPackage = "de.tum.cit.ase.service.api.dto" + apiFilesConstrainedTo = [""] + modelFilesConstrainedTo = [""] + supportingFilesConstrainedTo = ["ApiUtil.java"] + configOptions = [delegatePattern: "true", title: "artemis-benchmarking", useSpringBoot3: "true"] + validateSpec = true + importMappings = [Problem:"org.springframework.http.ProblemDetail"] +} + +sourceSets { + main { + java { + srcDir file("${project.buildDir.path}/openapi/src/main/java") + } + } +} + +compileJava.dependsOn("openApiGenerate") diff --git a/gradle/war.gradle b/gradle/war.gradle new file mode 100644 index 00000000..28c0706e --- /dev/null +++ b/gradle/war.gradle @@ -0,0 +1,16 @@ +apply plugin: "war" + +bootWar { + mainClass = "de.tum.cit.ase.ArtemisBenchmarkingApp" + includes = ["WEB-INF/**", "META-INF/**"] + webXml = file("${project.rootDir}/src/main/webapp/WEB-INF/web.xml") +} + +war { + webAppDirName = "build/resources/main/static/" + webXml = file("${project.rootDir}/src/main/webapp/WEB-INF/web.xml") + enabled = true + archiveExtension = "war.original" + includes = ["WEB-INF/**", "META-INF/**"] + +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..c1962a79e29d3e0ab67b14947c167a862655af9b GIT binary patch literal 62076 zcmb5VV{~QRw)Y#`wrv{~+qP{x72B%VwzFc}c2cp;N~)5ZbDrJayPv(!dGEd-##*zr z)#n-$y^sH|_dchh3@8{H5D*j;5D<{i*8l5IFJ|DjL!e)upfGNX(kojugZ3I`oH1PvW`wFW_ske0j@lB9bX zO;2)`y+|!@X(fZ1<2n!Qx*)_^Ai@Cv-dF&(vnudG?0CsddG_&Wtae(n|K59ew)6St z#dj7_(Cfwzh$H$5M!$UDd8=4>IQsD3xV=lXUq($;(h*$0^yd+b{qq63f0r_de#!o_ zXDngc>zy`uor)4A^2M#U*DC~i+dc<)Tb1Tv&~Ev@oM)5iJ4Sn#8iRw16XXuV50BS7 zdBL5Mefch(&^{luE{*5qtCZk$oFr3RH=H!c3wGR=HJ(yKc_re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yz7*Kx3~X> z|BZX}Y;oVB1HX@l9_-y7dI*WgruY@?rC&64`}3W`ECA>O@Y#Q@JS<4WBF(QbwJqHM zt)fE#6jTSyZ^E8y0INaIf!omWjvS=@15`O%V2CKg+}z=M9##kLKRN0uJuK250bXVU zwzT&n@30^dzKnlL^us;wClg?CKWEtiEb#zhPVx{PxFQiwEPp^C53zN21EdZAz?3D& zC6fK|_!S5Mq&0z;xWGLEv}!zjfpRg_orp7|fXMx=uP!@X`yT@5(N_Hza}p5fBk&|)J7fZ`NQ9Nz@5xT? zi?iV$q+bG!2LZUpF)>Yl!u;DEHV3!i{ipcJm_8Gj@Dac%N3|SQVGqRhrJ;WOR|CtrwzPTW^&$A6!A$E)h7xohm>hA8p{PUZ~ z_&zeg@OL3PxPtzkfsNZAqXCZ8Is7yQ+plm~8;}|~DEkv&f@?q5hB*OGQYXuwVQOp0 z?QQ`6qyp|-$47wjuV74IE_x2I17$+grwMBE^25d<5!lYhnszuh|5Yk;RB+Uk*hk=m zu73=E^7ul{40{A^?Rg^fq0ZfZO@C1HupR*_d;J>lkFv6&x&}4N;t}1T@2}~AC^<3b zA}RxFPPZe5R{_6dIN9N-GT29Oa}RzA2ekKuEVZbuMOB?Xf**`N5&m}?)TjigdY(rF z?~+a=`0);TlDa1j)1G`AfW? zRl883QPq=w zbB|bHEx%_u*$t@Yl#Vc;y*?2W^|^NJ)DmioQFr~1&>MSBL_b(YIpGWdDm3bT=Mgm1 e+h0K+-~H6qzyuy}`;+tYAZFmzUSVSYum1yJqxCBQ literal 0 HcmV?d00001 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..e411586a --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradle/zipkin.gradle b/gradle/zipkin.gradle new file mode 100644 index 00000000..666cca36 --- /dev/null +++ b/gradle/zipkin.gradle @@ -0,0 +1,4 @@ +dependencies { + implementation "io.micrometer:micrometer-tracing-bridge-brave" + implementation "io.zipkin.reporter2:zipkin-reporter-brave" +} diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..aeb74cbb --- /dev/null +++ b/gradlew @@ -0,0 +1,245 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..93e3f59f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jest.conf.js b/jest.conf.js new file mode 100644 index 00000000..a2a4d5a1 --- /dev/null +++ b/jest.conf.js @@ -0,0 +1,29 @@ +const { pathsToModuleNameMapper } = require('ts-jest'); + +const { + compilerOptions: { paths = {}, baseUrl = './' }, +} = require('./tsconfig.json'); +const environment = require('./webpack/environment'); + +module.exports = { + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|dayjs/esm)'], + resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js', + globals: { + ...environment, + }, + roots: ['', `/${baseUrl}`], + modulePaths: [`/${baseUrl}`], + setupFiles: ['jest-date-mock'], + cacheDirectory: '/build/jest-cache', + coverageDirectory: '/build/test-results/', + moduleNameMapper: pathsToModuleNameMapper(paths, { prefix: `/${baseUrl}/` }), + reporters: [ + 'default', + ['jest-junit', { outputDirectory: '/build/test-results/', outputName: 'TESTS-results-jest.xml' }], + ['jest-sonar', { outputDirectory: './build/test-results/jest', outputName: 'TESTS-results-sonar.xml' }], + ], + testMatch: ['/src/main/webapp/app/**/@(*.)@(spec.ts)'], + testEnvironmentOptions: { + url: 'https://jhipster.tech', + }, +}; diff --git a/ngsw-config.json b/ngsw-config.json new file mode 100644 index 00000000..8d576028 --- /dev/null +++ b/ngsw-config.json @@ -0,0 +1,21 @@ +{ + "$schema": "./node_modules/@angular/service-worker/config/schema.json", + "index": "/index.html", + "assetGroups": [ + { + "name": "app", + "installMode": "prefetch", + "resources": { + "files": ["/favicon.ico", "/index.html", "/manifest.webapp", "/*.css", "/*.js"] + } + }, + { + "name": "assets", + "installMode": "lazy", + "updateMode": "prefetch", + "resources": { + "files": ["/content/**", "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"] + } + } + ] +} diff --git a/npmw b/npmw new file mode 100755 index 00000000..12a91e52 --- /dev/null +++ b/npmw @@ -0,0 +1,42 @@ +#!/bin/sh + +basedir=`dirname "$0"` + +if [ -f "$basedir/mvnw" ]; then + bindir="$basedir/target/node" + repodir="$basedir/target/node/node_modules" + installCommand="$basedir/mvnw -Pwebapp frontend:install-node-and-npm@install-node-and-npm" + + PATH="$basedir/$builddir/:$PATH" + NPM_EXE="$basedir/$builddir/node_modules/npm/bin/npm-cli.js" + NODE_EXE="$basedir/$builddir/node" +elif [ -f "$basedir/gradlew" ]; then + bindir="$basedir/build/node/bin" + repodir="$basedir/build/node/lib/node_modules" + installCommand="$basedir/gradlew npmSetup" +else + echo "Using npm installed globally" + exec npm "$@" +fi + +NPM_EXE="$repodir/npm/bin/npm-cli.js" +NODE_EXE="$bindir/node" + +if [ ! -x "$NPM_EXE" ] || [ ! -x "$NODE_EXE" ]; then + $installCommand || true +fi + +if [ -x "$NODE_EXE" ]; then + echo "Using node installed locally $($NODE_EXE --version)" + PATH="$bindir:$PATH" +else + NODE_EXE='node' +fi + +if [ ! -x "$NPM_EXE" ]; then + echo "Local npm not found, using npm installed globally" + npm "$@" +else + echo "Using npm installed locally $($NODE_EXE $NPM_EXE --version)" + $NODE_EXE $NPM_EXE "$@" +fi diff --git a/npmw.cmd b/npmw.cmd new file mode 100644 index 00000000..b6e79809 --- /dev/null +++ b/npmw.cmd @@ -0,0 +1,31 @@ +@echo off + +setlocal + +set NPMW_DIR=%~dp0 + +if exist "%NPMW_DIR%mvnw.cmd" ( + set NODE_EXE=^"^" + set NODE_PATH=%NPMW_DIR%target\node\ + set NPM_EXE=^"%NPMW_DIR%target\node\npm.cmd^" + set INSTALL_NPM_COMMAND=^"%NPMW_DIR%mvnw.cmd^" -Pwebapp frontend:install-node-and-npm@install-node-and-npm +) else ( + set NODE_EXE=^"%NPMW_DIR%build\node\bin\node.exe^" + set NODE_PATH=%NPMW_DIR%build\node\bin\ + set NPM_EXE=^"%NPMW_DIR%build\node\lib\node_modules\npm\bin\npm-cli.js^" + set INSTALL_NPM_COMMAND=^"%NPMW_DIR%gradlew.bat^" npmSetup +) + +if not exist %NPM_EXE% ( + call %INSTALL_NPM_COMMAND% +) + +if exist %NODE_EXE% ( + Rem execute local npm with local node, whilst adding local node location to the PATH for this CMD session + endlocal & echo "%PATH%"|find /i "%NODE_PATH%;">nul || set "PATH=%NODE_PATH%;%PATH%" & call %NODE_EXE% %NPM_EXE% %* +) else if exist %NPM_EXE% ( + Rem execute local npm, whilst adding local npm location to the PATH for this CMD session + endlocal & echo "%PATH%"|find /i "%NODE_PATH%;">nul || set "PATH=%NODE_PATH%;%PATH%" & call %NPM_EXE% %* +) else ( + call npm %* +) diff --git a/package.json b/package.json new file mode 100644 index 00000000..9c3d1dfe --- /dev/null +++ b/package.json @@ -0,0 +1,145 @@ +{ + "name": "artemis-benchmarking", + "version": "0.0.1-SNAPSHOT", + "private": true, + "description": "Description for Artemis Benchmarking", + "license": "UNLICENSED", + "scripts": { + "app:start": "./gradlew", + "app:up": "docker compose -f src/main/docker/app.yml up --wait", + "backend:build-cache": "npm run backend:info && npm run backend:nohttp:test && npm run ci:e2e:package", + "backend:doc:test": "./gradlew javadoc -x webapp -x webapp_test", + "backend:info": "./gradlew -v", + "backend:nohttp:test": "./gradlew checkstyleNohttp -x webapp -x webapp_test", + "backend:start": "./gradlew -x webapp -x webapp_test", + "backend:unit:test": "./gradlew test integrationTest -x webapp -x webapp_test -Dlogging.level.ROOT=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.de.tum.cit.ase=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF", + "build": "npm run webapp:prod --", + "build-watch": "concurrently 'npm run webapp:build:dev -- --watch' npm:backend:start", + "ci:backend:test": "npm run backend:info && npm run backend:doc:test && npm run backend:nohttp:test && npm run backend:unit:test -- -P$npm_package_config_default_environment", + "ci:e2e:package": "npm run java:$npm_package_config_packaging:$npm_package_config_default_environment -- -Pe2e -Denforcer.skip=true", + "postci:e2e:package": "cp build/libs/*.$npm_package_config_packaging e2e.$npm_package_config_packaging", + "ci:e2e:prepare": "npm run ci:e2e:prepare:docker", + "ci:e2e:prepare:docker": "npm run services:up --if-present && docker ps -a", + "preci:e2e:server:start": "npm run services:db:await --if-present && npm run services:others:await --if-present", + "ci:e2e:server:start": "java -jar e2e.$npm_package_config_packaging --spring.profiles.active=e2e,$npm_package_config_default_environment -Dlogging.level.ROOT=OFF -Dlogging.level.tech.jhipster=OFF -Dlogging.level.de.tum.cit.ase=OFF -Dlogging.level.org.springframework=OFF -Dlogging.level.org.springframework.web=OFF -Dlogging.level.org.springframework.security=OFF --logging.level.org.springframework.web=ERROR", + "ci:e2e:teardown": "npm run ci:e2e:teardown:docker --if-present", + "ci:e2e:teardown:docker": "docker compose -f src/main/docker/services.yml down -v && docker ps -a", + "ci:frontend:build": "npm run webapp:build:$npm_package_config_default_environment", + "ci:frontend:test": "npm run ci:frontend:build && npm test", + "clean-www": "rimraf build/resources/main/static/", + "cleanup": "rimraf build/", + "docker:db:down": "docker compose -f src/main/docker/mysql.yml down -v", + "docker:db:up": "docker compose -f src/main/docker/mysql.yml up --wait", + "java:docker": "./gradlew bootJar -Pprod jibDockerBuild", + "java:docker:arm64": "npm run java:docker -- -PjibArchitecture=arm64", + "java:docker:dev": "npm run java:docker -- -Pdev,webapp", + "java:docker:prod": "npm run java:docker -- -Pprod", + "java:jar": "./gradlew bootJar -x test -x integrationTest", + "java:jar:dev": "npm run java:jar -- -Pdev,webapp", + "java:jar:prod": "npm run java:jar -- -Pprod", + "java:war": "./gradlew bootWar -Pwar -x test -x integrationTest", + "java:war:dev": "npm run java:war -- -Pdev,webapp", + "java:war:prod": "npm run java:war -- -Pprod", + "jest": "jest --coverage --logHeapUsage --maxWorkers=2 --config jest.conf.js", + "lint": "eslint . --ext .js,.ts", + "lint:fix": "npm run lint -- --fix", + "prepare": "husky install", + "prettier:check": "prettier --check \"{,src/**/,webpack/,.blueprint/**/}*.{md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,java}\"", + "prettier:format": "prettier --write \"{,src/**/,webpack/,.blueprint/**/}*.{md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,java}\"", + "serve": "npm run start --", + "services:up": "docker compose -f src/main/docker/services.yml up --wait", + "start": "ng serve --hmr", + "start-tls": "npm run webapp:dev-ssl", + "pretest": "npm run lint", + "test": "ng test --coverage --log-heap-usage -w=2", + "test:watch": "npm run test -- --watch", + "watch": "concurrently npm:start npm:backend:start", + "webapp:build": "npm run clean-www && npm run webapp:build:dev", + "webapp:build:dev": "ng build --configuration development", + "webapp:build:prod": "ng build --configuration production", + "webapp:dev": "ng serve", + "webapp:dev-ssl": "ng serve --ssl", + "webapp:dev-verbose": "ng serve --verbose", + "webapp:prod": "npm run clean-www && npm run webapp:build:prod", + "webapp:test": "npm run test --" + }, + "config": { + "backend_port": 8080, + "default_environment": "prod", + "packaging": "jar" + }, + "dependencies": { + "@angular/common": "16.2.11", + "@angular/compiler": "16.2.11", + "@angular/core": "16.2.11", + "@angular/forms": "16.2.11", + "@angular/localize": "16.2.11", + "@angular/platform-browser": "16.2.11", + "@angular/platform-browser-dynamic": "16.2.11", + "@angular/router": "16.2.11", + "@fortawesome/angular-fontawesome": "0.13.0", + "@fortawesome/fontawesome-svg-core": "6.4.2", + "@fortawesome/free-solid-svg-icons": "6.4.2", + "@ng-bootstrap/ng-bootstrap": "15.1.2", + "@popperjs/core": "2.11.8", + "@stomp/rx-stomp": "1.2.0", + "bootstrap": "5.3.2", + "dayjs": "1.11.10", + "ngx-infinite-scroll": "16.0.0", + "rxjs": "7.8.1", + "sockjs-client": "1.6.1", + "tslib": "2.6.2", + "zone.js": "0.13.3" + }, + "devDependencies": { + "@angular-builders/custom-webpack": "16.0.1", + "@angular-builders/jest": "16.0.1", + "@angular-devkit/build-angular": "16.2.9", + "@angular-eslint/eslint-plugin": "16.2.0", + "@angular/cli": "16.2.9", + "@angular/compiler-cli": "16.2.11", + "@angular/service-worker": "16.2.11", + "@types/jest": "29.5.7", + "@types/node": "18.18.8", + "@types/sockjs-client": "1.5.1", + "@typescript-eslint/eslint-plugin": "6.9.1", + "@typescript-eslint/parser": "6.9.1", + "browser-sync": "2.29.3", + "browser-sync-webpack-plugin": "2.3.0", + "buffer": "6.0.3", + "concurrently": "8.2.2", + "copy-webpack-plugin": "11.0.0", + "eslint": "8.52.0", + "eslint-config-prettier": "9.0.0", + "eslint-webpack-plugin": "4.0.1", + "generator-jhipster": "8.0.0", + "husky": "8.0.3", + "jest": "29.7.0", + "jest-date-mock": "1.0.8", + "jest-environment-jsdom": "29.7.0", + "jest-junit": "16.0.0", + "jest-preset-angular": "13.1.2", + "jest-sonar": "0.2.16", + "lint-staged": "15.0.2", + "prettier": "3.0.3", + "prettier-plugin-java": "2.3.1", + "prettier-plugin-packagejson": "2.4.6", + "rimraf": "5.0.5", + "swagger-ui-dist": "5.9.1", + "ts-jest": "29.1.1", + "typescript": "5.1.6", + "wait-on": "7.0.1", + "webpack-bundle-analyzer": "4.9.1", + "webpack-merge": "5.10.0", + "webpack-notifier": "1.15.0" + }, + "engines": { + "node": ">=18.18.2" + }, + "cacheDirectories": [ + "node_modules" + ], + "overrides": { + "webpack": "5.89.0" + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..19586157 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,21 @@ + +pluginManagement { + repositories { + // jhipster-needle-gradle-plugin-management-repositories - JHipster will add additional entries here + } + plugins { + id 'org.springframework.boot' version "${springBootVersion}" + id 'com.google.cloud.tools.jib' version "${jibPluginVersion}" + id 'com.gorylenko.gradle-git-properties' version "${gitPropertiesPluginVersion}" + id "org.openapi.generator" version "${openapiPluginVersion}" + id 'com.github.node-gradle.node' version "${gradleNodePluginVersion}" + id 'org.sonarqube' version "${sonarqubePluginVersion}" + id 'com.diffplug.spotless' version "${spotlessPluginVersion}" + id "io.spring.nohttp" version "${noHttpCheckstyleVersion}" + id 'com.github.andygoossens.gradle-modernizer-plugin' version "${modernizerPluginVersion}" + id "org.liquibase.gradle" version "${liquibasePluginVersion}" + // jhipster-needle-gradle-plugin-management-plugins - JHipster will add additional entries here + } +} + +rootProject.name = "artemis-benchmarking" diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..725fdc05 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,37 @@ +sonar.projectKey = artemis-benchmarking +sonar.projectName = artemis-benchmarking generated by jhipster + +# Typescript tests files must be inside sources and tests, othewise `INFO: Test execution data ignored for 80 unknown files, including:` is +# shown. +sonar.sources = src +sonar.tests = src +sonar.host.url = http://localhost:9001 + +sonar.test.inclusions = src/test/**/*.*, src/main/webapp/app/**/*.spec.ts +sonar.coverage.jacoco.xmlReportPaths = build/reports/jacoco/test/jacocoTestReport.xml +sonar.java.codeCoveragePlugin = jacoco +sonar.junit.reportPaths = build/test-results/test, build/test-results/integrationTest +sonar.testExecutionReportPaths = build/test-results/jest/TESTS-results-sonar.xml +sonar.javascript.lcov.reportPaths = build/test-results/lcov.info + +sonar.sourceEncoding = UTF-8 +sonar.exclusions = src/main/webapp/content/**/*.*, src/main/webapp/i18n/*.js, build/resources/main/static/**/*.* + +sonar.issue.ignore.multicriteria = S3437,S4502,S4684,S5145,UndocumentedApi + +# Rule https://rules.sonarsource.com/java/RSPEC-3437 is ignored, as a JPA-managed field cannot be transient +sonar.issue.ignore.multicriteria.S3437.resourceKey = src/main/java/**/* +sonar.issue.ignore.multicriteria.S3437.ruleKey = squid:S3437 +# Rule https://rules.sonarsource.com/java/RSPEC-4502 is ignored, as for JWT tokens we are not subject to CSRF attack +sonar.issue.ignore.multicriteria.S4502.resourceKey = src/main/java/**/* +sonar.issue.ignore.multicriteria.S4502.ruleKey = java:S4502 +# Rule https://rules.sonarsource.com/java/RSPEC-4684 +sonar.issue.ignore.multicriteria.S4684.resourceKey = src/main/java/**/* +sonar.issue.ignore.multicriteria.S4684.ruleKey = java:S4684 +# Rule https://rules.sonarsource.com/java/RSPEC-5145 log filter is applied +sonar.issue.ignore.multicriteria.S5145.resourceKey = src/main/java/**/* +sonar.issue.ignore.multicriteria.S5145.ruleKey = javasecurity:S5145 +# Rule https://rules.sonarsource.com/java/RSPEC-1176 is ignored, as we want to follow "clean code" guidelines and classes, methods and +# arguments names should be self-explanatory +sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey = src/main/java/**/* +sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey = squid:UndocumentedApi diff --git a/src/main/docker/app.yml b/src/main/docker/app.yml new file mode 100644 index 00000000..a6d3d744 --- /dev/null +++ b/src/main/docker/app.yml @@ -0,0 +1,29 @@ +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production +name: artemis-benchmarking +services: + app: + image: artemis-benchmarking + environment: + - _JAVA_OPTIONS=-Xmx512m -Xms256m + - SPRING_PROFILES_ACTIVE=prod,api-docs + - MANAGEMENT_PROMETHEUS_METRICS_EXPORT_ENABLED=true + - SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/artemis-benchmarking?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true + - SPRING_LIQUIBASE_URL=jdbc:mysql://mysql:3306/artemis-benchmarking?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true + ports: + - 127.0.0.1:8080:8080 + healthcheck: + test: + - CMD + - curl + - -f + - http://localhost:8080/management/health + interval: 5s + timeout: 5s + retries: 40 + depends_on: + mysql: + condition: service_healthy + mysql: + extends: + file: ./mysql.yml + service: mysql diff --git a/src/main/docker/config/mysql/my.cnf b/src/main/docker/config/mysql/my.cnf new file mode 100644 index 00000000..582bdd19 --- /dev/null +++ b/src/main/docker/config/mysql/my.cnf @@ -0,0 +1,82 @@ +# For advice on how to change settings please see +# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html +[mysqld] +user = mysql +datadir = /var/lib/mysql +port = 3306 +#socket = /tmp/mysql.sock +skip-external-locking +key_buffer_size = 16K +max_allowed_packet = 1M +table_open_cache = 4 +sort_buffer_size = 64K +read_buffer_size = 256K +read_rnd_buffer_size = 256K +net_buffer_length = 2K +skip-host-cache +skip-name-resolve + +# Don't listen on a TCP/IP port at all. This can be a security enhancement, +# if all processes that need to connect to mysqld run on the same host. +# All interaction with mysqld must be made via Unix sockets or named pipes. +# Note that using this option without enabling named pipes on Windows +# (using the "enable-named-pipe" option) will render mysqld useless! +# +#skip-networking +#server-id = 1 + +# Uncomment the following if you want to log updates +#log-bin=mysql-bin + +# binary logging format - mixed recommended +#binlog_format=mixed + +# Causes updates to non-transactional engines using statement format to be +# written directly to binary log. Before using this option make sure that +# there are no dependencies between transactional and non-transactional +# tables such as in the statement INSERT INTO t_myisam SELECT * FROM +# t_innodb; otherwise, slaves may diverge from the master. +#binlog_direct_non_transactional_updates=TRUE + +# Uncomment the following if you are using InnoDB tables +innodb_data_file_path = ibdata1:10M:autoextend +# You can set .._buffer_pool_size up to 50 - 80 % +# of RAM but beware of setting memory usage too high +innodb_buffer_pool_size = 16M +#innodb_additional_mem_pool_size = 2M +# Set .._log_file_size to 25 % of buffer pool size +innodb_log_file_size = 5M +innodb_log_buffer_size = 8M +innodb_flush_log_at_trx_commit = 1 +innodb_lock_wait_timeout = 50 + +symbolic-links=0 +innodb_buffer_pool_size=5M +innodb_log_buffer_size=256K +max_connections=20 +key_buffer_size=8 +thread_cache_size=0 +host_cache_size=0 +innodb_ft_cache_size=1600000 +innodb_ft_total_cache_size=32000000 +#### These optimize the memory use of MySQL +#### http://www.tocker.ca/2014/03/10/configuring-mysql-to-use-minimal-memory.html + +# per thread or per operation settings +thread_stack=131072 +sort_buffer_size=32K +read_buffer_size=8200 +read_rnd_buffer_size=8200 +max_heap_table_size=16K +tmp_table_size=1K +bulk_insert_buffer_size=0 +join_buffer_size=128 +net_buffer_length=1K +innodb_sort_buffer_size=64K + +#settings that relate to the binary log (if enabled) +binlog_cache_size=4K +binlog_stmt_cache_size=4K + +performance_schema = off +character-set-server = utf8mb4 diff --git a/src/main/docker/grafana/provisioning/dashboards/JVM.json b/src/main/docker/grafana/provisioning/dashboards/JVM.json new file mode 100644 index 00000000..5104abcd --- /dev/null +++ b/src/main/docker/grafana/provisioning/dashboards/JVM.json @@ -0,0 +1,3778 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "limit": 100, + "name": "Annotations & Alerts", + "showIn": 0, + "type": "dashboard" + }, + { + "datasource": "Prometheus", + "enable": true, + "expr": "resets(process_uptime_seconds{application=\"$application\", instance=\"$instance\"}[1m]) > 0", + "iconColor": "rgba(255, 96, 96, 1)", + "name": "Restart Detection", + "showIn": 0, + "step": "1m", + "tagKeys": "restart-tag", + "textFormat": "uptime reset", + "titleFormat": "Restart" + } + ] + }, + "description": "Dashboard for Micrometer instrumented applications (Java, Spring Boot, Micronaut)", + "editable": true, + "gnetId": 4701, + "graphTooltip": 1, + "iteration": 1553765841423, + "links": [], + "panels": [ + { + "content": "\n# Acknowledgments\n\nThank you to [Michael Weirauch](https://twitter.com/emwexx) for creating this dashboard: see original JVM (Micrometer) dashboard at [https://grafana.com/dashboards/4701](https://grafana.com/dashboards/4701)\n\n\n\n", + "gridPos": { + "h": 3, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 141, + "links": [], + "mode": "markdown", + "timeFrom": null, + "timeShift": null, + "title": "Acknowledgments", + "type": "text" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 3 + }, + "id": 125, + "panels": [], + "repeat": null, + "title": "Quick Facts", + "type": "row" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], + "datasource": "Prometheus", + "decimals": 1, + "editable": true, + "error": false, + "format": "s", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 0, + "y": 4 + }, + "height": "", + "id": 63, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "70%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "process_uptime_seconds{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "metric": "", + "refId": "A", + "step": 14400 + } + ], + "thresholds": "", + "title": "Uptime", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": ["rgba(245, 54, 54, 0.9)", "rgba(237, 129, 40, 0.89)", "rgba(50, 172, 45, 0.97)"], + "datasource": "Prometheus", + "decimals": null, + "editable": true, + "error": false, + "format": "dateTimeAsIso", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 6, + "y": 4 + }, + "height": "", + "id": 92, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "70%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "process_start_time_seconds{application=\"$application\", instance=\"$instance\"}*1000", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "metric": "", + "refId": "A", + "step": 14400 + } + ], + "thresholds": "", + "title": "Start time", + "type": "singlestat", + "valueFontSize": "70%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": ["rgba(50, 172, 45, 0.97)", "rgba(237, 129, 40, 0.89)", "rgba(245, 54, 54, 0.9)"], + "datasource": "Prometheus", + "decimals": 2, + "editable": true, + "error": false, + "format": "percent", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 12, + "y": 4 + }, + "id": 65, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "70%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"})*100/sum(jvm_memory_max_bytes{application=\"$application\",instance=\"$instance\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A", + "step": 14400 + } + ], + "thresholds": "70,90", + "title": "Heap used", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + } + ], + "valueName": "current" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": true, + "colors": ["rgba(50, 172, 45, 0.97)", "rgba(237, 129, 40, 0.89)", "rgba(245, 54, 54, 0.9)"], + "datasource": "Prometheus", + "decimals": 2, + "editable": true, + "error": false, + "format": "percent", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 3, + "w": 6, + "x": 18, + "y": 4 + }, + "id": 75, + "interval": null, + "links": [], + "mappingType": 2, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "70%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + }, + { + "from": "-99999999999999999999999999999999", + "text": "N/A", + "to": "0" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false + }, + "tableColumn": "", + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"})*100/sum(jvm_memory_max_bytes{application=\"$application\",instance=\"$instance\", area=\"nonheap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "", + "refId": "A", + "step": 14400 + } + ], + "thresholds": "70,90", + "title": "Non-Heap used", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "N/A", + "value": "null" + }, + { + "op": "=", + "text": "x", + "value": "" + } + ], + "valueName": "current" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 126, + "panels": [], + "repeat": null, + "title": "I/O Overview", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 8 + }, + "id": 111, + "legend": { + "avg": false, + "current": true, + "max": false, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(http_server_requests_seconds_count{application=\"$application\", instance=\"$instance\"}[1m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "HTTP", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Rate", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "ops", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": { + "HTTP": "#890f02", + "HTTP - 5xx": "#bf1b00" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 8 + }, + "id": 112, + "legend": { + "avg": false, + "current": true, + "max": false, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(http_server_requests_seconds_count{application=\"$application\", instance=\"$instance\", status=~\"5..\"}[1m]))", + "format": "time_series", + "intervalFactor": 1, + "legendFormat": "HTTP - 5xx", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Errors", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "ops", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 8 + }, + "id": 113, + "legend": { + "avg": false, + "current": true, + "max": false, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(http_server_requests_seconds_sum{application=\"$application\", instance=\"$instance\", status!~\"5..\"}[1m]))/sum(rate(http_server_requests_seconds_count{application=\"$application\", instance=\"$instance\", status!~\"5..\"}[1m]))", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "HTTP - AVG", + "refId": "A" + }, + { + "expr": "max(http_server_requests_seconds_max{application=\"$application\", instance=\"$instance\", status!~\"5..\"})", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "HTTP - MAX", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Duration", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 15 + }, + "id": 127, + "panels": [], + "repeat": null, + "title": "JVM Memory", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 16 + }, + "id": 24, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "JVM Heap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 16 + }, + "id": 25, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"})", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "JVM Non-Heap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 16 + }, + "id": 26, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "committed", + "refId": "B", + "step": 2400 + }, + { + "expr": "sum(jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\"})", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "C", + "step": 2400 + }, + { + "expr": "process_memory_vss_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": true, + "intervalFactor": 2, + "legendFormat": "vss", + "metric": "", + "refId": "D", + "step": 2400 + }, + { + "expr": "process_memory_rss_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "rss", + "refId": "E", + "step": 2400 + }, + { + "expr": "process_memory_pss_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "pss", + "refId": "F", + "step": 2400 + }, + { + "expr": "process_memory_swap_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "swap", + "refId": "G", + "step": 2400 + }, + { + "expr": "process_memory_swappss_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "swappss", + "refId": "H", + "step": 2400 + }, + { + "expr": "process_memory_pss_bytes{application=\"$application\", instance=\"$instance\"} + process_memory_swap_bytes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "phys (pss+swap)", + "refId": "I", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "JVM Total", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": "", + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 23 + }, + "id": 128, + "panels": [], + "repeat": null, + "title": "JVM Misc", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 24 + }, + "id": 106, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "system_cpu_usage{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "system", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "process_cpu_usage{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "process", + "refId": "B" + }, + { + "expr": "avg_over_time(process_cpu_usage{application=\"$application\", instance=\"$instance\"}[1h])", + "format": "time_series", + "hide": false, + "intervalFactor": 1, + "legendFormat": "process-1h", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "CPU", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "decimals": 1, + "format": "percentunit", + "label": "", + "logBase": 1, + "max": "1", + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 24 + }, + "id": 93, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "system_load_average_1m{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "system-1m", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "", + "format": "time_series", + "intervalFactor": 2, + "refId": "B" + }, + { + "expr": "system_cpu_count{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "cpu", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Load", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "decimals": 1, + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 24 + }, + "id": 32, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_threads_live{application=\"$application\", instance=\"$instance\"} or jvm_threads_live_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "live", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "jvm_threads_daemon{application=\"$application\", instance=\"$instance\"} or jvm_threads_daemon_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "daemon", + "metric": "", + "refId": "B", + "step": 2400 + }, + { + "expr": "jvm_threads_peak{application=\"$application\", instance=\"$instance\"} or jvm_threads_peak_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "peak", + "refId": "C", + "step": 2400 + }, + { + "expr": "process_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "process", + "refId": "D", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Threads", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": { + "blocked": "#bf1b00", + "new": "#fce2de", + "runnable": "#7eb26d", + "terminated": "#511749", + "timed-waiting": "#c15c17", + "waiting": "#eab839" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 24 + }, + "id": 124, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_threads_states_threads{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "{{state}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Thread States", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": { + "debug": "#1F78C1", + "error": "#BF1B00", + "info": "#508642", + "trace": "#6ED0E0", + "warn": "#EAB839" + }, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 18, + "x": 0, + "y": 31 + }, + "height": "", + "id": 91, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "hideEmpty": false, + "hideZero": false, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": true, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "error", + "yaxis": 1 + }, + { + "alias": "warn", + "yaxis": 1 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(logback_events_total{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 2, + "legendFormat": "{{level}}", + "metric": "", + "refId": "A", + "step": 1200 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Log Events (1m)", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 31 + }, + "id": 61, + "legend": { + "avg": false, + "current": true, + "max": true, + "min": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "process_open_fds{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "open", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "process_max_fds{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "B", + "step": 2400 + }, + { + "expr": "process_files_open{application=\"$application\", instance=\"$instance\"} or process_files_open_files{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "open", + "refId": "C" + }, + { + "expr": "process_files_max{application=\"$application\", instance=\"$instance\"} or process_files_max_files{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "max", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "File Descriptors", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 10, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 38 + }, + "id": 129, + "panels": [], + "repeat": "persistence_counts", + "title": "JVM Memory Pools (Heap)", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 39 + }, + "id": 3, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "maxPerRow": 3, + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": "jvm_memory_pool_heap", + "scopedVars": { + "jvm_memory_pool_heap": { + "selected": false, + "text": "PS Eden Space", + "value": "PS Eden Space" + } + }, + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 1800 + }, + { + "expr": "jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "commited", + "metric": "", + "refId": "B", + "step": 1800 + }, + { + "expr": "jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "C", + "step": 1800 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$jvm_memory_pool_heap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 39 + }, + "id": 134, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "maxPerRow": 3, + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "repeatIteration": 1553765841423, + "repeatPanelId": 3, + "scopedVars": { + "jvm_memory_pool_heap": { + "selected": false, + "text": "PS Old Gen", + "value": "PS Old Gen" + } + }, + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 1800 + }, + { + "expr": "jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "commited", + "metric": "", + "refId": "B", + "step": 1800 + }, + { + "expr": "jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "C", + "step": 1800 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$jvm_memory_pool_heap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 39 + }, + "id": 135, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "maxPerRow": 3, + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "repeatIteration": 1553765841423, + "repeatPanelId": 3, + "scopedVars": { + "jvm_memory_pool_heap": { + "selected": false, + "text": "PS Survivor Space", + "value": "PS Survivor Space" + } + }, + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 1800 + }, + { + "expr": "jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "commited", + "metric": "", + "refId": "B", + "step": 1800 + }, + { + "expr": "jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_heap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "C", + "step": 1800 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$jvm_memory_pool_heap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 46 + }, + "id": 130, + "panels": [], + "repeat": null, + "title": "JVM Memory Pools (Non-Heap)", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 47 + }, + "id": 78, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "maxPerRow": 3, + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": "jvm_memory_pool_nonheap", + "scopedVars": { + "jvm_memory_pool_nonheap": { + "selected": false, + "text": "Metaspace", + "value": "Metaspace" + } + }, + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 1800 + }, + { + "expr": "jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "commited", + "metric": "", + "refId": "B", + "step": 1800 + }, + { + "expr": "jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "C", + "step": 1800 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$jvm_memory_pool_nonheap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 47 + }, + "id": 136, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "maxPerRow": 3, + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "repeatIteration": 1553765841423, + "repeatPanelId": 78, + "scopedVars": { + "jvm_memory_pool_nonheap": { + "selected": false, + "text": "Compressed Class Space", + "value": "Compressed Class Space" + } + }, + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 1800 + }, + { + "expr": "jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "commited", + "metric": "", + "refId": "B", + "step": 1800 + }, + { + "expr": "jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "C", + "step": 1800 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$jvm_memory_pool_nonheap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 47 + }, + "id": 137, + "legend": { + "alignAsTable": false, + "avg": false, + "current": true, + "max": true, + "min": false, + "rightSide": false, + "show": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "links": [], + "maxPerRow": 3, + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "repeat": null, + "repeatIteration": 1553765841423, + "repeatPanelId": 78, + "scopedVars": { + "jvm_memory_pool_nonheap": { + "selected": false, + "text": "Code Cache", + "value": "Code Cache" + } + }, + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 1800 + }, + { + "expr": "jvm_memory_committed_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "commited", + "metric": "", + "refId": "B", + "step": 1800 + }, + { + "expr": "jvm_memory_max_bytes{application=\"$application\", instance=\"$instance\", id=\"$jvm_memory_pool_nonheap\"}", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "max", + "metric": "", + "refId": "C", + "step": 1800 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "$jvm_memory_pool_nonheap", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["mbytes", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 54 + }, + "id": 131, + "panels": [], + "repeat": null, + "title": "Garbage Collection", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 55 + }, + "id": 98, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(jvm_gc_pause_seconds_count{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "hide": false, + "intervalFactor": 2, + "legendFormat": "{{action}} ({{cause}})", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Collections", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "ops", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 55 + }, + "id": 101, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(jvm_gc_pause_seconds_sum{application=\"$application\", instance=\"$instance\"}[1m])/rate(jvm_gc_pause_seconds_count{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "hide": false, + "instant": false, + "intervalFactor": 1, + "legendFormat": "avg {{action}} ({{cause}})", + "refId": "A" + }, + { + "expr": "jvm_gc_pause_seconds_max{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "hide": false, + "instant": false, + "intervalFactor": 1, + "legendFormat": "max {{action}} ({{cause}})", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Pause Durations", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 55 + }, + "id": 99, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(jvm_gc_memory_allocated_bytes_total{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "allocated", + "refId": "A" + }, + { + "expr": "rate(jvm_gc_memory_promoted_bytes_total{application=\"$application\", instance=\"$instance\"}[1m])", + "format": "time_series", + "interval": "", + "intervalFactor": 1, + "legendFormat": "promoted", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Allocated/Promoted", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 62 + }, + "id": 132, + "panels": [], + "repeat": null, + "title": "Classloading", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 63 + }, + "id": 37, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_classes_loaded{application=\"$application\", instance=\"$instance\"} or jvm_classes_loaded_classes{application=\"$application\", instance=\"$instance\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "loaded", + "metric": "", + "refId": "A", + "step": 1200 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Classes loaded", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 63 + }, + "id": 38, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "delta(jvm_classes_loaded{application=\"$application\",instance=\"$instance\"}[5m]) or delta(jvm_classes_loaded_classes{application=\"$application\",instance=\"$instance\"}[5m])", + "format": "time_series", + "hide": false, + "interval": "", + "intervalFactor": 2, + "legendFormat": "delta", + "metric": "", + "refId": "A", + "step": 1200 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Class delta (5m)", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["ops", "short"], + "yaxes": [ + { + "decimals": null, + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 70 + }, + "id": 133, + "panels": [], + "repeat": null, + "title": "Buffer Pools", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 0, + "y": 71 + }, + "id": 33, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_buffer_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=\"direct\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "jvm_buffer_total_capacity_bytes{application=\"$application\", instance=\"$instance\", id=\"direct\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "capacity", + "metric": "", + "refId": "B", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Direct Buffers", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 6, + "y": 71 + }, + "id": 83, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_buffer_count{application=\"$application\", instance=\"$instance\", id=\"direct\"} or jvm_buffer_count_buffers{application=\"$application\", instance=\"$instance\", id=\"direct\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "count", + "metric": "", + "refId": "A", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Direct Buffers", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 12, + "y": 71 + }, + "id": 85, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_buffer_memory_used_bytes{application=\"$application\", instance=\"$instance\", id=\"mapped\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "used", + "metric": "", + "refId": "A", + "step": 2400 + }, + { + "expr": "jvm_buffer_total_capacity_bytes{application=\"$application\", instance=\"$instance\", id=\"mapped\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "capacity", + "metric": "", + "refId": "B", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Mapped Buffers", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "editable": true, + "error": false, + "fill": 1, + "grid": { + "leftLogBase": 1, + "leftMax": null, + "leftMin": null, + "rightLogBase": 1, + "rightMax": null, + "rightMin": null + }, + "gridPos": { + "h": 7, + "w": 6, + "x": 18, + "y": 71 + }, + "id": 84, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "paceLength": 10, + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_buffer_count{application=\"$application\", instance=\"$instance\", id=\"mapped\"} or jvm_buffer_count_buffers{application=\"$application\", instance=\"$instance\", id=\"mapped\"}", + "format": "time_series", + "intervalFactor": 2, + "legendFormat": "count", + "metric": "", + "refId": "A", + "step": 2400 + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Mapped Buffers", + "tooltip": { + "msResolution": false, + "shared": true, + "sort": 0, + "value_type": "cumulative" + }, + "type": "graph", + "x-axis": true, + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "y-axis": true, + "y_formats": ["short", "short"], + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": 0, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": "10s", + "schemaVersion": 18, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": null, + "current": { + "text": "test", + "value": "test" + }, + "datasource": "Prometheus", + "definition": "", + "hide": 0, + "includeAll": false, + "label": "Application", + "multi": false, + "name": "application", + "options": [], + "query": "label_values(application)", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allFormat": "glob", + "allValue": null, + "current": { + "text": "localhost:8080", + "value": "localhost:8080" + }, + "datasource": "Prometheus", + "definition": "", + "hide": 0, + "includeAll": false, + "label": "Instance", + "multi": false, + "multiFormat": "glob", + "name": "instance", + "options": [], + "query": "label_values(jvm_memory_used_bytes{application=\"$application\"}, instance)", + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allFormat": "glob", + "allValue": null, + "current": { + "text": "All", + "value": "$__all" + }, + "datasource": "Prometheus", + "definition": "", + "hide": 0, + "includeAll": true, + "label": "JVM Memory Pools Heap", + "multi": false, + "multiFormat": "glob", + "name": "jvm_memory_pool_heap", + "options": [], + "query": "label_values(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"heap\"},id)", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + }, + { + "allFormat": "glob", + "allValue": null, + "current": { + "text": "All", + "value": "$__all" + }, + "datasource": "Prometheus", + "definition": "", + "hide": 0, + "includeAll": true, + "label": "JVM Memory Pools Non-Heap", + "multi": false, + "multiFormat": "glob", + "name": "jvm_memory_pool_nonheap", + "options": [], + "query": "label_values(jvm_memory_used_bytes{application=\"$application\", instance=\"$instance\", area=\"nonheap\"},id)", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 2, + "tagValuesQuery": "", + "tags": [], + "tagsQuery": "", + "type": "query", + "useTags": false + } + ] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timepicker": { + "now": true, + "refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], + "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] + }, + "timezone": "browser", + "title": "JVM (Micrometer)", + "uid": "Ud1CFe3iz", + "version": 1 +} diff --git a/src/main/docker/grafana/provisioning/dashboards/dashboard.yml b/src/main/docker/grafana/provisioning/dashboards/dashboard.yml new file mode 100644 index 00000000..4817a83a --- /dev/null +++ b/src/main/docker/grafana/provisioning/dashboards/dashboard.yml @@ -0,0 +1,11 @@ +apiVersion: 1 + +providers: + - name: 'Prometheus' + orgId: 1 + folder: '' + type: file + disableDeletion: false + editable: true + options: + path: /etc/grafana/provisioning/dashboards diff --git a/src/main/docker/grafana/provisioning/datasources/datasource.yml b/src/main/docker/grafana/provisioning/datasources/datasource.yml new file mode 100644 index 00000000..57b2bb3e --- /dev/null +++ b/src/main/docker/grafana/provisioning/datasources/datasource.yml @@ -0,0 +1,50 @@ +apiVersion: 1 + +# list of datasources that should be deleted from the database +deleteDatasources: + - name: Prometheus + orgId: 1 + +# list of datasources to insert/update depending +# whats available in the database +datasources: + # name of the datasource. Required + - name: Prometheus + # datasource type. Required + type: prometheus + # access mode. direct or proxy. Required + access: proxy + # org id. will default to orgId 1 if not specified + orgId: 1 + # url + # On MacOS, replace localhost by host.docker.internal + url: http://localhost:9090 + # database password, if used + password: + # database user, if used + user: + # database name, if used + database: + # enable/disable basic auth + basicAuth: false + # basic auth username + basicAuthUser: admin + # basic auth password + basicAuthPassword: admin + # enable/disable with credentials headers + withCredentials: + # mark as default datasource. Max one per org + isDefault: true + # fields that will be converted to json and stored in json_data + jsonData: + graphiteVersion: '1.1' + tlsAuth: false + tlsAuthWithCACert: false + # json object of data that will be encrypted. + secureJsonData: + tlsCACert: '...' + tlsClientCert: '...' + tlsClientKey: '...' + version: 1 + # allow users to edit datasources from the UI. + editable: true diff --git a/src/main/docker/hazelcast-management-center.yml b/src/main/docker/hazelcast-management-center.yml new file mode 100644 index 00000000..495863e3 --- /dev/null +++ b/src/main/docker/hazelcast-management-center.yml @@ -0,0 +1,9 @@ +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production +name: artemis-benchmarking +services: + hazelcast-management-center: + image: hazelcast/management-center:5.3.3 + # If you want to expose these ports outside your dev PC, + # remove the "127.0.0.1:" prefix + ports: + - 127.0.0.1:8180:8080 diff --git a/src/main/docker/jhipster-control-center.yml b/src/main/docker/jhipster-control-center.yml new file mode 100644 index 00000000..ba1ed219 --- /dev/null +++ b/src/main/docker/jhipster-control-center.yml @@ -0,0 +1,51 @@ +## How to use JHCC docker compose +# To allow JHCC to reach JHipster application from a docker container note that we set the host as host.docker.internal +# To reach the application from a browser, you need to add '127.0.0.1 host.docker.internal' to your hosts file. +### Discovery mode +# JHCC support 3 kinds of discovery mode: Consul, Eureka and static +# In order to use one, please set SPRING_PROFILES_ACTIVE to one (and only one) of this values: consul,eureka,static +### Discovery properties +# According to the discovery mode choose as Spring profile, you have to set the right properties +# please note that current properties are set to run JHCC with default values, personalize them if needed +# and remove those from other modes. You can only have one mode active. +#### Eureka +# - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:admin@host.docker.internal:8761/eureka/ +#### Consul +# - SPRING_CLOUD_CONSUL_HOST=host.docker.internal +# - SPRING_CLOUD_CONSUL_PORT=8500 +#### Static +# Add instances to "MyApp" +# - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYAPP_0_URI=http://host.docker.internal:8081 +# - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYAPP_1_URI=http://host.docker.internal:8082 +# Or add a new application named MyNewApp +# - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYNEWAPP_0_URI=http://host.docker.internal:8080 +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production + +#### IMPORTANT +# If you choose Consul or Eureka mode: +# Do not forget to remove the prefix "127.0.0.1" in front of their port in order to expose them. +# This is required because JHCC need to communicate with Consul or Eureka. +# - In Consul mode, the ports are in the consul.yml file. +# - In Eureka mode, the ports are in the jhipster-registry.yml file. + +name: artemis-benchmarking +services: + jhipster-control-center: + image: 'jhipster/jhipster-control-center:v0.5.0' + command: + - /bin/sh + - -c + # Patch /etc/hosts to support resolving host.docker.internal to the internal IP address used by the host in all OSes + - echo "`ip route | grep default | cut -d ' ' -f3` host.docker.internal" | tee -a /etc/hosts > /dev/null && java -jar /jhipster-control-center.jar + environment: + - _JAVA_OPTIONS=-Xmx512m -Xms256m + - SPRING_PROFILES_ACTIVE=prod,api-docs,static + - SPRING_SECURITY_USER_PASSWORD=admin + # The token should have the same value than the one declared in you Spring configuration under the jhipster.security.authentication.jwt.base64-secret configuration's entry + - JHIPSTER_SECURITY_AUTHENTICATION_JWT_BASE64_SECRET=YjQzZmE3YzMxODc2NDE1NDY1M2JlYjQxMjhjZWNiOGU1OWM1ZGFhYmY1OWU5ODI0MWMwMDYwY2ZlZDUwZWUzOWY2OGRmY2EwMDJlODY4NGFiNWNmZjhjMWUyZDRjY2IxZTIxOTBlZGI0NzRlMDJjNGNlMTcwZjE2ODRmMjUxNjc= + - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_ARTEMIS-BENCHMARKING_0_URI=http://host.docker.internal:8080 + - LOGGING_FILE_NAME=/tmp/jhipster-control-center.log + # If you want to expose these ports outside your dev PC, + # remove the "127.0.0.1:" prefix + ports: + - 127.0.0.1:7419:7419 diff --git a/src/main/docker/jib/entrypoint.sh b/src/main/docker/jib/entrypoint.sh new file mode 100644 index 00000000..7af656e6 --- /dev/null +++ b/src/main/docker/jib/entrypoint.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP} + +# usage: file_env VAR [DEFAULT] +# ie: file_env 'XYZ_DB_PASSWORD' 'example' +# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of +# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature) +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + if [[ ${!var:-} && ${!fileVar:-} ]]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + local val="$def" + if [[ ${!var:-} ]]; then + val="${!var}" + elif [[ ${!fileVar:-} ]]; then + val="$(< "${!fileVar}")" + fi + + if [[ -n $val ]]; then + export "$var"="$val" + fi + + unset "$fileVar" +} + +file_env 'SPRING_DATASOURCE_URL' +file_env 'SPRING_DATASOURCE_USERNAME' +file_env 'SPRING_DATASOURCE_PASSWORD' +file_env 'SPRING_LIQUIBASE_URL' +file_env 'SPRING_LIQUIBASE_USER' +file_env 'SPRING_LIQUIBASE_PASSWORD' +file_env 'JHIPSTER_REGISTRY_PASSWORD' + +exec java ${JAVA_OPTS} -noverify -XX:+AlwaysPreTouch -Djava.security.egd=file:/dev/./urandom -cp /app/resources/:/app/classes/:/app/libs/* "de.tum.cit.ase.ArtemisBenchmarkingApp" "$@" diff --git a/src/main/docker/monitoring.yml b/src/main/docker/monitoring.yml new file mode 100644 index 00000000..36396200 --- /dev/null +++ b/src/main/docker/monitoring.yml @@ -0,0 +1,31 @@ +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production +name: artemis-benchmarking +services: + prometheus: + image: prom/prometheus:v2.47.2 + volumes: + - ./prometheus/:/etc/prometheus/ + command: + - '--config.file=/etc/prometheus/prometheus.yml' + # If you want to expose these ports outside your dev PC, + # remove the "127.0.0.1:" prefix + ports: + - 127.0.0.1:9090:9090 + # On MacOS, remove next line and replace localhost by host.docker.internal in prometheus/prometheus.yml and + # grafana/provisioning/datasources/datasource.yml + network_mode: 'host' # to test locally running service + grafana: + image: grafana/grafana:10.2.0 + volumes: + - ./grafana/provisioning/:/etc/grafana/provisioning/ + environment: + - GF_SECURITY_ADMIN_PASSWORD=admin + - GF_USERS_ALLOW_SIGN_UP=false + - GF_INSTALL_PLUGINS=grafana-piechart-panel + # If you want to expose these ports outside your dev PC, + # remove the "127.0.0.1:" prefix + ports: + - 127.0.0.1:3000:3000 + # On MacOS, remove next line and replace localhost by host.docker.internal in prometheus/prometheus.yml and + # grafana/provisioning/datasources/datasource.yml + network_mode: 'host' # to test locally running service diff --git a/src/main/docker/mysql.yml b/src/main/docker/mysql.yml new file mode 100644 index 00000000..f75b2db9 --- /dev/null +++ b/src/main/docker/mysql.yml @@ -0,0 +1,21 @@ +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production +name: artemis-benchmarking +services: + mysql: + image: mysql:8.2.0 + volumes: + - ./config/mysql:/etc/mysql/conf.d + # - ~/volumes/jhipster/artemis-benchmarking/mysql/:/var/lib/mysql/ + environment: + - MYSQL_ALLOW_EMPTY_PASSWORD=yes + - MYSQL_DATABASE=artemis-benchmarking + # If you want to expose these ports outside your dev PC, + # remove the "127.0.0.1:" prefix + ports: + - 127.0.0.1:3306:3306 + command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8mb4 --explicit_defaults_for_timestamp + healthcheck: + test: ['CMD', 'mysql', '-e', 'SHOW DATABASES;'] + interval: 5s + timeout: 5s + retries: 10 diff --git a/src/main/docker/prometheus/prometheus.yml b/src/main/docker/prometheus/prometheus.yml new file mode 100644 index 00000000..b370a2f4 --- /dev/null +++ b/src/main/docker/prometheus/prometheus.yml @@ -0,0 +1,31 @@ +# Sample global config for monitoring JHipster applications +global: + scrape_interval: 15s # By default, scrape targets every 15 seconds. + evaluation_interval: 15s # By default, scrape targets every 15 seconds. + # scrape_timeout is set to the global default (10s). + + # Attach these labels to any time series or alerts when communicating with + # external systems (federation, remote storage, Alertmanager). + external_labels: + monitor: 'jhipster' + +# A scrape configuration containing exactly one endpoint to scrape: +# Here it's Prometheus itself. +scrape_configs: + # The job name is added as a label `job=` to any timeseries scraped from this config. + - job_name: 'prometheus' + + # Override the global default and scrape targets from this job every 5 seconds. + scrape_interval: 5s + + # scheme defaults to 'http' enable https in case your application is server via https + #scheme: https + # basic auth is not needed by default. See https://www.jhipster.tech/monitoring/#configuring-metrics-forwarding for details + #basic_auth: + # username: admin + # password: admin + metrics_path: /management/prometheus + static_configs: + - targets: + # On MacOS, replace localhost by host.docker.internal + - localhost:8080 diff --git a/src/main/docker/services.yml b/src/main/docker/services.yml new file mode 100644 index 00000000..e842abdf --- /dev/null +++ b/src/main/docker/services.yml @@ -0,0 +1,7 @@ +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production +name: artemis-benchmarking +services: + mysql: + extends: + file: ./mysql.yml + service: mysql diff --git a/src/main/docker/sonar.yml b/src/main/docker/sonar.yml new file mode 100644 index 00000000..9e66c6e0 --- /dev/null +++ b/src/main/docker/sonar.yml @@ -0,0 +1,15 @@ +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production +name: artemis-benchmarking +services: + sonar: + container_name: sonarqube + image: sonarqube:10.2.1-community + # Forced authentication redirect for UI is turned off for out of the box experience while trying out SonarQube + # For real use cases delete SONAR_FORCEAUTHENTICATION variable or set SONAR_FORCEAUTHENTICATION=true + environment: + - SONAR_FORCEAUTHENTICATION=false + # If you want to expose these ports outside your dev PC, + # remove the "127.0.0.1:" prefix + ports: + - 127.0.0.1:9001:9000 + - 127.0.0.1:9000:9000 diff --git a/src/main/docker/swagger-editor.yml b/src/main/docker/swagger-editor.yml new file mode 100644 index 00000000..a4242964 --- /dev/null +++ b/src/main/docker/swagger-editor.yml @@ -0,0 +1,7 @@ +# This configuration is intended for development purpose, it's **your** responsibility to harden it for production +name: artemis-benchmarking +services: + swagger-editor: + image: swaggerapi/swagger-editor:latest + ports: + - 127.0.0.1:7742:8080 diff --git a/src/main/java/de/tum/cit/ase/ApplicationWebXml.java b/src/main/java/de/tum/cit/ase/ApplicationWebXml.java new file mode 100644 index 00000000..17878aed --- /dev/null +++ b/src/main/java/de/tum/cit/ase/ApplicationWebXml.java @@ -0,0 +1,19 @@ +package de.tum.cit.ase; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import tech.jhipster.config.DefaultProfileUtil; + +/** + * This is a helper Java class that provides an alternative to creating a {@code web.xml}. + * This will be invoked only when the application is deployed to a Servlet container like Tomcat, JBoss etc. + */ +public class ApplicationWebXml extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + // set a default to use when no profile is configured. + DefaultProfileUtil.addDefaultProfile(application.application()); + return application.sources(ArtemisBenchmarkingApp.class); + } +} diff --git a/src/main/java/de/tum/cit/ase/ArtemisBenchmarkingApp.java b/src/main/java/de/tum/cit/ase/ArtemisBenchmarkingApp.java new file mode 100644 index 00000000..9c91ca9f --- /dev/null +++ b/src/main/java/de/tum/cit/ase/ArtemisBenchmarkingApp.java @@ -0,0 +1,109 @@ +package de.tum.cit.ase; + +import de.tum.cit.ase.config.ApplicationProperties; +import de.tum.cit.ase.config.CRLFLogConverter; +import jakarta.annotation.PostConstruct; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Optional; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.core.env.Environment; +import tech.jhipster.config.DefaultProfileUtil; +import tech.jhipster.config.JHipsterConstants; + +@SpringBootApplication +@EnableConfigurationProperties({ LiquibaseProperties.class, ApplicationProperties.class }) +public class ArtemisBenchmarkingApp { + + private static final Logger log = LoggerFactory.getLogger(ArtemisBenchmarkingApp.class); + + private final Environment env; + + public ArtemisBenchmarkingApp(Environment env) { + this.env = env; + } + + /** + * Initializes artemis-benchmarking. + *

+ * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile + *

+ * You can find more information on how profiles work with JHipster on https://www.jhipster.tech/profiles/. + */ + @PostConstruct + public void initApplication() { + Collection activeProfiles = Arrays.asList(env.getActiveProfiles()); + if ( + activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && + activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION) + ) { + log.error( + "You have misconfigured your application! It should not run " + "with both the 'dev' and 'prod' profiles at the same time." + ); + } + if ( + activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) && + activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_CLOUD) + ) { + log.error( + "You have misconfigured your application! It should not " + "run with both the 'dev' and 'cloud' profiles at the same time." + ); + } + } + + /** + * Main method, used to run the application. + * + * @param args the command line arguments. + */ + public static void main(String[] args) { + SpringApplication app = new SpringApplication(ArtemisBenchmarkingApp.class); + DefaultProfileUtil.addDefaultProfile(app); + Environment env = app.run(args).getEnvironment(); + logApplicationStartup(env); + } + + private static void logApplicationStartup(Environment env) { + String protocol = Optional.ofNullable(env.getProperty("server.ssl.key-store")).map(key -> "https").orElse("http"); + String applicationName = env.getProperty("spring.application.name"); + String serverPort = env.getProperty("server.port"); + String contextPath = Optional + .ofNullable(env.getProperty("server.servlet.context-path")) + .filter(StringUtils::isNotBlank) + .orElse("/"); + String hostAddress = "localhost"; + try { + hostAddress = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + log.warn("The host name could not be determined, using `localhost` as fallback"); + } + log.info( + CRLFLogConverter.CRLF_SAFE_MARKER, + """ + + ---------------------------------------------------------- + \tApplication '{}' is running! Access URLs: + \tLocal: \t\t{}://localhost:{}{} + \tExternal: \t{}://{}:{}{} + \tProfile(s): \t{} + ----------------------------------------------------------""", + applicationName, + protocol, + serverPort, + contextPath, + protocol, + hostAddress, + serverPort, + contextPath, + env.getActiveProfiles().length == 0 ? env.getDefaultProfiles() : env.getActiveProfiles() + ); + } +} diff --git a/src/main/java/de/tum/cit/ase/GeneratedByJHipster.java b/src/main/java/de/tum/cit/ase/GeneratedByJHipster.java new file mode 100644 index 00000000..86f4f57b --- /dev/null +++ b/src/main/java/de/tum/cit/ase/GeneratedByJHipster.java @@ -0,0 +1,13 @@ +package de.tum.cit.ase; + +import jakarta.annotation.Generated; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Generated(value = "JHipster", comments = "Generated by JHipster 8.0.0") +@Retention(RetentionPolicy.SOURCE) +@Target({ ElementType.TYPE }) +public @interface GeneratedByJHipster { +} diff --git a/src/main/java/de/tum/cit/ase/aop/logging/LoggingAspect.java b/src/main/java/de/tum/cit/ase/aop/logging/LoggingAspect.java new file mode 100644 index 00000000..bdf04a46 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/aop/logging/LoggingAspect.java @@ -0,0 +1,111 @@ +package de.tum.cit.ase.aop.logging; + +import java.util.Arrays; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; +import tech.jhipster.config.JHipsterConstants; + +/** + * Aspect for logging execution of service and repository Spring components. + * + * By default, it only runs with the "dev" profile. + */ +@Aspect +public class LoggingAspect { + + private final Environment env; + + public LoggingAspect(Environment env) { + this.env = env; + } + + /** + * Pointcut that matches all repositories, services and Web REST endpoints. + */ + @Pointcut( + "within(@org.springframework.stereotype.Repository *)" + + " || within(@org.springframework.stereotype.Service *)" + + " || within(@org.springframework.web.bind.annotation.RestController *)" + ) + public void springBeanPointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Pointcut that matches all Spring beans in the application's main packages. + */ + @Pointcut("within(de.tum.cit.ase.repository..*)" + " || within(de.tum.cit.ase.service..*)" + " || within(de.tum.cit.ase.web.rest..*)") + public void applicationPackagePointcut() { + // Method is empty as this is just a Pointcut, the implementations are in the advices. + } + + /** + * Retrieves the {@link Logger} associated to the given {@link JoinPoint}. + * + * @param joinPoint join point we want the logger for. + * @return {@link Logger} associated to the given {@link JoinPoint}. + */ + private Logger logger(JoinPoint joinPoint) { + return LoggerFactory.getLogger(joinPoint.getSignature().getDeclaringTypeName()); + } + + /** + * Advice that logs methods throwing exceptions. + * + * @param joinPoint join point for advice. + * @param e exception. + */ + @AfterThrowing(pointcut = "applicationPackagePointcut() && springBeanPointcut()", throwing = "e") + public void logAfterThrowing(JoinPoint joinPoint, Throwable e) { + if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) { + logger(joinPoint) + .error( + "Exception in {}() with cause = '{}' and exception = '{}'", + joinPoint.getSignature().getName(), + e.getCause() != null ? e.getCause() : "NULL", + e.getMessage(), + e + ); + } else { + logger(joinPoint) + .error( + "Exception in {}() with cause = {}", + joinPoint.getSignature().getName(), + e.getCause() != null ? String.valueOf(e.getCause()) : "NULL" + ); + } + } + + /** + * Advice that logs when a method is entered and exited. + * + * @param joinPoint join point for advice. + * @return result. + * @throws Throwable throws {@link IllegalArgumentException}. + */ + @Around("applicationPackagePointcut() && springBeanPointcut()") + public Object logAround(ProceedingJoinPoint joinPoint) throws Throwable { + Logger log = logger(joinPoint); + if (log.isDebugEnabled()) { + log.debug("Enter: {}() with argument[s] = {}", joinPoint.getSignature().getName(), Arrays.toString(joinPoint.getArgs())); + } + try { + Object result = joinPoint.proceed(); + if (log.isDebugEnabled()) { + log.debug("Exit: {}() with result = {}", joinPoint.getSignature().getName(), result); + } + return result; + } catch (IllegalArgumentException e) { + log.error("Illegal argument: {} in {}()", Arrays.toString(joinPoint.getArgs()), joinPoint.getSignature().getName()); + throw e; + } + } +} diff --git a/src/main/java/de/tum/cit/ase/aop/logging/package-info.java b/src/main/java/de/tum/cit/ase/aop/logging/package-info.java new file mode 100644 index 00000000..946084c0 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/aop/logging/package-info.java @@ -0,0 +1,4 @@ +/** + * Logging aspect. + */ +package de.tum.cit.ase.aop.logging; diff --git a/src/main/java/de/tum/cit/ase/config/ApplicationProperties.java b/src/main/java/de/tum/cit/ase/config/ApplicationProperties.java new file mode 100644 index 00000000..af4f01c1 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/ApplicationProperties.java @@ -0,0 +1,16 @@ +package de.tum.cit.ase.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Properties specific to Artemis Benchmarking. + *

+ * Properties are configured in the {@code application.yml} file. + * See {@link tech.jhipster.config.JHipsterProperties} for a good example. + */ +@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) +public class ApplicationProperties { + // jhipster-needle-application-properties-property + // jhipster-needle-application-properties-property-getter + // jhipster-needle-application-properties-property-class +} diff --git a/src/main/java/de/tum/cit/ase/config/AsyncConfiguration.java b/src/main/java/de/tum/cit/ase/config/AsyncConfiguration.java new file mode 100644 index 00000000..2e8140be --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/AsyncConfiguration.java @@ -0,0 +1,48 @@ +package de.tum.cit.ase.config; + +import java.util.concurrent.Executor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; +import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; +import org.springframework.boot.autoconfigure.task.TaskExecutionProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.scheduling.annotation.AsyncConfigurer; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import tech.jhipster.async.ExceptionHandlingAsyncTaskExecutor; + +@Configuration +@EnableAsync +@EnableScheduling +@Profile("!testdev & !testprod") +public class AsyncConfiguration implements AsyncConfigurer { + + private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class); + + private final TaskExecutionProperties taskExecutionProperties; + + public AsyncConfiguration(TaskExecutionProperties taskExecutionProperties) { + this.taskExecutionProperties = taskExecutionProperties; + } + + @Override + @Bean(name = "taskExecutor") + public Executor getAsyncExecutor() { + log.debug("Creating Async Task Executor"); + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(taskExecutionProperties.getPool().getCoreSize()); + executor.setMaxPoolSize(taskExecutionProperties.getPool().getMaxSize()); + executor.setQueueCapacity(taskExecutionProperties.getPool().getQueueCapacity()); + executor.setThreadNamePrefix(taskExecutionProperties.getThreadNamePrefix()); + return new ExceptionHandlingAsyncTaskExecutor(executor); + } + + @Override + public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { + return new SimpleAsyncUncaughtExceptionHandler(); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/CRLFLogConverter.java b/src/main/java/de/tum/cit/ase/config/CRLFLogConverter.java new file mode 100644 index 00000000..948a5a75 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/CRLFLogConverter.java @@ -0,0 +1,69 @@ +package de.tum.cit.ase.config; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.pattern.CompositeConverter; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; +import org.springframework.boot.ansi.AnsiColor; +import org.springframework.boot.ansi.AnsiElement; +import org.springframework.boot.ansi.AnsiOutput; +import org.springframework.boot.ansi.AnsiStyle; + +/** + * Log filter to prevent attackers from forging log entries by submitting input containing CRLF characters. + * CRLF characters are replaced with a red colored _ character. + * + * @see Log Forging Description + * @see JHipster issue + */ +public class CRLFLogConverter extends CompositeConverter { + + public static final Marker CRLF_SAFE_MARKER = MarkerFactory.getMarker("CRLF_SAFE"); + + private static final String[] SAFE_LOGGERS = { + "org.hibernate", + "org.springframework.boot.autoconfigure", + "org.springframework.boot.diagnostics", + }; + private static final Map ELEMENTS; + + static { + Map ansiElements = new HashMap<>(); + ansiElements.put("faint", AnsiStyle.FAINT); + ansiElements.put("red", AnsiColor.RED); + ansiElements.put("green", AnsiColor.GREEN); + ansiElements.put("yellow", AnsiColor.YELLOW); + ansiElements.put("blue", AnsiColor.BLUE); + ansiElements.put("magenta", AnsiColor.MAGENTA); + ansiElements.put("cyan", AnsiColor.CYAN); + ELEMENTS = Collections.unmodifiableMap(ansiElements); + } + + @Override + protected String transform(ILoggingEvent event, String in) { + AnsiElement element = ELEMENTS.get(getFirstOption()); + List markers = event.getMarkerList(); + if ((markers != null && !markers.isEmpty() && markers.get(0).contains(CRLF_SAFE_MARKER)) || isLoggerSafe(event)) { + return in; + } + String replacement = element == null ? "_" : toAnsiString("_", element); + return in.replaceAll("[\n\r\t]", replacement); + } + + protected boolean isLoggerSafe(ILoggingEvent event) { + for (String safeLogger : SAFE_LOGGERS) { + if (event.getLoggerName().startsWith(safeLogger)) { + return true; + } + } + return false; + } + + protected String toAnsiString(String in, AnsiElement element) { + return AnsiOutput.toString(element, in); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/CacheConfiguration.java b/src/main/java/de/tum/cit/ase/config/CacheConfiguration.java new file mode 100644 index 00000000..d8f86853 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/CacheConfiguration.java @@ -0,0 +1,125 @@ +package de.tum.cit.ase.config; + +import com.hazelcast.config.*; +import com.hazelcast.core.Hazelcast; +import com.hazelcast.core.HazelcastInstance; +import jakarta.annotation.PreDestroy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.info.BuildProperties; +import org.springframework.boot.info.GitProperties; +import org.springframework.cache.CacheManager; +import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.JHipsterProperties; +import tech.jhipster.config.cache.PrefixedKeyGenerator; + +@Configuration +@EnableCaching +public class CacheConfiguration { + + private GitProperties gitProperties; + private BuildProperties buildProperties; + + private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class); + + private final Environment env; + + public CacheConfiguration(Environment env) { + this.env = env; + } + + @PreDestroy + public void destroy() { + log.info("Closing Cache Manager"); + Hazelcast.shutdownAll(); + } + + @Bean + public CacheManager cacheManager(HazelcastInstance hazelcastInstance) { + log.debug("Starting HazelcastCacheManager"); + return new com.hazelcast.spring.cache.HazelcastCacheManager(hazelcastInstance); + } + + @Bean + public HazelcastInstance hazelcastInstance(JHipsterProperties jHipsterProperties) { + log.debug("Configuring Hazelcast"); + HazelcastInstance hazelCastInstance = Hazelcast.getHazelcastInstanceByName("artemis-benchmarking"); + if (hazelCastInstance != null) { + log.debug("Hazelcast already initialized"); + return hazelCastInstance; + } + Config config = new Config(); + config.setInstanceName("artemis-benchmarking"); + config.getNetworkConfig().setPort(5701); + config.getNetworkConfig().setPortAutoIncrement(true); + + // In development, remove multicast auto-configuration + if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) { + System.setProperty("hazelcast.local.localAddress", "127.0.0.1"); + + config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false); + config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); + config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false); + } + config.setManagementCenterConfig(new ManagementCenterConfig()); + config.addMapConfig(initializeDefaultMapConfig(jHipsterProperties)); + return Hazelcast.newHazelcastInstance(config); + } + + private MapConfig initializeDefaultMapConfig(JHipsterProperties jHipsterProperties) { + MapConfig mapConfig = new MapConfig("default"); + + /* + Number of backups. If 1 is set as the backup-count for example, + then all entries of the map will be copied to another JVM for + fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. + */ + mapConfig.setBackupCount(jHipsterProperties.getCache().getHazelcast().getBackupCount()); + + /* + Valid values are: + NONE (no eviction), + LRU (Least Recently Used), + LFU (Least Frequently Used). + NONE is the default. + */ + mapConfig.getEvictionConfig().setEvictionPolicy(EvictionPolicy.LRU); + + /* + Maximum size of the map. When max size is reached, + map is evicted based on the policy defined. + Any integer between 0 and Integer.MAX_VALUE. 0 means + Integer.MAX_VALUE. Default is 0. + */ + mapConfig.getEvictionConfig().setMaxSizePolicy(MaxSizePolicy.USED_HEAP_SIZE); + + return mapConfig; + } + + private MapConfig initializeDomainMapConfig(JHipsterProperties jHipsterProperties) { + MapConfig mapConfig = new MapConfig("de.tum.cit.ase.domain.*"); + mapConfig.setTimeToLiveSeconds(jHipsterProperties.getCache().getHazelcast().getTimeToLiveSeconds()); + return mapConfig; + } + + @Autowired(required = false) + public void setGitProperties(GitProperties gitProperties) { + this.gitProperties = gitProperties; + } + + @Autowired(required = false) + public void setBuildProperties(BuildProperties buildProperties) { + this.buildProperties = buildProperties; + } + + @Bean + public KeyGenerator keyGenerator() { + return new PrefixedKeyGenerator(this.gitProperties, this.buildProperties); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/Constants.java b/src/main/java/de/tum/cit/ase/config/Constants.java new file mode 100644 index 00000000..5e0e01f9 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/Constants.java @@ -0,0 +1,15 @@ +package de.tum.cit.ase.config; + +/** + * Application constants. + */ +public final class Constants { + + // Regex for acceptable logins + public static final String LOGIN_REGEX = "^(?>[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*)|(?>[_.@A-Za-z0-9-]+)$"; + + public static final String SYSTEM = "system"; + public static final String DEFAULT_LANGUAGE = "en"; + + private Constants() {} +} diff --git a/src/main/java/de/tum/cit/ase/config/DatabaseConfiguration.java b/src/main/java/de/tum/cit/ase/config/DatabaseConfiguration.java new file mode 100644 index 00000000..2693ca3b --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/DatabaseConfiguration.java @@ -0,0 +1,12 @@ +package de.tum.cit.ase.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@EnableJpaRepositories({ "de.tum.cit.ase.repository" }) +@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware") +@EnableTransactionManagement +public class DatabaseConfiguration {} diff --git a/src/main/java/de/tum/cit/ase/config/DateTimeFormatConfiguration.java b/src/main/java/de/tum/cit/ase/config/DateTimeFormatConfiguration.java new file mode 100644 index 00000000..481bdde8 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/DateTimeFormatConfiguration.java @@ -0,0 +1,20 @@ +package de.tum.cit.ase.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.format.FormatterRegistry; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * Configure the converters to use the ISO format for dates by default. + */ +@Configuration +public class DateTimeFormatConfiguration implements WebMvcConfigurer { + + @Override + public void addFormatters(FormatterRegistry registry) { + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(registry); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/JacksonConfiguration.java b/src/main/java/de/tum/cit/ase/config/JacksonConfiguration.java new file mode 100644 index 00000000..9b589aaa --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/JacksonConfiguration.java @@ -0,0 +1,34 @@ +package de.tum.cit.ase.config; + +import com.fasterxml.jackson.datatype.hibernate6.Hibernate6Module; +import com.fasterxml.jackson.datatype.hibernate6.Hibernate6Module.Feature; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class JacksonConfiguration { + + /** + * Support for Java date and time API. + * @return the corresponding Jackson module. + */ + @Bean + public JavaTimeModule javaTimeModule() { + return new JavaTimeModule(); + } + + @Bean + public Jdk8Module jdk8TimeModule() { + return new Jdk8Module(); + } + + /* + * Support for Hibernate types in Jackson. + */ + @Bean + public Hibernate6Module hibernate6Module() { + return new Hibernate6Module().configure(Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS, true); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/LiquibaseConfiguration.java b/src/main/java/de/tum/cit/ase/config/LiquibaseConfiguration.java new file mode 100644 index 00000000..97ae90fe --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/LiquibaseConfiguration.java @@ -0,0 +1,69 @@ +package de.tum.cit.ase.config; + +import java.util.concurrent.Executor; +import javax.sql.DataSource; +import liquibase.integration.spring.SpringLiquibase; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseDataSource; +import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.liquibase.SpringLiquibaseUtil; + +@Configuration +public class LiquibaseConfiguration { + + private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class); + + private final Environment env; + + public LiquibaseConfiguration(Environment env) { + this.env = env; + } + + @Bean + public SpringLiquibase liquibase( + @Qualifier("taskExecutor") Executor executor, + LiquibaseProperties liquibaseProperties, + @LiquibaseDataSource ObjectProvider liquibaseDataSource, + ObjectProvider dataSource, + DataSourceProperties dataSourceProperties + ) { + // If you don't want Liquibase to start asynchronously, substitute by this: + // SpringLiquibase liquibase = SpringLiquibaseUtil.createSpringLiquibase(liquibaseDataSource.getIfAvailable(), liquibaseProperties, dataSource.getIfUnique(), dataSourceProperties); + SpringLiquibase liquibase = SpringLiquibaseUtil.createAsyncSpringLiquibase( + this.env, + executor, + liquibaseDataSource.getIfAvailable(), + liquibaseProperties, + dataSource.getIfUnique(), + dataSourceProperties + ); + liquibase.setChangeLog("classpath:config/liquibase/master.xml"); + liquibase.setContexts(liquibaseProperties.getContexts()); + liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema()); + liquibase.setLiquibaseSchema(liquibaseProperties.getLiquibaseSchema()); + liquibase.setLiquibaseTablespace(liquibaseProperties.getLiquibaseTablespace()); + liquibase.setDatabaseChangeLogLockTable(liquibaseProperties.getDatabaseChangeLogLockTable()); + liquibase.setDatabaseChangeLogTable(liquibaseProperties.getDatabaseChangeLogTable()); + liquibase.setDropFirst(liquibaseProperties.isDropFirst()); + liquibase.setLabelFilter(liquibaseProperties.getLabelFilter()); + liquibase.setChangeLogParameters(liquibaseProperties.getParameters()); + liquibase.setRollbackFile(liquibaseProperties.getRollbackFile()); + liquibase.setTestRollbackOnUpdate(liquibaseProperties.isTestRollbackOnUpdate()); + if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE))) { + liquibase.setShouldRun(false); + } else { + liquibase.setShouldRun(liquibaseProperties.isEnabled()); + log.debug("Configuring Liquibase"); + } + return liquibase; + } +} diff --git a/src/main/java/de/tum/cit/ase/config/LocaleConfiguration.java b/src/main/java/de/tum/cit/ase/config/LocaleConfiguration.java new file mode 100644 index 00000000..757a5b9c --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/LocaleConfiguration.java @@ -0,0 +1,24 @@ +package de.tum.cit.ase.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.config.annotation.*; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; +import tech.jhipster.config.locale.AngularCookieLocaleResolver; + +@Configuration +public class LocaleConfiguration implements WebMvcConfigurer { + + @Bean + public LocaleResolver localeResolver() { + return new AngularCookieLocaleResolver("NG_TRANSLATE_LANG_KEY"); + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor(); + localeChangeInterceptor.setParamName("language"); + registry.addInterceptor(localeChangeInterceptor); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/LoggingAspectConfiguration.java b/src/main/java/de/tum/cit/ase/config/LoggingAspectConfiguration.java new file mode 100644 index 00000000..7d0c5f11 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/LoggingAspectConfiguration.java @@ -0,0 +1,17 @@ +package de.tum.cit.ase.config; + +import de.tum.cit.ase.aop.logging.LoggingAspect; +import org.springframework.context.annotation.*; +import org.springframework.core.env.Environment; +import tech.jhipster.config.JHipsterConstants; + +@Configuration +@EnableAspectJAutoProxy +public class LoggingAspectConfiguration { + + @Bean + @Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT) + public LoggingAspect loggingAspect(Environment env) { + return new LoggingAspect(env); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/LoggingConfiguration.java b/src/main/java/de/tum/cit/ase/config/LoggingConfiguration.java new file mode 100644 index 00000000..ec6cbce8 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/LoggingConfiguration.java @@ -0,0 +1,47 @@ +package de.tum.cit.ase.config; + +import static tech.jhipster.config.logging.LoggingUtils.*; + +import ch.qos.logback.classic.LoggerContext; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.HashMap; +import java.util.Map; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import tech.jhipster.config.JHipsterProperties; + +/* + * Configures the console and Logstash log appenders from the app properties + */ +@Configuration +public class LoggingConfiguration { + + public LoggingConfiguration( + @Value("${spring.application.name}") String appName, + @Value("${server.port}") String serverPort, + JHipsterProperties jHipsterProperties, + ObjectMapper mapper + ) throws JsonProcessingException { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + + Map map = new HashMap<>(); + map.put("app_name", appName); + map.put("app_port", serverPort); + String customFields = mapper.writeValueAsString(map); + + JHipsterProperties.Logging loggingProperties = jHipsterProperties.getLogging(); + JHipsterProperties.Logging.Logstash logstashProperties = loggingProperties.getLogstash(); + + if (loggingProperties.isUseJsonFormat()) { + addJsonConsoleAppender(context, customFields); + } + if (logstashProperties.isEnabled()) { + addLogstashTcpSocketAppender(context, customFields, logstashProperties); + } + if (loggingProperties.isUseJsonFormat() || logstashProperties.isEnabled()) { + addContextListener(context, customFields, loggingProperties); + } + } +} diff --git a/src/main/java/de/tum/cit/ase/config/OpenApiConfiguration.java b/src/main/java/de/tum/cit/ase/config/OpenApiConfiguration.java new file mode 100644 index 00000000..28ea3a06 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/OpenApiConfiguration.java @@ -0,0 +1,33 @@ +package de.tum.cit.ase.config; + +import org.springdoc.core.models.GroupedOpenApi; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.JHipsterProperties; +import tech.jhipster.config.apidoc.customizer.JHipsterOpenApiCustomizer; + +@Configuration +@Profile(JHipsterConstants.SPRING_PROFILE_API_DOCS) +public class OpenApiConfiguration { + + public static final String API_FIRST_PACKAGE = "de.tum.cit.ase.web.api"; + + @Bean + @ConditionalOnMissingBean(name = "apiFirstGroupedOpenAPI") + public GroupedOpenApi apiFirstGroupedOpenAPI( + JHipsterOpenApiCustomizer jhipsterOpenApiCustomizer, + JHipsterProperties jHipsterProperties + ) { + JHipsterProperties.ApiDocs properties = jHipsterProperties.getApiDocs(); + return GroupedOpenApi + .builder() + .group("openapi") + .addOpenApiCustomizer(jhipsterOpenApiCustomizer) + .packagesToScan(API_FIRST_PACKAGE) + .pathsToMatch(properties.getDefaultIncludePattern()) + .build(); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/SecurityConfiguration.java b/src/main/java/de/tum/cit/ase/config/SecurityConfiguration.java new file mode 100644 index 00000000..672102ca --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/SecurityConfiguration.java @@ -0,0 +1,97 @@ +package de.tum.cit.ase.config; + +import static org.springframework.security.config.Customizer.withDefaults; + +import de.tum.cit.ase.security.*; +import de.tum.cit.ase.web.filter.SpaWebFilter; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.Customizer; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer.FrameOptionsConfig; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationEntryPoint; +import org.springframework.security.oauth2.server.resource.web.access.BearerTokenAccessDeniedHandler; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.www.BasicAuthenticationFilter; +import org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter; +import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher; +import org.springframework.web.servlet.handler.HandlerMappingIntrospector; +import tech.jhipster.config.JHipsterProperties; + +@Configuration +@EnableMethodSecurity(securedEnabled = true) +public class SecurityConfiguration { + + private final JHipsterProperties jHipsterProperties; + + public SecurityConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http, MvcRequestMatcher.Builder mvc) throws Exception { + http + .cors(withDefaults()) + .csrf(csrf -> csrf.disable()) + .addFilterAfter(new SpaWebFilter(), BasicAuthenticationFilter.class) + .headers(headers -> + headers + .contentSecurityPolicy(csp -> csp.policyDirectives(jHipsterProperties.getSecurity().getContentSecurityPolicy())) + .frameOptions(FrameOptionsConfig::sameOrigin) + .referrerPolicy(referrer -> referrer.policy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN)) + .permissionsPolicy(permissions -> + permissions.policy( + "camera=(), fullscreen=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), sync-xhr=()" + ) + ) + ) + .authorizeHttpRequests(authz -> + // prettier-ignore + authz + .requestMatchers(mvc.pattern("/index.html"), mvc.pattern("/*.js"), mvc.pattern("/*.txt"), mvc.pattern("/*.json"), mvc.pattern("/*.map"), mvc.pattern("/*.css")).permitAll() + .requestMatchers(mvc.pattern("/*.ico"), mvc.pattern("/*.png"), mvc.pattern("/*.svg"), mvc.pattern("/*.webapp")).permitAll() + .requestMatchers(mvc.pattern("/app/**")).permitAll() + .requestMatchers(mvc.pattern("/i18n/**")).permitAll() + .requestMatchers(mvc.pattern("/content/**")).permitAll() + .requestMatchers(mvc.pattern("/swagger-ui/**")).permitAll() + .requestMatchers(mvc.pattern(HttpMethod.POST, "/api/authenticate")).permitAll() + .requestMatchers(mvc.pattern(HttpMethod.GET, "/api/authenticate")).permitAll() + .requestMatchers(mvc.pattern("/api/register")).permitAll() + .requestMatchers(mvc.pattern("/api/activate")).permitAll() + .requestMatchers(mvc.pattern("/api/account/reset-password/init")).permitAll() + .requestMatchers(mvc.pattern("/api/account/reset-password/finish")).permitAll() + .requestMatchers(mvc.pattern("/api/admin/**")).hasAuthority(AuthoritiesConstants.ADMIN) + .requestMatchers(mvc.pattern("/api/**")).authenticated() + .requestMatchers(mvc.pattern("/websocket/**")).authenticated() + .requestMatchers(mvc.pattern("/v3/api-docs/**")).hasAuthority(AuthoritiesConstants.ADMIN) + .requestMatchers(mvc.pattern("/management/health")).permitAll() + .requestMatchers(mvc.pattern("/management/health/**")).permitAll() + .requestMatchers(mvc.pattern("/management/info")).permitAll() + .requestMatchers(mvc.pattern("/management/prometheus")).permitAll() + .requestMatchers(mvc.pattern("/management/**")).hasAuthority(AuthoritiesConstants.ADMIN) + ) + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .exceptionHandling(exceptions -> + exceptions + .authenticationEntryPoint(new BearerTokenAuthenticationEntryPoint()) + .accessDeniedHandler(new BearerTokenAccessDeniedHandler()) + ) + .oauth2ResourceServer(oauth2 -> oauth2.jwt(Customizer.withDefaults())); + return http.build(); + } + + @Bean + MvcRequestMatcher.Builder mvc(HandlerMappingIntrospector introspector) { + return new MvcRequestMatcher.Builder(introspector); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/SecurityJwtConfiguration.java b/src/main/java/de/tum/cit/ase/config/SecurityJwtConfiguration.java new file mode 100644 index 00000000..00d0fe18 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/SecurityJwtConfiguration.java @@ -0,0 +1,77 @@ +package de.tum.cit.ase.config; + +import static de.tum.cit.ase.security.SecurityUtils.AUTHORITIES_KEY; +import static de.tum.cit.ase.security.SecurityUtils.JWT_ALGORITHM; + +import com.nimbusds.jose.jwk.source.ImmutableSecret; +import com.nimbusds.jose.util.Base64; +import de.tum.cit.ase.management.SecurityMetersService; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.oauth2.jwt.JwtDecoder; +import org.springframework.security.oauth2.jwt.JwtEncoder; +import org.springframework.security.oauth2.jwt.NimbusJwtDecoder; +import org.springframework.security.oauth2.jwt.NimbusJwtEncoder; +import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter; +import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter; +import org.springframework.security.oauth2.server.resource.web.BearerTokenResolver; +import org.springframework.security.oauth2.server.resource.web.DefaultBearerTokenResolver; + +@Configuration +public class SecurityJwtConfiguration { + + @Value("${jhipster.security.authentication.jwt.base64-secret}") + private String jwtKey; + + @Bean + public JwtDecoder jwtDecoder(SecurityMetersService metersService) { + NimbusJwtDecoder jwtDecoder = NimbusJwtDecoder.withSecretKey(getSecretKey()).macAlgorithm(JWT_ALGORITHM).build(); + return token -> { + try { + return jwtDecoder.decode(token); + } catch (Exception e) { + if (e.getMessage().contains("Invalid signature")) { + metersService.trackTokenInvalidSignature(); + } else if (e.getMessage().contains("Jwt expired at")) { + metersService.trackTokenExpired(); + } else if (e.getMessage().contains("Invalid JWT serialization")) { + metersService.trackTokenMalformed(); + } else if (e.getMessage().contains("Invalid unsecured/JWS/JWE")) { + metersService.trackTokenMalformed(); + } + throw e; + } + }; + } + + @Bean + public JwtEncoder jwtEncoder() { + return new NimbusJwtEncoder(new ImmutableSecret<>(getSecretKey())); + } + + @Bean + public JwtAuthenticationConverter jwtAuthenticationConverter() { + JwtGrantedAuthoritiesConverter grantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter(); + grantedAuthoritiesConverter.setAuthorityPrefix(""); + grantedAuthoritiesConverter.setAuthoritiesClaimName(AUTHORITIES_KEY); + + JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter(); + jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(grantedAuthoritiesConverter); + return jwtAuthenticationConverter; + } + + @Bean + public BearerTokenResolver bearerTokenResolver() { + var bearerTokenResolver = new DefaultBearerTokenResolver(); + bearerTokenResolver.setAllowUriQueryParameter(true); + return bearerTokenResolver; + } + + private SecretKey getSecretKey() { + byte[] keyBytes = Base64.from(jwtKey).decode(); + return new SecretKeySpec(keyBytes, 0, keyBytes.length, JWT_ALGORITHM.getName()); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/StaticResourcesWebConfiguration.java b/src/main/java/de/tum/cit/ase/config/StaticResourcesWebConfiguration.java new file mode 100644 index 00000000..38bee1c7 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/StaticResourcesWebConfiguration.java @@ -0,0 +1,59 @@ +package de.tum.cit.ase.config; + +import java.util.concurrent.TimeUnit; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.springframework.http.CacheControl; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.JHipsterProperties; + +@Configuration +@Profile({ JHipsterConstants.SPRING_PROFILE_PRODUCTION }) +public class StaticResourcesWebConfiguration implements WebMvcConfigurer { + + protected static final String[] RESOURCE_LOCATIONS = new String[] { + "classpath:/static/", + "classpath:/static/content/", + "classpath:/static/i18n/", + }; + protected static final String[] RESOURCE_PATHS = new String[] { + "/*.js", + "/*.css", + "/*.svg", + "/*.png", + "*.ico", + "/content/**", + "/i18n/*", + }; + + private final JHipsterProperties jhipsterProperties; + + public StaticResourcesWebConfiguration(JHipsterProperties jHipsterProperties) { + this.jhipsterProperties = jHipsterProperties; + } + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + ResourceHandlerRegistration resourceHandlerRegistration = appendResourceHandler(registry); + initializeResourceHandler(resourceHandlerRegistration); + } + + protected ResourceHandlerRegistration appendResourceHandler(ResourceHandlerRegistry registry) { + return registry.addResourceHandler(RESOURCE_PATHS); + } + + protected void initializeResourceHandler(ResourceHandlerRegistration resourceHandlerRegistration) { + resourceHandlerRegistration.addResourceLocations(RESOURCE_LOCATIONS).setCacheControl(getCacheControl()); + } + + protected CacheControl getCacheControl() { + return CacheControl.maxAge(getJHipsterHttpCacheProperty(), TimeUnit.DAYS).cachePublic(); + } + + private int getJHipsterHttpCacheProperty() { + return jhipsterProperties.getHttp().getCache().getTimeToLiveInDays(); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/WebConfigurer.java b/src/main/java/de/tum/cit/ase/config/WebConfigurer.java new file mode 100644 index 00000000..a0bbbd4f --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/WebConfigurer.java @@ -0,0 +1,96 @@ +package de.tum.cit.ase.config; + +import static java.net.URLDecoder.decode; + +import jakarta.servlet.*; +import java.io.File; +import java.nio.charset.StandardCharsets; +import java.nio.file.Paths; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.web.server.*; +import org.springframework.boot.web.servlet.ServletContextInitializer; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; +import org.springframework.util.CollectionUtils; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; +import tech.jhipster.config.JHipsterProperties; + +/** + * Configuration of web application with Servlet 3.0 APIs. + */ +@Configuration +public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer { + + private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); + + private final Environment env; + + private final JHipsterProperties jHipsterProperties; + + public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) { + this.env = env; + this.jHipsterProperties = jHipsterProperties; + } + + @Override + public void onStartup(ServletContext servletContext) throws ServletException { + if (env.getActiveProfiles().length != 0) { + log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); + } + + log.info("Web application fully configured"); + } + + /** + * Customize the Servlet engine: Mime types, the document root, the cache. + */ + @Override + public void customize(WebServerFactory server) { + // When running in an IDE or with ./gradlew bootRun, set location of the static web assets. + setLocationForStaticAssets(server); + } + + private void setLocationForStaticAssets(WebServerFactory server) { + if (server instanceof ConfigurableServletWebServerFactory servletWebServer) { + File root; + String prefixPath = resolvePathPrefix(); + root = new File(prefixPath + "build/resources/main/static/"); + if (root.exists() && root.isDirectory()) { + servletWebServer.setDocumentRoot(root); + } + } + } + + /** + * Resolve path prefix to static resources. + */ + private String resolvePathPrefix() { + String fullExecutablePath = decode(this.getClass().getResource("").getPath(), StandardCharsets.UTF_8); + String rootPath = Paths.get(".").toUri().normalize().getPath(); + String extractedPath = fullExecutablePath.replace(rootPath, ""); + int extractionEndIndex = extractedPath.indexOf("build/"); + if (extractionEndIndex <= 0) { + return ""; + } + return extractedPath.substring(0, extractionEndIndex); + } + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + CorsConfiguration config = jHipsterProperties.getCors(); + if (!CollectionUtils.isEmpty(config.getAllowedOrigins()) || !CollectionUtils.isEmpty(config.getAllowedOriginPatterns())) { + log.debug("Registering CORS filter"); + source.registerCorsConfiguration("/api/**", config); + source.registerCorsConfiguration("/management/**", config); + source.registerCorsConfiguration("/v3/api-docs", config); + source.registerCorsConfiguration("/swagger-ui/**", config); + } + return new CorsFilter(source); + } +} diff --git a/src/main/java/de/tum/cit/ase/config/WebsocketConfiguration.java b/src/main/java/de/tum/cit/ase/config/WebsocketConfiguration.java new file mode 100644 index 00000000..20b96767 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/WebsocketConfiguration.java @@ -0,0 +1,90 @@ +package de.tum.cit.ase.config; + +import de.tum.cit.ase.security.AuthoritiesConstants; +import java.security.Principal; +import java.util.*; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.server.*; +import org.springframework.messaging.simp.config.MessageBrokerRegistry; +import org.springframework.security.authentication.AnonymousAuthenticationToken; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.web.socket.WebSocketHandler; +import org.springframework.web.socket.config.annotation.*; +import org.springframework.web.socket.server.HandshakeInterceptor; +import org.springframework.web.socket.server.support.DefaultHandshakeHandler; +import tech.jhipster.config.JHipsterProperties; + +@Configuration +@EnableWebSocketMessageBroker +public class WebsocketConfiguration implements WebSocketMessageBrokerConfigurer { + + public static final String IP_ADDRESS = "IP_ADDRESS"; + + private final JHipsterProperties jHipsterProperties; + + public WebsocketConfiguration(JHipsterProperties jHipsterProperties) { + this.jHipsterProperties = jHipsterProperties; + } + + @Override + public void configureMessageBroker(MessageBrokerRegistry config) { + config.enableSimpleBroker("/topic"); + } + + @Override + public void registerStompEndpoints(StompEndpointRegistry registry) { + String[] allowedOrigins = Optional + .ofNullable(jHipsterProperties.getCors().getAllowedOrigins()) + .map(origins -> origins.toArray(new String[0])) + .orElse(new String[0]); + registry + .addEndpoint("/websocket/tracker") + .setHandshakeHandler(defaultHandshakeHandler()) + .setAllowedOrigins(allowedOrigins) + .withSockJS() + .setInterceptors(httpSessionHandshakeInterceptor()); + } + + @Bean + public HandshakeInterceptor httpSessionHandshakeInterceptor() { + return new HandshakeInterceptor() { + @Override + public boolean beforeHandshake( + ServerHttpRequest request, + ServerHttpResponse response, + WebSocketHandler wsHandler, + Map attributes + ) throws Exception { + if (request instanceof ServletServerHttpRequest) { + ServletServerHttpRequest servletRequest = (ServletServerHttpRequest) request; + attributes.put(IP_ADDRESS, servletRequest.getRemoteAddress()); + } + return true; + } + + @Override + public void afterHandshake( + ServerHttpRequest request, + ServerHttpResponse response, + WebSocketHandler wsHandler, + Exception exception + ) {} + }; + } + + private DefaultHandshakeHandler defaultHandshakeHandler() { + return new DefaultHandshakeHandler() { + @Override + protected Principal determineUser(ServerHttpRequest request, WebSocketHandler wsHandler, Map attributes) { + Principal principal = request.getPrincipal(); + if (principal == null) { + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS)); + principal = new AnonymousAuthenticationToken("WebsocketConfiguration", "anonymous", authorities); + } + return principal; + } + }; + } +} diff --git a/src/main/java/de/tum/cit/ase/config/WebsocketSecurityConfiguration.java b/src/main/java/de/tum/cit/ase/config/WebsocketSecurityConfiguration.java new file mode 100644 index 00000000..27052f17 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/WebsocketSecurityConfiguration.java @@ -0,0 +1,40 @@ +package de.tum.cit.ase.config; + +import de.tum.cit.ase.security.AuthoritiesConstants; +import org.springframework.context.annotation.Configuration; +import org.springframework.messaging.simp.SimpMessageType; +import org.springframework.security.config.annotation.web.messaging.MessageSecurityMetadataSourceRegistry; +import org.springframework.security.config.annotation.web.socket.AbstractSecurityWebSocketMessageBrokerConfigurer; + +@Configuration +public class WebsocketSecurityConfiguration extends AbstractSecurityWebSocketMessageBrokerConfigurer { + + @Override + protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) { + messages + .nullDestMatcher() + .authenticated() + .simpDestMatchers("/topic/tracker") + .hasAuthority(AuthoritiesConstants.ADMIN) + // matches any destination that starts with /topic/ + // (i.e. cannot send messages directly to /topic/) + // (i.e. cannot subscribe to /topic/messages/* to get messages sent to + // /topic/messages-user) + .simpDestMatchers("/topic/**") + .authenticated() + // message types other than MESSAGE and SUBSCRIBE + .simpTypeMatchers(SimpMessageType.MESSAGE, SimpMessageType.SUBSCRIBE) + .denyAll() + // catch all + .anyMessage() + .denyAll(); + } + + /** + * Disables CSRF for Websockets. + */ + @Override + protected boolean sameOriginDisabled() { + return true; + } +} diff --git a/src/main/java/de/tum/cit/ase/config/package-info.java b/src/main/java/de/tum/cit/ase/config/package-info.java new file mode 100644 index 00000000..53486df9 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/config/package-info.java @@ -0,0 +1,4 @@ +/** + * Application configuration. + */ +package de.tum.cit.ase.config; diff --git a/src/main/java/de/tum/cit/ase/domain/AbstractAuditingEntity.java b/src/main/java/de/tum/cit/ase/domain/AbstractAuditingEntity.java new file mode 100644 index 00000000..9a51f4cb --- /dev/null +++ b/src/main/java/de/tum/cit/ase/domain/AbstractAuditingEntity.java @@ -0,0 +1,75 @@ +package de.tum.cit.ase.domain; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import java.io.Serializable; +import java.time.Instant; +import org.springframework.data.annotation.CreatedBy; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedBy; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +/** + * Base abstract class for entities which will hold definitions for created, last modified, created by, + * last modified by attributes. + */ +@MappedSuperclass +@EntityListeners(AuditingEntityListener.class) +@JsonIgnoreProperties(value = { "createdBy", "createdDate", "lastModifiedBy", "lastModifiedDate" }, allowGetters = true) +public abstract class AbstractAuditingEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + public abstract T getId(); + + @CreatedBy + @Column(name = "created_by", nullable = false, length = 50, updatable = false) + private String createdBy; + + @CreatedDate + @Column(name = "created_date", updatable = false) + private Instant createdDate = Instant.now(); + + @LastModifiedBy + @Column(name = "last_modified_by", length = 50) + private String lastModifiedBy; + + @LastModifiedDate + @Column(name = "last_modified_date") + private Instant lastModifiedDate = Instant.now(); + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Instant createdDate) { + this.createdDate = createdDate; + } + + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + + public Instant getLastModifiedDate() { + return lastModifiedDate; + } + + public void setLastModifiedDate(Instant lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } +} diff --git a/src/main/java/de/tum/cit/ase/domain/Authority.java b/src/main/java/de/tum/cit/ase/domain/Authority.java new file mode 100644 index 00000000..3f2f4225 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/domain/Authority.java @@ -0,0 +1,58 @@ +package de.tum.cit.ase.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import java.io.Serializable; +import java.util.Objects; + +/** + * An authority (a security role) used by Spring Security. + */ +@Entity +@Table(name = "jhi_authority") +public class Authority implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotNull + @Size(max = 50) + @Id + @Column(length = 50) + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof Authority)) { + return false; + } + return Objects.equals(name, ((Authority) o).name); + } + + @Override + public int hashCode() { + return Objects.hashCode(name); + } + + // prettier-ignore + @Override + public String toString() { + return "Authority{" + + "name='" + name + '\'' + + "}"; + } +} diff --git a/src/main/java/de/tum/cit/ase/domain/User.java b/src/main/java/de/tum/cit/ase/domain/User.java new file mode 100644 index 00000000..d56ecf3a --- /dev/null +++ b/src/main/java/de/tum/cit/ase/domain/User.java @@ -0,0 +1,227 @@ +package de.tum.cit.ase.domain; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import de.tum.cit.ase.config.Constants; +import jakarta.persistence.*; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.Size; +import java.io.Serializable; +import java.time.Instant; +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; +import org.apache.commons.lang3.StringUtils; +import org.hibernate.annotations.BatchSize; + +/** + * A user. + */ +@Entity +@Table(name = "jhi_user") +public class User extends AbstractAuditingEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @NotNull + @Pattern(regexp = Constants.LOGIN_REGEX) + @Size(min = 1, max = 50) + @Column(length = 50, unique = true, nullable = false) + private String login; + + @JsonIgnore + @NotNull + @Size(min = 60, max = 60) + @Column(name = "password_hash", length = 60, nullable = false) + private String password; + + @Size(max = 50) + @Column(name = "first_name", length = 50) + private String firstName; + + @Size(max = 50) + @Column(name = "last_name", length = 50) + private String lastName; + + @Email + @Size(min = 5, max = 254) + @Column(length = 254, unique = true) + private String email; + + @NotNull + @Column(nullable = false) + private boolean activated = false; + + @Size(min = 2, max = 10) + @Column(name = "lang_key", length = 10) + private String langKey; + + @Size(max = 256) + @Column(name = "image_url", length = 256) + private String imageUrl; + + @Size(max = 20) + @Column(name = "activation_key", length = 20) + @JsonIgnore + private String activationKey; + + @Size(max = 20) + @Column(name = "reset_key", length = 20) + @JsonIgnore + private String resetKey; + + @Column(name = "reset_date") + private Instant resetDate = null; + + @JsonIgnore + @ManyToMany + @JoinTable( + name = "jhi_user_authority", + joinColumns = { @JoinColumn(name = "user_id", referencedColumnName = "id") }, + inverseJoinColumns = { @JoinColumn(name = "authority_name", referencedColumnName = "name") } + ) + @BatchSize(size = 20) + private Set authorities = new HashSet<>(); + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLogin() { + return login; + } + + // Lowercase the login before saving it in database + public void setLogin(String login) { + this.login = StringUtils.lowerCase(login, Locale.ENGLISH); + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public boolean isActivated() { + return activated; + } + + public void setActivated(boolean activated) { + this.activated = activated; + } + + public String getActivationKey() { + return activationKey; + } + + public void setActivationKey(String activationKey) { + this.activationKey = activationKey; + } + + public String getResetKey() { + return resetKey; + } + + public void setResetKey(String resetKey) { + this.resetKey = resetKey; + } + + public Instant getResetDate() { + return resetDate; + } + + public void setResetDate(Instant resetDate) { + this.resetDate = resetDate; + } + + public String getLangKey() { + return langKey; + } + + public void setLangKey(String langKey) { + this.langKey = langKey; + } + + public Set getAuthorities() { + return authorities; + } + + public void setAuthorities(Set authorities) { + this.authorities = authorities; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof User)) { + return false; + } + return id != null && id.equals(((User) o).id); + } + + @Override + public int hashCode() { + // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/ + return getClass().hashCode(); + } + + // prettier-ignore + @Override + public String toString() { + return "User{" + + "login='" + login + '\'' + + ", firstName='" + firstName + '\'' + + ", lastName='" + lastName + '\'' + + ", email='" + email + '\'' + + ", imageUrl='" + imageUrl + '\'' + + ", activated='" + activated + '\'' + + ", langKey='" + langKey + '\'' + + ", activationKey='" + activationKey + '\'' + + "}"; + } +} diff --git a/src/main/java/de/tum/cit/ase/domain/package-info.java b/src/main/java/de/tum/cit/ase/domain/package-info.java new file mode 100644 index 00000000..cec8ee43 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/domain/package-info.java @@ -0,0 +1,4 @@ +/** + * Domain objects. + */ +package de.tum.cit.ase.domain; diff --git a/src/main/java/de/tum/cit/ase/management/SecurityMetersService.java b/src/main/java/de/tum/cit/ase/management/SecurityMetersService.java new file mode 100644 index 00000000..522b2014 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/management/SecurityMetersService.java @@ -0,0 +1,51 @@ +package de.tum.cit.ase.management; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import org.springframework.stereotype.Service; + +@Service +public class SecurityMetersService { + + public static final String INVALID_TOKENS_METER_NAME = "security.authentication.invalid-tokens"; + public static final String INVALID_TOKENS_METER_DESCRIPTION = + "Indicates validation error count of the tokens presented by the clients."; + public static final String INVALID_TOKENS_METER_BASE_UNIT = "errors"; + public static final String INVALID_TOKENS_METER_CAUSE_DIMENSION = "cause"; + + private final Counter tokenInvalidSignatureCounter; + private final Counter tokenExpiredCounter; + private final Counter tokenUnsupportedCounter; + private final Counter tokenMalformedCounter; + + public SecurityMetersService(MeterRegistry registry) { + this.tokenInvalidSignatureCounter = invalidTokensCounterForCauseBuilder("invalid-signature").register(registry); + this.tokenExpiredCounter = invalidTokensCounterForCauseBuilder("expired").register(registry); + this.tokenUnsupportedCounter = invalidTokensCounterForCauseBuilder("unsupported").register(registry); + this.tokenMalformedCounter = invalidTokensCounterForCauseBuilder("malformed").register(registry); + } + + private Counter.Builder invalidTokensCounterForCauseBuilder(String cause) { + return Counter + .builder(INVALID_TOKENS_METER_NAME) + .baseUnit(INVALID_TOKENS_METER_BASE_UNIT) + .description(INVALID_TOKENS_METER_DESCRIPTION) + .tag(INVALID_TOKENS_METER_CAUSE_DIMENSION, cause); + } + + public void trackTokenInvalidSignature() { + this.tokenInvalidSignatureCounter.increment(); + } + + public void trackTokenExpired() { + this.tokenExpiredCounter.increment(); + } + + public void trackTokenUnsupported() { + this.tokenUnsupportedCounter.increment(); + } + + public void trackTokenMalformed() { + this.tokenMalformedCounter.increment(); + } +} diff --git a/src/main/java/de/tum/cit/ase/management/package-info.java b/src/main/java/de/tum/cit/ase/management/package-info.java new file mode 100644 index 00000000..c66120d5 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/management/package-info.java @@ -0,0 +1,4 @@ +/** + * Application management. + */ +package de.tum.cit.ase.management; diff --git a/src/main/java/de/tum/cit/ase/package-info.java b/src/main/java/de/tum/cit/ase/package-info.java new file mode 100644 index 00000000..ea1aa43e --- /dev/null +++ b/src/main/java/de/tum/cit/ase/package-info.java @@ -0,0 +1,4 @@ +/** + * Application root. + */ +package de.tum.cit.ase; diff --git a/src/main/java/de/tum/cit/ase/repository/AuthorityRepository.java b/src/main/java/de/tum/cit/ase/repository/AuthorityRepository.java new file mode 100644 index 00000000..fea8c5de --- /dev/null +++ b/src/main/java/de/tum/cit/ase/repository/AuthorityRepository.java @@ -0,0 +1,9 @@ +package de.tum.cit.ase.repository; + +import de.tum.cit.ase.domain.Authority; +import org.springframework.data.jpa.repository.JpaRepository; + +/** + * Spring Data JPA repository for the {@link Authority} entity. + */ +public interface AuthorityRepository extends JpaRepository {} diff --git a/src/main/java/de/tum/cit/ase/repository/UserRepository.java b/src/main/java/de/tum/cit/ase/repository/UserRepository.java new file mode 100644 index 00000000..19609ace --- /dev/null +++ b/src/main/java/de/tum/cit/ase/repository/UserRepository.java @@ -0,0 +1,36 @@ +package de.tum.cit.ase.repository; + +import de.tum.cit.ase.domain.User; +import java.time.Instant; +import java.util.List; +import java.util.Optional; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.*; +import org.springframework.data.jpa.repository.EntityGraph; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Spring Data JPA repository for the {@link User} entity. + */ +@Repository +public interface UserRepository extends JpaRepository { + String USERS_BY_LOGIN_CACHE = "usersByLogin"; + + String USERS_BY_EMAIL_CACHE = "usersByEmail"; + Optional findOneByActivationKey(String activationKey); + List findAllByActivatedIsFalseAndActivationKeyIsNotNullAndCreatedDateBefore(Instant dateTime); + Optional findOneByResetKey(String resetKey); + Optional findOneByEmailIgnoreCase(String email); + Optional findOneByLogin(String login); + + @EntityGraph(attributePaths = "authorities") + @Cacheable(cacheNames = USERS_BY_LOGIN_CACHE) + Optional findOneWithAuthoritiesByLogin(String login); + + @EntityGraph(attributePaths = "authorities") + @Cacheable(cacheNames = USERS_BY_EMAIL_CACHE) + Optional findOneWithAuthoritiesByEmailIgnoreCase(String email); + + Page findAllByIdNotNullAndActivatedIsTrue(Pageable pageable); +} diff --git a/src/main/java/de/tum/cit/ase/repository/package-info.java b/src/main/java/de/tum/cit/ase/repository/package-info.java new file mode 100644 index 00000000..47f3fb1e --- /dev/null +++ b/src/main/java/de/tum/cit/ase/repository/package-info.java @@ -0,0 +1,4 @@ +/** + * Repository layer. + */ +package de.tum.cit.ase.repository; diff --git a/src/main/java/de/tum/cit/ase/security/AuthoritiesConstants.java b/src/main/java/de/tum/cit/ase/security/AuthoritiesConstants.java new file mode 100644 index 00000000..5139a85e --- /dev/null +++ b/src/main/java/de/tum/cit/ase/security/AuthoritiesConstants.java @@ -0,0 +1,15 @@ +package de.tum.cit.ase.security; + +/** + * Constants for Spring Security authorities. + */ +public final class AuthoritiesConstants { + + public static final String ADMIN = "ROLE_ADMIN"; + + public static final String USER = "ROLE_USER"; + + public static final String ANONYMOUS = "ROLE_ANONYMOUS"; + + private AuthoritiesConstants() {} +} diff --git a/src/main/java/de/tum/cit/ase/security/DomainUserDetailsService.java b/src/main/java/de/tum/cit/ase/security/DomainUserDetailsService.java new file mode 100644 index 00000000..a4ef8411 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/security/DomainUserDetailsService.java @@ -0,0 +1,62 @@ +package de.tum.cit.ase.security; + +import de.tum.cit.ase.domain.Authority; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.UserRepository; +import java.util.*; +import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +/** + * Authenticate a user from the database. + */ +@Component("userDetailsService") +public class DomainUserDetailsService implements UserDetailsService { + + private final Logger log = LoggerFactory.getLogger(DomainUserDetailsService.class); + + private final UserRepository userRepository; + + public DomainUserDetailsService(UserRepository userRepository) { + this.userRepository = userRepository; + } + + @Override + @Transactional(readOnly = true) + public UserDetails loadUserByUsername(final String login) { + log.debug("Authenticating {}", login); + + if (new EmailValidator().isValid(login, null)) { + return userRepository + .findOneWithAuthoritiesByEmailIgnoreCase(login) + .map(user -> createSpringSecurityUser(login, user)) + .orElseThrow(() -> new UsernameNotFoundException("User with email " + login + " was not found in the database")); + } + + String lowercaseLogin = login.toLowerCase(Locale.ENGLISH); + return userRepository + .findOneWithAuthoritiesByLogin(lowercaseLogin) + .map(user -> createSpringSecurityUser(lowercaseLogin, user)) + .orElseThrow(() -> new UsernameNotFoundException("User " + lowercaseLogin + " was not found in the database")); + } + + private org.springframework.security.core.userdetails.User createSpringSecurityUser(String lowercaseLogin, User user) { + if (!user.isActivated()) { + throw new UserNotActivatedException("User " + lowercaseLogin + " was not activated"); + } + List grantedAuthorities = user + .getAuthorities() + .stream() + .map(Authority::getName) + .map(SimpleGrantedAuthority::new) + .toList(); + return new org.springframework.security.core.userdetails.User(user.getLogin(), user.getPassword(), grantedAuthorities); + } +} diff --git a/src/main/java/de/tum/cit/ase/security/SecurityUtils.java b/src/main/java/de/tum/cit/ase/security/SecurityUtils.java new file mode 100644 index 00000000..d1dce847 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/security/SecurityUtils.java @@ -0,0 +1,107 @@ +package de.tum.cit.ase.security; + +import java.util.Arrays; +import java.util.Optional; +import java.util.stream.Stream; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +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.oauth2.jose.jws.MacAlgorithm; +import org.springframework.security.oauth2.jwt.Jwt; + +/** + * Utility class for Spring Security. + */ +public final class SecurityUtils { + + public static final MacAlgorithm JWT_ALGORITHM = MacAlgorithm.HS512; + + public static final String AUTHORITIES_KEY = "auth"; + + private SecurityUtils() {} + + /** + * Get the login of the current user. + * + * @return the login of the current user. + */ + public static Optional getCurrentUserLogin() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional.ofNullable(extractPrincipal(securityContext.getAuthentication())); + } + + private static String extractPrincipal(Authentication authentication) { + if (authentication == null) { + return null; + } else if (authentication.getPrincipal() instanceof UserDetails springSecurityUser) { + return springSecurityUser.getUsername(); + } else if (authentication.getPrincipal() instanceof Jwt jwt) { + return jwt.getSubject(); + } else if (authentication.getPrincipal() instanceof String s) { + return s; + } + return null; + } + + /** + * Get the JWT of the current user. + * + * @return the JWT of the current user. + */ + public static Optional getCurrentUserJWT() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + return Optional + .ofNullable(securityContext.getAuthentication()) + .filter(authentication -> authentication.getCredentials() instanceof String) + .map(authentication -> (String) authentication.getCredentials()); + } + + /** + * Check if a user is authenticated. + * + * @return true if the user is authenticated, false otherwise. + */ + public static boolean isAuthenticated() { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + return authentication != null && getAuthorities(authentication).noneMatch(AuthoritiesConstants.ANONYMOUS::equals); + } + + /** + * Checks if the current user has any of the authorities. + * + * @param authorities the authorities to check. + * @return true if the current user has any of the authorities, false otherwise. + */ + public static boolean hasCurrentUserAnyOfAuthorities(String... authorities) { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + return ( + authentication != null && getAuthorities(authentication).anyMatch(authority -> Arrays.asList(authorities).contains(authority)) + ); + } + + /** + * Checks if the current user has none of the authorities. + * + * @param authorities the authorities to check. + * @return true if the current user has none of the authorities, false otherwise. + */ + public static boolean hasCurrentUserNoneOfAuthorities(String... authorities) { + return !hasCurrentUserAnyOfAuthorities(authorities); + } + + /** + * Checks if the current user has a specific authority. + * + * @param authority the authority to check. + * @return true if the current user has the authority, false otherwise. + */ + public static boolean hasCurrentUserThisAuthority(String authority) { + return hasCurrentUserAnyOfAuthorities(authority); + } + + private static Stream getAuthorities(Authentication authentication) { + return authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority); + } +} diff --git a/src/main/java/de/tum/cit/ase/security/SpringSecurityAuditorAware.java b/src/main/java/de/tum/cit/ase/security/SpringSecurityAuditorAware.java new file mode 100644 index 00000000..5a9500e6 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/security/SpringSecurityAuditorAware.java @@ -0,0 +1,18 @@ +package de.tum.cit.ase.security; + +import de.tum.cit.ase.config.Constants; +import java.util.Optional; +import org.springframework.data.domain.AuditorAware; +import org.springframework.stereotype.Component; + +/** + * Implementation of {@link AuditorAware} based on Spring Security. + */ +@Component +public class SpringSecurityAuditorAware implements AuditorAware { + + @Override + public Optional getCurrentAuditor() { + return Optional.of(SecurityUtils.getCurrentUserLogin().orElse(Constants.SYSTEM)); + } +} diff --git a/src/main/java/de/tum/cit/ase/security/UserNotActivatedException.java b/src/main/java/de/tum/cit/ase/security/UserNotActivatedException.java new file mode 100644 index 00000000..5c53b04b --- /dev/null +++ b/src/main/java/de/tum/cit/ase/security/UserNotActivatedException.java @@ -0,0 +1,19 @@ +package de.tum.cit.ase.security; + +import org.springframework.security.core.AuthenticationException; + +/** + * This exception is thrown in case of a not activated user trying to authenticate. + */ +public class UserNotActivatedException extends AuthenticationException { + + private static final long serialVersionUID = 1L; + + public UserNotActivatedException(String message) { + super(message); + } + + public UserNotActivatedException(String message, Throwable t) { + super(message, t); + } +} diff --git a/src/main/java/de/tum/cit/ase/security/package-info.java b/src/main/java/de/tum/cit/ase/security/package-info.java new file mode 100644 index 00000000..f5afd67e --- /dev/null +++ b/src/main/java/de/tum/cit/ase/security/package-info.java @@ -0,0 +1,4 @@ +/** + * Application security utilities. + */ +package de.tum.cit.ase.security; diff --git a/src/main/java/de/tum/cit/ase/service/EmailAlreadyUsedException.java b/src/main/java/de/tum/cit/ase/service/EmailAlreadyUsedException.java new file mode 100644 index 00000000..76734507 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/EmailAlreadyUsedException.java @@ -0,0 +1,10 @@ +package de.tum.cit.ase.service; + +public class EmailAlreadyUsedException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public EmailAlreadyUsedException() { + super("Email is already in use!"); + } +} diff --git a/src/main/java/de/tum/cit/ase/service/InvalidPasswordException.java b/src/main/java/de/tum/cit/ase/service/InvalidPasswordException.java new file mode 100644 index 00000000..f874b13a --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/InvalidPasswordException.java @@ -0,0 +1,10 @@ +package de.tum.cit.ase.service; + +public class InvalidPasswordException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public InvalidPasswordException() { + super("Incorrect password"); + } +} diff --git a/src/main/java/de/tum/cit/ase/service/MailService.java b/src/main/java/de/tum/cit/ase/service/MailService.java new file mode 100644 index 00000000..a33b673f --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/MailService.java @@ -0,0 +1,118 @@ +package de.tum.cit.ase.service; + +import de.tum.cit.ase.domain.User; +import jakarta.mail.MessagingException; +import jakarta.mail.internet.MimeMessage; +import java.nio.charset.StandardCharsets; +import java.util.Locale; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Lazy; +import org.springframework.mail.MailException; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.thymeleaf.context.Context; +import org.thymeleaf.spring6.SpringTemplateEngine; +import tech.jhipster.config.JHipsterProperties; + +/** + * Service for sending emails. + *

+ * We use the {@link Async} annotation to send emails asynchronously. + */ +@Service +public class MailService { + + private final Logger log = LoggerFactory.getLogger(MailService.class); + + private static final String USER = "user"; + + private static final String BASE_URL = "baseUrl"; + + private final JHipsterProperties jHipsterProperties; + + private final JavaMailSender javaMailSender; + + private final MessageSource messageSource; + + private final SpringTemplateEngine templateEngine; + + @Autowired + @Lazy + private MailService self; + + public MailService( + JHipsterProperties jHipsterProperties, + JavaMailSender javaMailSender, + MessageSource messageSource, + SpringTemplateEngine templateEngine + ) { + this.jHipsterProperties = jHipsterProperties; + this.javaMailSender = javaMailSender; + this.messageSource = messageSource; + this.templateEngine = templateEngine; + } + + @Async + public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) { + log.debug( + "Send email[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}", + isMultipart, + isHtml, + to, + subject, + content + ); + + // Prepare message using a Spring helper + MimeMessage mimeMessage = javaMailSender.createMimeMessage(); + try { + MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, StandardCharsets.UTF_8.name()); + message.setTo(to); + message.setFrom(jHipsterProperties.getMail().getFrom()); + message.setSubject(subject); + message.setText(content, isHtml); + javaMailSender.send(mimeMessage); + log.debug("Sent email to User '{}'", to); + } catch (MailException | MessagingException e) { + log.warn("Email could not be sent to user '{}'", to, e); + } + } + + @Async + public void sendEmailFromTemplate(User user, String templateName, String titleKey) { + if (user.getEmail() == null) { + log.debug("Email doesn't exist for user '{}'", user.getLogin()); + return; + } + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable(USER, user); + context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl()); + String content = templateEngine.process(templateName, context); + String subject = messageSource.getMessage(titleKey, null, locale); + self.sendEmail(user.getEmail(), subject, content, false, true); + } + + @Async + public void sendActivationEmail(User user) { + log.debug("Sending activation email to '{}'", user.getEmail()); + self.sendEmailFromTemplate(user, "mail/activationEmail", "email.activation.title"); + } + + @Async + public void sendCreationEmail(User user) { + log.debug("Sending creation email to '{}'", user.getEmail()); + self.sendEmailFromTemplate(user, "mail/creationEmail", "email.activation.title"); + } + + @Async + public void sendPasswordResetMail(User user) { + log.debug("Sending password reset email to '{}'", user.getEmail()); + self.sendEmailFromTemplate(user, "mail/passwordResetEmail", "email.reset.title"); + } +} diff --git a/src/main/java/de/tum/cit/ase/service/UserService.java b/src/main/java/de/tum/cit/ase/service/UserService.java new file mode 100644 index 00000000..11474503 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/UserService.java @@ -0,0 +1,327 @@ +package de.tum.cit.ase.service; + +import de.tum.cit.ase.config.Constants; +import de.tum.cit.ase.domain.Authority; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.AuthorityRepository; +import de.tum.cit.ase.repository.UserRepository; +import de.tum.cit.ase.security.AuthoritiesConstants; +import de.tum.cit.ase.security.SecurityUtils; +import de.tum.cit.ase.service.dto.AdminUserDTO; +import de.tum.cit.ase.service.dto.UserDTO; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.cache.CacheManager; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import tech.jhipster.security.RandomUtil; + +/** + * Service class for managing users. + */ +@Service +@Transactional +public class UserService { + + private final Logger log = LoggerFactory.getLogger(UserService.class); + + private final UserRepository userRepository; + + private final PasswordEncoder passwordEncoder; + + private final AuthorityRepository authorityRepository; + + private final CacheManager cacheManager; + + public UserService( + UserRepository userRepository, + PasswordEncoder passwordEncoder, + AuthorityRepository authorityRepository, + CacheManager cacheManager + ) { + this.userRepository = userRepository; + this.passwordEncoder = passwordEncoder; + this.authorityRepository = authorityRepository; + this.cacheManager = cacheManager; + } + + public Optional activateRegistration(String key) { + log.debug("Activating user for activation key {}", key); + return userRepository + .findOneByActivationKey(key) + .map(user -> { + // activate given user for the registration key. + user.setActivated(true); + user.setActivationKey(null); + this.clearUserCaches(user); + log.debug("Activated user: {}", user); + return user; + }); + } + + public Optional completePasswordReset(String newPassword, String key) { + log.debug("Reset user password for reset key {}", key); + return userRepository + .findOneByResetKey(key) + .filter(user -> user.getResetDate().isAfter(Instant.now().minus(1, ChronoUnit.DAYS))) + .map(user -> { + user.setPassword(passwordEncoder.encode(newPassword)); + user.setResetKey(null); + user.setResetDate(null); + this.clearUserCaches(user); + return user; + }); + } + + public Optional requestPasswordReset(String mail) { + return userRepository + .findOneByEmailIgnoreCase(mail) + .filter(User::isActivated) + .map(user -> { + user.setResetKey(RandomUtil.generateResetKey()); + user.setResetDate(Instant.now()); + this.clearUserCaches(user); + return user; + }); + } + + public User registerUser(AdminUserDTO userDTO, String password) { + userRepository + .findOneByLogin(userDTO.getLogin().toLowerCase()) + .ifPresent(existingUser -> { + boolean removed = removeNonActivatedUser(existingUser); + if (!removed) { + throw new UsernameAlreadyUsedException(); + } + }); + userRepository + .findOneByEmailIgnoreCase(userDTO.getEmail()) + .ifPresent(existingUser -> { + boolean removed = removeNonActivatedUser(existingUser); + if (!removed) { + throw new EmailAlreadyUsedException(); + } + }); + User newUser = new User(); + String encryptedPassword = passwordEncoder.encode(password); + newUser.setLogin(userDTO.getLogin().toLowerCase()); + // new user gets initially a generated password + newUser.setPassword(encryptedPassword); + newUser.setFirstName(userDTO.getFirstName()); + newUser.setLastName(userDTO.getLastName()); + if (userDTO.getEmail() != null) { + newUser.setEmail(userDTO.getEmail().toLowerCase()); + } + newUser.setImageUrl(userDTO.getImageUrl()); + newUser.setLangKey(userDTO.getLangKey()); + // new user is not active + newUser.setActivated(false); + // new user gets registration key + newUser.setActivationKey(RandomUtil.generateActivationKey()); + Set authorities = new HashSet<>(); + authorityRepository.findById(AuthoritiesConstants.USER).ifPresent(authorities::add); + newUser.setAuthorities(authorities); + userRepository.save(newUser); + this.clearUserCaches(newUser); + log.debug("Created Information for User: {}", newUser); + return newUser; + } + + private boolean removeNonActivatedUser(User existingUser) { + if (existingUser.isActivated()) { + return false; + } + userRepository.delete(existingUser); + userRepository.flush(); + this.clearUserCaches(existingUser); + return true; + } + + public User createUser(AdminUserDTO userDTO) { + User user = new User(); + user.setLogin(userDTO.getLogin().toLowerCase()); + user.setFirstName(userDTO.getFirstName()); + user.setLastName(userDTO.getLastName()); + if (userDTO.getEmail() != null) { + user.setEmail(userDTO.getEmail().toLowerCase()); + } + user.setImageUrl(userDTO.getImageUrl()); + if (userDTO.getLangKey() == null) { + user.setLangKey(Constants.DEFAULT_LANGUAGE); // default language + } else { + user.setLangKey(userDTO.getLangKey()); + } + String encryptedPassword = passwordEncoder.encode(RandomUtil.generatePassword()); + user.setPassword(encryptedPassword); + user.setResetKey(RandomUtil.generateResetKey()); + user.setResetDate(Instant.now()); + user.setActivated(true); + if (userDTO.getAuthorities() != null) { + Set authorities = userDTO + .getAuthorities() + .stream() + .map(authorityRepository::findById) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toSet()); + user.setAuthorities(authorities); + } + userRepository.save(user); + this.clearUserCaches(user); + log.debug("Created Information for User: {}", user); + return user; + } + + /** + * Update all information for a specific user, and return the modified user. + * + * @param userDTO user to update. + * @return updated user. + */ + public Optional updateUser(AdminUserDTO userDTO) { + return Optional + .of(userRepository.findById(userDTO.getId())) + .filter(Optional::isPresent) + .map(Optional::get) + .map(user -> { + this.clearUserCaches(user); + user.setLogin(userDTO.getLogin().toLowerCase()); + user.setFirstName(userDTO.getFirstName()); + user.setLastName(userDTO.getLastName()); + if (userDTO.getEmail() != null) { + user.setEmail(userDTO.getEmail().toLowerCase()); + } + user.setImageUrl(userDTO.getImageUrl()); + user.setActivated(userDTO.isActivated()); + user.setLangKey(userDTO.getLangKey()); + Set managedAuthorities = user.getAuthorities(); + managedAuthorities.clear(); + userDTO + .getAuthorities() + .stream() + .map(authorityRepository::findById) + .filter(Optional::isPresent) + .map(Optional::get) + .forEach(managedAuthorities::add); + userRepository.save(user); + this.clearUserCaches(user); + log.debug("Changed Information for User: {}", user); + return user; + }) + .map(AdminUserDTO::new); + } + + public void deleteUser(String login) { + userRepository + .findOneByLogin(login) + .ifPresent(user -> { + userRepository.delete(user); + this.clearUserCaches(user); + log.debug("Deleted User: {}", user); + }); + } + + /** + * Update basic information (first name, last name, email, language) for the current user. + * + * @param firstName first name of user. + * @param lastName last name of user. + * @param email email id of user. + * @param langKey language key. + * @param imageUrl image URL of user. + */ + public void updateUser(String firstName, String lastName, String email, String langKey, String imageUrl) { + SecurityUtils + .getCurrentUserLogin() + .flatMap(userRepository::findOneByLogin) + .ifPresent(user -> { + user.setFirstName(firstName); + user.setLastName(lastName); + if (email != null) { + user.setEmail(email.toLowerCase()); + } + user.setLangKey(langKey); + user.setImageUrl(imageUrl); + userRepository.save(user); + this.clearUserCaches(user); + log.debug("Changed Information for User: {}", user); + }); + } + + @Transactional + public void changePassword(String currentClearTextPassword, String newPassword) { + SecurityUtils + .getCurrentUserLogin() + .flatMap(userRepository::findOneByLogin) + .ifPresent(user -> { + String currentEncryptedPassword = user.getPassword(); + if (!passwordEncoder.matches(currentClearTextPassword, currentEncryptedPassword)) { + throw new InvalidPasswordException(); + } + String encryptedPassword = passwordEncoder.encode(newPassword); + user.setPassword(encryptedPassword); + this.clearUserCaches(user); + log.debug("Changed password for User: {}", user); + }); + } + + @Transactional(readOnly = true) + public Page getAllManagedUsers(Pageable pageable) { + return userRepository.findAll(pageable).map(AdminUserDTO::new); + } + + @Transactional(readOnly = true) + public Page getAllPublicUsers(Pageable pageable) { + return userRepository.findAllByIdNotNullAndActivatedIsTrue(pageable).map(UserDTO::new); + } + + @Transactional(readOnly = true) + public Optional getUserWithAuthoritiesByLogin(String login) { + return userRepository.findOneWithAuthoritiesByLogin(login); + } + + @Transactional(readOnly = true) + public Optional getUserWithAuthorities() { + return SecurityUtils.getCurrentUserLogin().flatMap(userRepository::findOneWithAuthoritiesByLogin); + } + + /** + * Not activated users should be automatically deleted after 3 days. + *

+ * This is scheduled to get fired everyday, at 01:00 (am). + */ + @Scheduled(cron = "0 0 1 * * ?") + public void removeNotActivatedUsers() { + userRepository + .findAllByActivatedIsFalseAndActivationKeyIsNotNullAndCreatedDateBefore(Instant.now().minus(3, ChronoUnit.DAYS)) + .forEach(user -> { + log.debug("Deleting not activated user {}", user.getLogin()); + userRepository.delete(user); + this.clearUserCaches(user); + }); + } + + /** + * Gets a list of all the authorities. + * @return a list of all the authorities. + */ + @Transactional(readOnly = true) + public List getAuthorities() { + return authorityRepository.findAll().stream().map(Authority::getName).toList(); + } + + private void clearUserCaches(User user) { + Objects.requireNonNull(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE)).evict(user.getLogin()); + if (user.getEmail() != null) { + Objects.requireNonNull(cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE)).evict(user.getEmail()); + } + } +} diff --git a/src/main/java/de/tum/cit/ase/service/UsernameAlreadyUsedException.java b/src/main/java/de/tum/cit/ase/service/UsernameAlreadyUsedException.java new file mode 100644 index 00000000..3f96d3d5 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/UsernameAlreadyUsedException.java @@ -0,0 +1,10 @@ +package de.tum.cit.ase.service; + +public class UsernameAlreadyUsedException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public UsernameAlreadyUsedException() { + super("Login name already used!"); + } +} diff --git a/src/main/java/de/tum/cit/ase/service/dto/AdminUserDTO.java b/src/main/java/de/tum/cit/ase/service/dto/AdminUserDTO.java new file mode 100644 index 00000000..3399d107 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/dto/AdminUserDTO.java @@ -0,0 +1,196 @@ +package de.tum.cit.ase.service.dto; + +import de.tum.cit.ase.config.Constants; +import de.tum.cit.ase.domain.Authority; +import de.tum.cit.ase.domain.User; +import jakarta.validation.constraints.*; +import java.io.Serializable; +import java.time.Instant; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * A DTO representing a user, with his authorities. + */ +public class AdminUserDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + @NotBlank + @Pattern(regexp = Constants.LOGIN_REGEX) + @Size(min = 1, max = 50) + private String login; + + @Size(max = 50) + private String firstName; + + @Size(max = 50) + private String lastName; + + @Email + @Size(min = 5, max = 254) + private String email; + + @Size(max = 256) + private String imageUrl; + + private boolean activated = false; + + @Size(min = 2, max = 10) + private String langKey; + + private String createdBy; + + private Instant createdDate; + + private String lastModifiedBy; + + private Instant lastModifiedDate; + + private Set authorities; + + public AdminUserDTO() { + // Empty constructor needed for Jackson. + } + + public AdminUserDTO(User user) { + this.id = user.getId(); + this.login = user.getLogin(); + this.firstName = user.getFirstName(); + this.lastName = user.getLastName(); + this.email = user.getEmail(); + this.activated = user.isActivated(); + this.imageUrl = user.getImageUrl(); + this.langKey = user.getLangKey(); + this.createdBy = user.getCreatedBy(); + this.createdDate = user.getCreatedDate(); + this.lastModifiedBy = user.getLastModifiedBy(); + this.lastModifiedDate = user.getLastModifiedDate(); + this.authorities = user.getAuthorities().stream().map(Authority::getName).collect(Collectors.toSet()); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + public boolean isActivated() { + return activated; + } + + public void setActivated(boolean activated) { + this.activated = activated; + } + + public String getLangKey() { + return langKey; + } + + public void setLangKey(String langKey) { + this.langKey = langKey; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Instant getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Instant createdDate) { + this.createdDate = createdDate; + } + + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + + public Instant getLastModifiedDate() { + return lastModifiedDate; + } + + public void setLastModifiedDate(Instant lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + } + + public Set getAuthorities() { + return authorities; + } + + public void setAuthorities(Set authorities) { + this.authorities = authorities; + } + + // prettier-ignore + @Override + public String toString() { + return "AdminUserDTO{" + + "login='" + login + '\'' + + ", firstName='" + firstName + '\'' + + ", lastName='" + lastName + '\'' + + ", email='" + email + '\'' + + ", imageUrl='" + imageUrl + '\'' + + ", activated=" + activated + + ", langKey='" + langKey + '\'' + + ", createdBy=" + createdBy + + ", createdDate=" + createdDate + + ", lastModifiedBy='" + lastModifiedBy + '\'' + + ", lastModifiedDate=" + lastModifiedDate + + ", authorities=" + authorities + + "}"; + } +} diff --git a/src/main/java/de/tum/cit/ase/service/dto/PasswordChangeDTO.java b/src/main/java/de/tum/cit/ase/service/dto/PasswordChangeDTO.java new file mode 100644 index 00000000..c07d66b7 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/dto/PasswordChangeDTO.java @@ -0,0 +1,39 @@ +package de.tum.cit.ase.service.dto; + +import java.io.Serializable; + +/** + * A DTO representing a password change required data - current and new password. + */ +public class PasswordChangeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String currentPassword; + private String newPassword; + + public PasswordChangeDTO() { + // Empty constructor needed for Jackson. + } + + public PasswordChangeDTO(String currentPassword, String newPassword) { + this.currentPassword = currentPassword; + this.newPassword = newPassword; + } + + public String getCurrentPassword() { + return currentPassword; + } + + public void setCurrentPassword(String currentPassword) { + this.currentPassword = currentPassword; + } + + public String getNewPassword() { + return newPassword; + } + + public void setNewPassword(String newPassword) { + this.newPassword = newPassword; + } +} diff --git a/src/main/java/de/tum/cit/ase/service/dto/UserDTO.java b/src/main/java/de/tum/cit/ase/service/dto/UserDTO.java new file mode 100644 index 00000000..2340538c --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/dto/UserDTO.java @@ -0,0 +1,51 @@ +package de.tum.cit.ase.service.dto; + +import de.tum.cit.ase.domain.User; +import java.io.Serializable; + +/** + * A DTO representing a user, with only the public attributes. + */ +public class UserDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long id; + + private String login; + + public UserDTO() { + // Empty constructor needed for Jackson. + } + + public UserDTO(User user) { + this.id = user.getId(); + // Customize it here if you need, or not, firstName/lastName/etc + this.login = user.getLogin(); + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + // prettier-ignore + @Override + public String toString() { + return "UserDTO{" + + "id='" + id + '\'' + + ", login='" + login + '\'' + + "}"; + } +} diff --git a/src/main/java/de/tum/cit/ase/service/dto/package-info.java b/src/main/java/de/tum/cit/ase/service/dto/package-info.java new file mode 100644 index 00000000..09104fcf --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/dto/package-info.java @@ -0,0 +1,4 @@ +/** + * Data transfer objects for rest mapping. + */ +package de.tum.cit.ase.service.dto; diff --git a/src/main/java/de/tum/cit/ase/service/mapper/UserMapper.java b/src/main/java/de/tum/cit/ase/service/mapper/UserMapper.java new file mode 100644 index 00000000..48d96fab --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/mapper/UserMapper.java @@ -0,0 +1,147 @@ +package de.tum.cit.ase.service.mapper; + +import de.tum.cit.ase.domain.Authority; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.service.dto.AdminUserDTO; +import de.tum.cit.ase.service.dto.UserDTO; +import java.util.*; +import java.util.stream.Collectors; +import org.mapstruct.BeanMapping; +import org.mapstruct.Mapping; +import org.mapstruct.Named; +import org.springframework.stereotype.Service; + +/** + * Mapper for the entity {@link User} and its DTO called {@link UserDTO}. + * + * Normal mappers are generated using MapStruct, this one is hand-coded as MapStruct + * support is still in beta, and requires a manual step with an IDE. + */ +@Service +public class UserMapper { + + public List usersToUserDTOs(List users) { + return users.stream().filter(Objects::nonNull).map(this::userToUserDTO).toList(); + } + + public UserDTO userToUserDTO(User user) { + return new UserDTO(user); + } + + public List usersToAdminUserDTOs(List users) { + return users.stream().filter(Objects::nonNull).map(this::userToAdminUserDTO).toList(); + } + + public AdminUserDTO userToAdminUserDTO(User user) { + return new AdminUserDTO(user); + } + + public List userDTOsToUsers(List userDTOs) { + return userDTOs.stream().filter(Objects::nonNull).map(this::userDTOToUser).toList(); + } + + public User userDTOToUser(AdminUserDTO userDTO) { + if (userDTO == null) { + return null; + } else { + User user = new User(); + user.setId(userDTO.getId()); + user.setLogin(userDTO.getLogin()); + user.setFirstName(userDTO.getFirstName()); + user.setLastName(userDTO.getLastName()); + user.setEmail(userDTO.getEmail()); + user.setImageUrl(userDTO.getImageUrl()); + user.setActivated(userDTO.isActivated()); + user.setLangKey(userDTO.getLangKey()); + Set authorities = this.authoritiesFromStrings(userDTO.getAuthorities()); + user.setAuthorities(authorities); + return user; + } + } + + private Set authoritiesFromStrings(Set authoritiesAsString) { + Set authorities = new HashSet<>(); + + if (authoritiesAsString != null) { + authorities = + authoritiesAsString + .stream() + .map(string -> { + Authority auth = new Authority(); + auth.setName(string); + return auth; + }) + .collect(Collectors.toSet()); + } + + return authorities; + } + + public User userFromId(Long id) { + if (id == null) { + return null; + } + User user = new User(); + user.setId(id); + return user; + } + + @Named("id") + @BeanMapping(ignoreByDefault = true) + @Mapping(target = "id", source = "id") + public UserDTO toDtoId(User user) { + if (user == null) { + return null; + } + UserDTO userDto = new UserDTO(); + userDto.setId(user.getId()); + return userDto; + } + + @Named("idSet") + @BeanMapping(ignoreByDefault = true) + @Mapping(target = "id", source = "id") + public Set toDtoIdSet(Set users) { + if (users == null) { + return Collections.emptySet(); + } + + Set userSet = new HashSet<>(); + for (User userEntity : users) { + userSet.add(this.toDtoId(userEntity)); + } + + return userSet; + } + + @Named("login") + @BeanMapping(ignoreByDefault = true) + @Mapping(target = "id", source = "id") + @Mapping(target = "login", source = "login") + public UserDTO toDtoLogin(User user) { + if (user == null) { + return null; + } + UserDTO userDto = new UserDTO(); + userDto.setId(user.getId()); + userDto.setLogin(user.getLogin()); + return userDto; + } + + @Named("loginSet") + @BeanMapping(ignoreByDefault = true) + @Mapping(target = "id", source = "id") + @Mapping(target = "login", source = "login") + public Set toDtoLoginSet(Set users) { + if (users == null) { + return Collections.emptySet(); + } + + Set userSet = new HashSet<>(); + for (User userEntity : users) { + userSet.add(this.toDtoLogin(userEntity)); + } + + return userSet; + } +} diff --git a/src/main/java/de/tum/cit/ase/service/mapper/package-info.java b/src/main/java/de/tum/cit/ase/service/mapper/package-info.java new file mode 100644 index 00000000..aa347eea --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/mapper/package-info.java @@ -0,0 +1,4 @@ +/** + * Data transfer objects mappers. + */ +package de.tum.cit.ase.service.mapper; diff --git a/src/main/java/de/tum/cit/ase/service/package-info.java b/src/main/java/de/tum/cit/ase/service/package-info.java new file mode 100644 index 00000000..742a1e97 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/service/package-info.java @@ -0,0 +1,4 @@ +/** + * Service layer. + */ +package de.tum.cit.ase.service; diff --git a/src/main/java/de/tum/cit/ase/web/filter/SpaWebFilter.java b/src/main/java/de/tum/cit/ase/web/filter/SpaWebFilter.java new file mode 100644 index 00000000..0689cd1c --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/filter/SpaWebFilter.java @@ -0,0 +1,34 @@ +package de.tum.cit.ase.web.filter; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import org.springframework.web.filter.OncePerRequestFilter; + +public class SpaWebFilter extends OncePerRequestFilter { + + /** + * Forwards any unmapped paths (except those containing a period) to the client {@code index.html}. + */ + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws ServletException, IOException { + // Request URI includes the contextPath if any, removed it. + String path = request.getRequestURI().substring(request.getContextPath().length()); + if ( + !path.startsWith("/api") && + !path.startsWith("/management") && + !path.startsWith("/v3/api-docs") && + !path.startsWith("/websocket") && + !path.contains(".") && + path.matches("/(.*)") + ) { + request.getRequestDispatcher("/index.html").forward(request, response); + return; + } + + filterChain.doFilter(request, response); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/filter/package-info.java b/src/main/java/de/tum/cit/ase/web/filter/package-info.java new file mode 100644 index 00000000..861bbf82 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/filter/package-info.java @@ -0,0 +1,4 @@ +/** + * Request chain filters. + */ +package de.tum.cit.ase.web.filter; diff --git a/src/main/java/de/tum/cit/ase/web/rest/AccountResource.java b/src/main/java/de/tum/cit/ase/web/rest/AccountResource.java new file mode 100644 index 00000000..4f1303b6 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/AccountResource.java @@ -0,0 +1,181 @@ +package de.tum.cit.ase.web.rest; + +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.UserRepository; +import de.tum.cit.ase.security.SecurityUtils; +import de.tum.cit.ase.service.MailService; +import de.tum.cit.ase.service.UserService; +import de.tum.cit.ase.service.dto.AdminUserDTO; +import de.tum.cit.ase.service.dto.PasswordChangeDTO; +import de.tum.cit.ase.web.rest.errors.*; +import de.tum.cit.ase.web.rest.vm.KeyAndPasswordVM; +import de.tum.cit.ase.web.rest.vm.ManagedUserVM; +import jakarta.validation.Valid; +import java.util.*; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; + +/** + * REST controller for managing the current user's account. + */ +@RestController +@RequestMapping("/api") +public class AccountResource { + + private static class AccountResourceException extends RuntimeException { + + private AccountResourceException(String message) { + super(message); + } + } + + private final Logger log = LoggerFactory.getLogger(AccountResource.class); + + private final UserRepository userRepository; + + private final UserService userService; + + private final MailService mailService; + + public AccountResource(UserRepository userRepository, UserService userService, MailService mailService) { + this.userRepository = userRepository; + this.userService = userService; + this.mailService = mailService; + } + + /** + * {@code POST /register} : register the user. + * + * @param managedUserVM the managed user View Model. + * @throws InvalidPasswordException {@code 400 (Bad Request)} if the password is incorrect. + * @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already used. + * @throws LoginAlreadyUsedException {@code 400 (Bad Request)} if the login is already used. + */ + @PostMapping("/register") + @ResponseStatus(HttpStatus.CREATED) + public void registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) { + if (isPasswordLengthInvalid(managedUserVM.getPassword())) { + throw new InvalidPasswordException(); + } + User user = userService.registerUser(managedUserVM, managedUserVM.getPassword()); + mailService.sendActivationEmail(user); + } + + /** + * {@code GET /activate} : activate the registered user. + * + * @param key the activation key. + * @throws RuntimeException {@code 500 (Internal Server Error)} if the user couldn't be activated. + */ + @GetMapping("/activate") + public void activateAccount(@RequestParam(value = "key") String key) { + Optional user = userService.activateRegistration(key); + if (!user.isPresent()) { + throw new AccountResourceException("No user was found for this activation key"); + } + } + + /** + * {@code GET /account} : get the current user. + * + * @return the current user. + * @throws RuntimeException {@code 500 (Internal Server Error)} if the user couldn't be returned. + */ + @GetMapping("/account") + public AdminUserDTO getAccount() { + return userService + .getUserWithAuthorities() + .map(AdminUserDTO::new) + .orElseThrow(() -> new AccountResourceException("User could not be found")); + } + + /** + * {@code POST /account} : update the current user information. + * + * @param userDTO the current user information. + * @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already used. + * @throws RuntimeException {@code 500 (Internal Server Error)} if the user login wasn't found. + */ + @PostMapping("/account") + public void saveAccount(@Valid @RequestBody AdminUserDTO userDTO) { + String userLogin = SecurityUtils + .getCurrentUserLogin() + .orElseThrow(() -> new AccountResourceException("Current user login not found")); + Optional existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()); + if (existingUser.isPresent() && (!existingUser.orElseThrow().getLogin().equalsIgnoreCase(userLogin))) { + throw new EmailAlreadyUsedException(); + } + Optional user = userRepository.findOneByLogin(userLogin); + if (!user.isPresent()) { + throw new AccountResourceException("User could not be found"); + } + userService.updateUser( + userDTO.getFirstName(), + userDTO.getLastName(), + userDTO.getEmail(), + userDTO.getLangKey(), + userDTO.getImageUrl() + ); + } + + /** + * {@code POST /account/change-password} : changes the current user's password. + * + * @param passwordChangeDto current and new password. + * @throws InvalidPasswordException {@code 400 (Bad Request)} if the new password is incorrect. + */ + @PostMapping(path = "/account/change-password") + public void changePassword(@RequestBody PasswordChangeDTO passwordChangeDto) { + if (isPasswordLengthInvalid(passwordChangeDto.getNewPassword())) { + throw new InvalidPasswordException(); + } + userService.changePassword(passwordChangeDto.getCurrentPassword(), passwordChangeDto.getNewPassword()); + } + + /** + * {@code POST /account/reset-password/init} : Send an email to reset the password of the user. + * + * @param mail the mail of the user. + */ + @PostMapping(path = "/account/reset-password/init") + public void requestPasswordReset(@RequestBody String mail) { + Optional user = userService.requestPasswordReset(mail); + if (user.isPresent()) { + mailService.sendPasswordResetMail(user.orElseThrow()); + } else { + // Pretend the request has been successful to prevent checking which emails really exist + // but log that an invalid attempt has been made + log.warn("Password reset requested for non existing mail"); + } + } + + /** + * {@code POST /account/reset-password/finish} : Finish to reset the password of the user. + * + * @param keyAndPassword the generated key and the new password. + * @throws InvalidPasswordException {@code 400 (Bad Request)} if the password is incorrect. + * @throws RuntimeException {@code 500 (Internal Server Error)} if the password could not be reset. + */ + @PostMapping(path = "/account/reset-password/finish") + public void finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) { + if (isPasswordLengthInvalid(keyAndPassword.getNewPassword())) { + throw new InvalidPasswordException(); + } + Optional user = userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey()); + + if (!user.isPresent()) { + throw new AccountResourceException("No user was found for this reset key"); + } + } + + private static boolean isPasswordLengthInvalid(String password) { + return ( + StringUtils.isEmpty(password) || + password.length() < ManagedUserVM.PASSWORD_MIN_LENGTH || + password.length() > ManagedUserVM.PASSWORD_MAX_LENGTH + ); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/AuthenticateController.java b/src/main/java/de/tum/cit/ase/web/rest/AuthenticateController.java new file mode 100644 index 00000000..7da9cbd9 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/AuthenticateController.java @@ -0,0 +1,124 @@ +package de.tum.cit.ase.web.rest; + +import static de.tum.cit.ase.security.SecurityUtils.AUTHORITIES_KEY; +import static de.tum.cit.ase.security.SecurityUtils.JWT_ALGORITHM; + +import com.fasterxml.jackson.annotation.JsonProperty; +import de.tum.cit.ase.web.rest.vm.LoginVM; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.validation.Valid; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.oauth2.jwt.JwsHeader; +import org.springframework.security.oauth2.jwt.JwtClaimsSet; +import org.springframework.security.oauth2.jwt.JwtEncoder; +import org.springframework.security.oauth2.jwt.JwtEncoderParameters; +import org.springframework.web.bind.annotation.*; + +/** + * Controller to authenticate users. + */ +@RestController +@RequestMapping("/api") +public class AuthenticateController { + + private final Logger log = LoggerFactory.getLogger(AuthenticateController.class); + + private final JwtEncoder jwtEncoder; + + @Value("${jhipster.security.authentication.jwt.token-validity-in-seconds:0}") + private long tokenValidityInSeconds; + + @Value("${jhipster.security.authentication.jwt.token-validity-in-seconds-for-remember-me:0}") + private long tokenValidityInSecondsForRememberMe; + + private final AuthenticationManagerBuilder authenticationManagerBuilder; + + public AuthenticateController(JwtEncoder jwtEncoder, AuthenticationManagerBuilder authenticationManagerBuilder) { + this.jwtEncoder = jwtEncoder; + this.authenticationManagerBuilder = authenticationManagerBuilder; + } + + @PostMapping("/authenticate") + public ResponseEntity authorize(@Valid @RequestBody LoginVM loginVM) { + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken( + loginVM.getUsername(), + loginVM.getPassword() + ); + + Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken); + SecurityContextHolder.getContext().setAuthentication(authentication); + String jwt = this.createToken(authentication, loginVM.isRememberMe()); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.setBearerAuth(jwt); + return new ResponseEntity<>(new JWTToken(jwt), httpHeaders, HttpStatus.OK); + } + + /** + * {@code GET /authenticate} : check if the user is authenticated, and return its login. + * + * @param request the HTTP request. + * @return the login if the user is authenticated. + */ + @GetMapping("/authenticate") + public String isAuthenticated(HttpServletRequest request) { + log.debug("REST request to check if the current user is authenticated"); + return request.getRemoteUser(); + } + + public String createToken(Authentication authentication, boolean rememberMe) { + String authorities = authentication.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.joining(" ")); + + Instant now = Instant.now(); + Instant validity; + if (rememberMe) { + validity = now.plus(this.tokenValidityInSecondsForRememberMe, ChronoUnit.SECONDS); + } else { + validity = now.plus(this.tokenValidityInSeconds, ChronoUnit.SECONDS); + } + + // @formatter:off + JwtClaimsSet claims = JwtClaimsSet.builder() + .issuedAt(now) + .expiresAt(validity) + .subject(authentication.getName()) + .claim(AUTHORITIES_KEY, authorities) + .build(); + + JwsHeader jwsHeader = JwsHeader.with(JWT_ALGORITHM).build(); + return this.jwtEncoder.encode(JwtEncoderParameters.from(jwsHeader, claims)).getTokenValue(); + } + + /** + * Object to return as body in JWT Authentication. + */ + static class JWTToken { + + private String idToken; + + JWTToken(String idToken) { + this.idToken = idToken; + } + + @JsonProperty("id_token") + String getIdToken() { + return idToken; + } + + void setIdToken(String idToken) { + this.idToken = idToken; + } + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/PublicUserResource.java b/src/main/java/de/tum/cit/ase/web/rest/PublicUserResource.java new file mode 100644 index 00000000..baad8c78 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/PublicUserResource.java @@ -0,0 +1,65 @@ +package de.tum.cit.ase.web.rest; + +import de.tum.cit.ase.service.UserService; +import de.tum.cit.ase.service.dto.UserDTO; +import java.util.*; +import java.util.Collections; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; +import tech.jhipster.web.util.PaginationUtil; + +@RestController +@RequestMapping("/api") +public class PublicUserResource { + + private static final List ALLOWED_ORDERED_PROPERTIES = Collections.unmodifiableList( + Arrays.asList("id", "login", "firstName", "lastName", "email", "activated", "langKey") + ); + + private final Logger log = LoggerFactory.getLogger(PublicUserResource.class); + + private final UserService userService; + + public PublicUserResource(UserService userService) { + this.userService = userService; + } + + /** + * {@code GET /users} : get all users with only public information - calling this method is allowed for anyone. + * + * @param pageable the pagination information. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body all users. + */ + @GetMapping("/users") + public ResponseEntity> getAllPublicUsers(@org.springdoc.core.annotations.ParameterObject Pageable pageable) { + log.debug("REST request to get all public User names"); + if (!onlyContainsAllowedProperties(pageable)) { + return ResponseEntity.badRequest().build(); + } + + final Page page = userService.getAllPublicUsers(pageable); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); + return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); + } + + private boolean onlyContainsAllowedProperties(Pageable pageable) { + return pageable.getSort().stream().map(Sort.Order::getProperty).allMatch(ALLOWED_ORDERED_PROPERTIES::contains); + } + + /** + * Gets a list of all roles. + * @return a string list of all roles. + */ + @GetMapping("/authorities") + public List getAuthorities() { + return userService.getAuthorities(); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/UserResource.java b/src/main/java/de/tum/cit/ase/web/rest/UserResource.java new file mode 100644 index 00000000..218e5fb4 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/UserResource.java @@ -0,0 +1,212 @@ +package de.tum.cit.ase.web.rest; + +import de.tum.cit.ase.config.Constants; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.UserRepository; +import de.tum.cit.ase.security.AuthoritiesConstants; +import de.tum.cit.ase.service.MailService; +import de.tum.cit.ase.service.UserService; +import de.tum.cit.ase.service.dto.AdminUserDTO; +import de.tum.cit.ase.web.rest.errors.BadRequestAlertException; +import de.tum.cit.ase.web.rest.errors.EmailAlreadyUsedException; +import de.tum.cit.ase.web.rest.errors.LoginAlreadyUsedException; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Pattern; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; +import java.util.Collections; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; +import tech.jhipster.web.util.HeaderUtil; +import tech.jhipster.web.util.PaginationUtil; +import tech.jhipster.web.util.ResponseUtil; + +/** + * REST controller for managing users. + *

+ * This class accesses the {@link de.tum.cit.ase.domain.User} entity, and needs to fetch its collection of authorities. + *

+ * For a normal use-case, it would be better to have an eager relationship between User and Authority, + * and send everything to the client side: there would be no View Model and DTO, a lot less code, and an outer-join + * which would be good for performance. + *

+ * We use a View Model and a DTO for 3 reasons: + *

    + *
  • We want to keep a lazy association between the user and the authorities, because people will + * quite often do relationships with the user, and we don't want them to get the authorities all + * the time for nothing (for performance reasons). This is the #1 goal: we should not impact our users' + * application because of this use-case.
  • + *
  • Not having an outer join causes n+1 requests to the database. This is not a real issue as + * we have by default a second-level cache. This means on the first HTTP call we do the n+1 requests, + * but then all authorities come from the cache, so in fact it's much better than doing an outer join + * (which will get lots of data from the database, for each HTTP call).
  • + *
  • As this manages users, for security reasons, we'd rather have a DTO layer.
  • + *
+ *

+ * Another option would be to have a specific JPA entity graph to handle this case. + */ +@RestController +@RequestMapping("/api/admin") +public class UserResource { + + private static final List ALLOWED_ORDERED_PROPERTIES = Collections.unmodifiableList( + Arrays.asList( + "id", + "login", + "firstName", + "lastName", + "email", + "activated", + "langKey", + "createdBy", + "createdDate", + "lastModifiedBy", + "lastModifiedDate" + ) + ); + + private final Logger log = LoggerFactory.getLogger(UserResource.class); + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final UserService userService; + + private final UserRepository userRepository; + + private final MailService mailService; + + public UserResource(UserService userService, UserRepository userRepository, MailService mailService) { + this.userService = userService; + this.userRepository = userRepository; + this.mailService = mailService; + } + + /** + * {@code POST /admin/users} : Creates a new user. + *

+ * Creates a new user if the login and email are not already used, and sends an + * mail with an activation link. + * The user needs to be activated on creation. + * + * @param userDTO the user to create. + * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new user, or with status {@code 400 (Bad Request)} if the login or email is already in use. + * @throws URISyntaxException if the Location URI syntax is incorrect. + * @throws BadRequestAlertException {@code 400 (Bad Request)} if the login or email is already in use. + */ + @PostMapping("/users") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") + public ResponseEntity createUser(@Valid @RequestBody AdminUserDTO userDTO) throws URISyntaxException { + log.debug("REST request to save User : {}", userDTO); + + if (userDTO.getId() != null) { + throw new BadRequestAlertException("A new user cannot already have an ID", "userManagement", "idexists"); + // Lowercase the user login before comparing with database + } else if (userRepository.findOneByLogin(userDTO.getLogin().toLowerCase()).isPresent()) { + throw new LoginAlreadyUsedException(); + } else if (userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()).isPresent()) { + throw new EmailAlreadyUsedException(); + } else { + User newUser = userService.createUser(userDTO); + mailService.sendCreationEmail(newUser); + return ResponseEntity + .created(new URI("/api/admin/users/" + newUser.getLogin())) + .headers( + HeaderUtil.createAlert(applicationName, "A user is created with identifier " + newUser.getLogin(), newUser.getLogin()) + ) + .body(newUser); + } + } + + /** + * {@code PUT /admin/users} : Updates an existing User. + * + * @param userDTO the user to update. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the updated user. + * @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already in use. + * @throws LoginAlreadyUsedException {@code 400 (Bad Request)} if the login is already in use. + */ + @PutMapping("/users") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") + public ResponseEntity updateUser(@Valid @RequestBody AdminUserDTO userDTO) { + log.debug("REST request to update User : {}", userDTO); + Optional existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()); + if (existingUser.isPresent() && (!existingUser.orElseThrow().getId().equals(userDTO.getId()))) { + throw new EmailAlreadyUsedException(); + } + existingUser = userRepository.findOneByLogin(userDTO.getLogin().toLowerCase()); + if (existingUser.isPresent() && (!existingUser.orElseThrow().getId().equals(userDTO.getId()))) { + throw new LoginAlreadyUsedException(); + } + Optional updatedUser = userService.updateUser(userDTO); + + return ResponseUtil.wrapOrNotFound( + updatedUser, + HeaderUtil.createAlert(applicationName, "A user is updated with identifier " + userDTO.getLogin(), userDTO.getLogin()) + ); + } + + /** + * {@code GET /admin/users} : get all users with all the details - calling this are only allowed for the administrators. + * + * @param pageable the pagination information. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body all users. + */ + @GetMapping("/users") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") + public ResponseEntity> getAllUsers(@org.springdoc.core.annotations.ParameterObject Pageable pageable) { + log.debug("REST request to get all User for an admin"); + if (!onlyContainsAllowedProperties(pageable)) { + return ResponseEntity.badRequest().build(); + } + + final Page page = userService.getAllManagedUsers(pageable); + HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page); + return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); + } + + private boolean onlyContainsAllowedProperties(Pageable pageable) { + return pageable.getSort().stream().map(Sort.Order::getProperty).allMatch(ALLOWED_ORDERED_PROPERTIES::contains); + } + + /** + * {@code GET /admin/users/:login} : get the "login" user. + * + * @param login the login of the user to find. + * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the "login" user, or with status {@code 404 (Not Found)}. + */ + @GetMapping("/users/{login}") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") + public ResponseEntity getUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) { + log.debug("REST request to get User : {}", login); + return ResponseUtil.wrapOrNotFound(userService.getUserWithAuthoritiesByLogin(login).map(AdminUserDTO::new)); + } + + /** + * {@code DELETE /admin/users/:login} : delete the "login" User. + * + * @param login the login of the user to delete. + * @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}. + */ + @DeleteMapping("/users/{login}") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") + public ResponseEntity deleteUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) { + log.debug("REST request to delete User: {}", login); + userService.deleteUser(login); + return ResponseEntity + .noContent() + .headers(HeaderUtil.createAlert(applicationName, "A user is deleted with identifier " + login, login)) + .build(); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/errors/BadRequestAlertException.java b/src/main/java/de/tum/cit/ase/web/rest/errors/BadRequestAlertException.java new file mode 100644 index 00000000..9a6cf9c3 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/errors/BadRequestAlertException.java @@ -0,0 +1,50 @@ +package de.tum.cit.ase.web.rest.errors; + +import java.net.URI; +import org.springframework.http.HttpStatus; +import org.springframework.web.ErrorResponseException; +import tech.jhipster.web.rest.errors.ProblemDetailWithCause; +import tech.jhipster.web.rest.errors.ProblemDetailWithCause.ProblemDetailWithCauseBuilder; + +@SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep +public class BadRequestAlertException extends ErrorResponseException { + + private static final long serialVersionUID = 1L; + + private final String entityName; + + private final String errorKey; + + public BadRequestAlertException(String defaultMessage, String entityName, String errorKey) { + this(ErrorConstants.DEFAULT_TYPE, defaultMessage, entityName, errorKey); + } + + public BadRequestAlertException(URI type, String defaultMessage, String entityName, String errorKey) { + super( + HttpStatus.BAD_REQUEST, + ProblemDetailWithCauseBuilder + .instance() + .withStatus(HttpStatus.BAD_REQUEST.value()) + .withType(type) + .withTitle(defaultMessage) + .withProperty("message", "error." + errorKey) + .withProperty("params", entityName) + .build(), + null + ); + this.entityName = entityName; + this.errorKey = errorKey; + } + + public String getEntityName() { + return entityName; + } + + public String getErrorKey() { + return errorKey; + } + + public ProblemDetailWithCause getProblemDetailWithCause() { + return (ProblemDetailWithCause) this.getBody(); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/errors/EmailAlreadyUsedException.java b/src/main/java/de/tum/cit/ase/web/rest/errors/EmailAlreadyUsedException.java new file mode 100644 index 00000000..0fb50377 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/errors/EmailAlreadyUsedException.java @@ -0,0 +1,11 @@ +package de.tum.cit.ase.web.rest.errors; + +@SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep +public class EmailAlreadyUsedException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public EmailAlreadyUsedException() { + super(ErrorConstants.EMAIL_ALREADY_USED_TYPE, "Email is already in use!", "userManagement", "emailexists"); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/errors/ErrorConstants.java b/src/main/java/de/tum/cit/ase/web/rest/errors/ErrorConstants.java new file mode 100644 index 00000000..bb038ad9 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/errors/ErrorConstants.java @@ -0,0 +1,17 @@ +package de.tum.cit.ase.web.rest.errors; + +import java.net.URI; + +public final class ErrorConstants { + + public static final String ERR_CONCURRENCY_FAILURE = "error.concurrencyFailure"; + public static final String ERR_VALIDATION = "error.validation"; + public static final String PROBLEM_BASE_URL = "https://www.jhipster.tech/problem"; + public static final URI DEFAULT_TYPE = URI.create(PROBLEM_BASE_URL + "/problem-with-message"); + public static final URI CONSTRAINT_VIOLATION_TYPE = URI.create(PROBLEM_BASE_URL + "/constraint-violation"); + public static final URI INVALID_PASSWORD_TYPE = URI.create(PROBLEM_BASE_URL + "/invalid-password"); + public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); + public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); + + private ErrorConstants() {} +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslator.java b/src/main/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslator.java new file mode 100644 index 00000000..c17eeac8 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslator.java @@ -0,0 +1,252 @@ +package de.tum.cit.ase.web.rest.errors; + +import static org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation; + +import jakarta.servlet.http.HttpServletRequest; +import java.net.URI; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.dao.DataAccessException; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; +import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.HttpMessageConversionException; +import org.springframework.lang.Nullable; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.ErrorResponse; +import org.springframework.web.ErrorResponseException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.context.request.WebRequest; +import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.web.rest.errors.ProblemDetailWithCause; +import tech.jhipster.web.rest.errors.ProblemDetailWithCause.ProblemDetailWithCauseBuilder; +import tech.jhipster.web.util.HeaderUtil; + +/** + * Controller advice to translate the server side exceptions to client-friendly json structures. + * The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807). + */ +@ControllerAdvice +public class ExceptionTranslator extends ResponseEntityExceptionHandler { + + private static final String FIELD_ERRORS_KEY = "fieldErrors"; + private static final String MESSAGE_KEY = "message"; + private static final String PATH_KEY = "path"; + private static final boolean CASUAL_CHAIN_ENABLED = false; + + @Value("${jhipster.clientApp.name}") + private String applicationName; + + private final Environment env; + + public ExceptionTranslator(Environment env) { + this.env = env; + } + + @ExceptionHandler + public ResponseEntity handleAnyException(Throwable ex, NativeWebRequest request) { + ProblemDetailWithCause pdCause = wrapAndCustomizeProblem(ex, request); + return handleExceptionInternal((Exception) ex, pdCause, buildHeaders(ex), HttpStatusCode.valueOf(pdCause.getStatus()), request); + } + + @Nullable + @Override + protected ResponseEntity handleExceptionInternal( + Exception ex, + @Nullable Object body, + HttpHeaders headers, + HttpStatusCode statusCode, + WebRequest request + ) { + body = body == null ? wrapAndCustomizeProblem((Throwable) ex, (NativeWebRequest) request) : body; + return super.handleExceptionInternal(ex, body, headers, statusCode, request); + } + + protected ProblemDetailWithCause wrapAndCustomizeProblem(Throwable ex, NativeWebRequest request) { + return customizeProblem(getProblemDetailWithCause(ex), ex, request); + } + + private ProblemDetailWithCause getProblemDetailWithCause(Throwable ex) { + if ( + ex instanceof de.tum.cit.ase.service.UsernameAlreadyUsedException + ) return (ProblemDetailWithCause) new LoginAlreadyUsedException().getBody(); + if (ex instanceof de.tum.cit.ase.service.EmailAlreadyUsedException) return (ProblemDetailWithCause) new EmailAlreadyUsedException() + .getBody(); + if (ex instanceof de.tum.cit.ase.service.InvalidPasswordException) return (ProblemDetailWithCause) new InvalidPasswordException() + .getBody(); + + if ( + ex instanceof ErrorResponseException exp && exp.getBody() instanceof ProblemDetailWithCause problemDetailWithCause + ) return problemDetailWithCause; + return ProblemDetailWithCauseBuilder.instance().withStatus(toStatus(ex).value()).build(); + } + + protected ProblemDetailWithCause customizeProblem(ProblemDetailWithCause problem, Throwable err, NativeWebRequest request) { + if (problem.getStatus() <= 0) problem.setStatus(toStatus(err)); + + if (problem.getType() == null || problem.getType().equals(URI.create("about:blank"))) problem.setType(getMappedType(err)); + + // higher precedence to Custom/ResponseStatus types + String title = extractTitle(err, problem.getStatus()); + String problemTitle = problem.getTitle(); + if (problemTitle == null || !problemTitle.equals(title)) { + problem.setTitle(title); + } + + if (problem.getDetail() == null) { + // higher precedence to cause + problem.setDetail(getCustomizedErrorDetails(err)); + } + + Map problemProperties = problem.getProperties(); + if (problemProperties == null || !problemProperties.containsKey(MESSAGE_KEY)) problem.setProperty( + MESSAGE_KEY, + getMappedMessageKey(err) != null ? getMappedMessageKey(err) : "error.http." + problem.getStatus() + ); + + if (problemProperties == null || !problemProperties.containsKey(PATH_KEY)) problem.setProperty(PATH_KEY, getPathValue(request)); + + if ( + (err instanceof MethodArgumentNotValidException fieldException) && + (problemProperties == null || !problemProperties.containsKey(FIELD_ERRORS_KEY)) + ) problem.setProperty(FIELD_ERRORS_KEY, getFieldErrors(fieldException)); + + problem.setCause(buildCause(err.getCause(), request).orElse(null)); + + return problem; + } + + private String extractTitle(Throwable err, int statusCode) { + return getCustomizedTitle(err) != null ? getCustomizedTitle(err) : extractTitleForResponseStatus(err, statusCode); + } + + private List getFieldErrors(MethodArgumentNotValidException ex) { + return ex + .getBindingResult() + .getFieldErrors() + .stream() + .map(f -> + new FieldErrorVM( + f.getObjectName().replaceFirst("DTO$", ""), + f.getField(), + StringUtils.isNotBlank(f.getDefaultMessage()) ? f.getDefaultMessage() : f.getCode() + ) + ) + .toList(); + } + + private String extractTitleForResponseStatus(Throwable err, int statusCode) { + ResponseStatus specialStatus = extractResponseStatus(err); + return specialStatus == null ? HttpStatus.valueOf(statusCode).getReasonPhrase() : specialStatus.reason(); + } + + private String extractURI(NativeWebRequest request) { + HttpServletRequest nativeRequest = request.getNativeRequest(HttpServletRequest.class); + return nativeRequest != null ? nativeRequest.getRequestURI() : StringUtils.EMPTY; + } + + private HttpStatus toStatus(final Throwable throwable) { + // Let the ErrorResponse take this responsibility + if (throwable instanceof ErrorResponse err) return HttpStatus.valueOf(err.getBody().getStatus()); + + return Optional + .ofNullable(getMappedStatus(throwable)) + .orElse( + Optional.ofNullable(resolveResponseStatus(throwable)).map(ResponseStatus::value).orElse(HttpStatus.INTERNAL_SERVER_ERROR) + ); + } + + private ResponseStatus extractResponseStatus(final Throwable throwable) { + return Optional.ofNullable(resolveResponseStatus(throwable)).orElse(null); + } + + private ResponseStatus resolveResponseStatus(final Throwable type) { + final ResponseStatus candidate = findMergedAnnotation(type.getClass(), ResponseStatus.class); + return candidate == null && type.getCause() != null ? resolveResponseStatus(type.getCause()) : candidate; + } + + private URI getMappedType(Throwable err) { + if (err instanceof MethodArgumentNotValidException) return ErrorConstants.CONSTRAINT_VIOLATION_TYPE; + return ErrorConstants.DEFAULT_TYPE; + } + + private String getMappedMessageKey(Throwable err) { + if (err instanceof MethodArgumentNotValidException) { + return ErrorConstants.ERR_VALIDATION; + } else if (err instanceof ConcurrencyFailureException || err.getCause() instanceof ConcurrencyFailureException) { + return ErrorConstants.ERR_CONCURRENCY_FAILURE; + } + return null; + } + + private String getCustomizedTitle(Throwable err) { + if (err instanceof MethodArgumentNotValidException) return "Method argument not valid"; + return null; + } + + private String getCustomizedErrorDetails(Throwable err) { + Collection activeProfiles = Arrays.asList(env.getActiveProfiles()); + if (activeProfiles.contains(JHipsterConstants.SPRING_PROFILE_PRODUCTION)) { + if (err instanceof HttpMessageConversionException) return "Unable to convert http message"; + if (err instanceof DataAccessException) return "Failure during data access"; + if (containsPackageName(err.getMessage())) return "Unexpected runtime exception"; + } + return err.getCause() != null ? err.getCause().getMessage() : err.getMessage(); + } + + private HttpStatus getMappedStatus(Throwable err) { + // Where we disagree with Spring defaults + if (err instanceof AccessDeniedException) return HttpStatus.FORBIDDEN; + if (err instanceof ConcurrencyFailureException) return HttpStatus.CONFLICT; + if (err instanceof BadCredentialsException) return HttpStatus.UNAUTHORIZED; + return null; + } + + private URI getPathValue(NativeWebRequest request) { + if (request == null) return URI.create("about:blank"); + return URI.create(extractURI(request)); + } + + private HttpHeaders buildHeaders(Throwable err) { + return err instanceof BadRequestAlertException badRequestAlertException + ? HeaderUtil.createFailureAlert( + applicationName, + true, + badRequestAlertException.getEntityName(), + badRequestAlertException.getErrorKey(), + badRequestAlertException.getMessage() + ) + : null; + } + + public Optional buildCause(final Throwable throwable, NativeWebRequest request) { + if (throwable != null && isCasualChainEnabled()) { + return Optional.of(customizeProblem(getProblemDetailWithCause(throwable), throwable, request)); + } + return Optional.ofNullable(null); + } + + private boolean isCasualChainEnabled() { + // Customize as per the needs + return CASUAL_CHAIN_ENABLED; + } + + private boolean containsPackageName(String message) { + // This list is for sure not complete + return StringUtils.containsAny(message, "org.", "java.", "net.", "jakarta.", "javax.", "com.", "io.", "de.", "de.tum.cit.ase"); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/errors/FieldErrorVM.java b/src/main/java/de/tum/cit/ase/web/rest/errors/FieldErrorVM.java new file mode 100644 index 00000000..98d733f0 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/errors/FieldErrorVM.java @@ -0,0 +1,32 @@ +package de.tum.cit.ase.web.rest.errors; + +import java.io.Serializable; + +public class FieldErrorVM implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String objectName; + + private final String field; + + private final String message; + + public FieldErrorVM(String dto, String field, String message) { + this.objectName = dto; + this.field = field; + this.message = message; + } + + public String getObjectName() { + return objectName; + } + + public String getField() { + return field; + } + + public String getMessage() { + return message; + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/errors/InvalidPasswordException.java b/src/main/java/de/tum/cit/ase/web/rest/errors/InvalidPasswordException.java new file mode 100644 index 00000000..4d5b7b94 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/errors/InvalidPasswordException.java @@ -0,0 +1,24 @@ +package de.tum.cit.ase.web.rest.errors; + +import org.springframework.http.HttpStatus; +import org.springframework.web.ErrorResponseException; +import tech.jhipster.web.rest.errors.ProblemDetailWithCause.ProblemDetailWithCauseBuilder; + +@SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep +public class InvalidPasswordException extends ErrorResponseException { + + private static final long serialVersionUID = 1L; + + public InvalidPasswordException() { + super( + HttpStatus.BAD_REQUEST, + ProblemDetailWithCauseBuilder + .instance() + .withStatus(HttpStatus.BAD_REQUEST.value()) + .withType(ErrorConstants.INVALID_PASSWORD_TYPE) + .withTitle("Incorrect password") + .build(), + null + ); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/errors/LoginAlreadyUsedException.java b/src/main/java/de/tum/cit/ase/web/rest/errors/LoginAlreadyUsedException.java new file mode 100644 index 00000000..ff2c0020 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/errors/LoginAlreadyUsedException.java @@ -0,0 +1,11 @@ +package de.tum.cit.ase.web.rest.errors; + +@SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep +public class LoginAlreadyUsedException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public LoginAlreadyUsedException() { + super(ErrorConstants.LOGIN_ALREADY_USED_TYPE, "Login name already used!", "userManagement", "userexists"); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/errors/package-info.java b/src/main/java/de/tum/cit/ase/web/rest/errors/package-info.java new file mode 100644 index 00000000..3649f885 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/errors/package-info.java @@ -0,0 +1,4 @@ +/** + * Rest layer error handling. + */ +package de.tum.cit.ase.web.rest.errors; diff --git a/src/main/java/de/tum/cit/ase/web/rest/package-info.java b/src/main/java/de/tum/cit/ase/web/rest/package-info.java new file mode 100644 index 00000000..2cc890dd --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/package-info.java @@ -0,0 +1,4 @@ +/** + * Rest layer. + */ +package de.tum.cit.ase.web.rest; diff --git a/src/main/java/de/tum/cit/ase/web/rest/vm/KeyAndPasswordVM.java b/src/main/java/de/tum/cit/ase/web/rest/vm/KeyAndPasswordVM.java new file mode 100644 index 00000000..95c99c90 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/vm/KeyAndPasswordVM.java @@ -0,0 +1,27 @@ +package de.tum.cit.ase.web.rest.vm; + +/** + * View Model object for storing the user's key and password. + */ +public class KeyAndPasswordVM { + + private String key; + + private String newPassword; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getNewPassword() { + return newPassword; + } + + public void setNewPassword(String newPassword) { + this.newPassword = newPassword; + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/vm/LoginVM.java b/src/main/java/de/tum/cit/ase/web/rest/vm/LoginVM.java new file mode 100644 index 00000000..2114bbfb --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/vm/LoginVM.java @@ -0,0 +1,53 @@ +package de.tum.cit.ase.web.rest.vm; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +/** + * View Model object for storing a user's credentials. + */ +public class LoginVM { + + @NotNull + @Size(min = 1, max = 50) + private String username; + + @NotNull + @Size(min = 4, max = 100) + private String password; + + private boolean rememberMe; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public boolean isRememberMe() { + return rememberMe; + } + + public void setRememberMe(boolean rememberMe) { + this.rememberMe = rememberMe; + } + + // prettier-ignore + @Override + public String toString() { + return "LoginVM{" + + "username='" + username + '\'' + + ", rememberMe=" + rememberMe + + '}'; + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/vm/ManagedUserVM.java b/src/main/java/de/tum/cit/ase/web/rest/vm/ManagedUserVM.java new file mode 100644 index 00000000..093d51c2 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/vm/ManagedUserVM.java @@ -0,0 +1,35 @@ +package de.tum.cit.ase.web.rest.vm; + +import de.tum.cit.ase.service.dto.AdminUserDTO; +import jakarta.validation.constraints.Size; + +/** + * View Model extending the AdminUserDTO, which is meant to be used in the user management UI. + */ +public class ManagedUserVM extends AdminUserDTO { + + public static final int PASSWORD_MIN_LENGTH = 4; + + public static final int PASSWORD_MAX_LENGTH = 100; + + @Size(min = PASSWORD_MIN_LENGTH, max = PASSWORD_MAX_LENGTH) + private String password; + + public ManagedUserVM() { + // Empty constructor needed for Jackson. + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + // prettier-ignore + @Override + public String toString() { + return "ManagedUserVM{" + super.toString() + "} "; + } +} diff --git a/src/main/java/de/tum/cit/ase/web/rest/vm/package-info.java b/src/main/java/de/tum/cit/ase/web/rest/vm/package-info.java new file mode 100644 index 00000000..2a95ecbd --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/rest/vm/package-info.java @@ -0,0 +1,4 @@ +/** + * Rest layer visual models. + */ +package de.tum.cit.ase.web.rest.vm; diff --git a/src/main/java/de/tum/cit/ase/web/websocket/ActivityService.java b/src/main/java/de/tum/cit/ase/web/websocket/ActivityService.java new file mode 100644 index 00000000..e4510283 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/websocket/ActivityService.java @@ -0,0 +1,46 @@ +package de.tum.cit.ase.web.websocket; + +import static de.tum.cit.ase.config.WebsocketConfiguration.IP_ADDRESS; + +import de.tum.cit.ase.web.websocket.dto.ActivityDTO; +import java.security.Principal; +import java.time.Instant; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.ApplicationListener; +import org.springframework.messaging.handler.annotation.*; +import org.springframework.messaging.simp.SimpMessageSendingOperations; +import org.springframework.messaging.simp.stomp.StompHeaderAccessor; +import org.springframework.stereotype.Controller; +import org.springframework.web.socket.messaging.SessionDisconnectEvent; + +@Controller +public class ActivityService implements ApplicationListener { + + private static final Logger log = LoggerFactory.getLogger(ActivityService.class); + + private final SimpMessageSendingOperations messagingTemplate; + + public ActivityService(SimpMessageSendingOperations messagingTemplate) { + this.messagingTemplate = messagingTemplate; + } + + @MessageMapping("/topic/activity") + @SendTo("/topic/tracker") + public ActivityDTO sendActivity(@Payload ActivityDTO activityDTO, StompHeaderAccessor stompHeaderAccessor, Principal principal) { + activityDTO.setUserLogin(principal.getName()); + activityDTO.setSessionId(stompHeaderAccessor.getSessionId()); + activityDTO.setIpAddress(stompHeaderAccessor.getSessionAttributes().get(IP_ADDRESS).toString()); + activityDTO.setTime(Instant.now()); + log.debug("Sending user tracking data {}", activityDTO); + return activityDTO; + } + + @Override + public void onApplicationEvent(SessionDisconnectEvent event) { + ActivityDTO activityDTO = new ActivityDTO(); + activityDTO.setSessionId(event.getSessionId()); + activityDTO.setPage("logout"); + messagingTemplate.convertAndSend("/topic/tracker", activityDTO); + } +} diff --git a/src/main/java/de/tum/cit/ase/web/websocket/dto/ActivityDTO.java b/src/main/java/de/tum/cit/ase/web/websocket/dto/ActivityDTO.java new file mode 100644 index 00000000..f4406bab --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/websocket/dto/ActivityDTO.java @@ -0,0 +1,71 @@ +package de.tum.cit.ase.web.websocket.dto; + +import java.time.Instant; + +/** + * DTO for storing a user's activity. + */ +public class ActivityDTO { + + private String sessionId; + + private String userLogin; + + private String ipAddress; + + private String page; + + private Instant time; + + public String getSessionId() { + return sessionId; + } + + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + + public String getUserLogin() { + return userLogin; + } + + public void setUserLogin(String userLogin) { + this.userLogin = userLogin; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public String getPage() { + return page; + } + + public void setPage(String page) { + this.page = page; + } + + public Instant getTime() { + return time; + } + + public void setTime(Instant time) { + this.time = time; + } + + // prettier-ignore + @Override + public String toString() { + return "ActivityDTO{" + + "sessionId='" + sessionId + '\'' + + ", userLogin='" + userLogin + '\'' + + ", ipAddress='" + ipAddress + '\'' + + ", page='" + page + '\'' + + ", time='" + time + '\'' + + '}'; + } +} diff --git a/src/main/java/de/tum/cit/ase/web/websocket/dto/package-info.java b/src/main/java/de/tum/cit/ase/web/websocket/dto/package-info.java new file mode 100644 index 00000000..45892328 --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/websocket/dto/package-info.java @@ -0,0 +1,4 @@ +/** + * This package file was generated by JHipster + */ +package de.tum.cit.ase.web.websocket.dto; diff --git a/src/main/java/de/tum/cit/ase/web/websocket/package-info.java b/src/main/java/de/tum/cit/ase/web/websocket/package-info.java new file mode 100644 index 00000000..90ec384c --- /dev/null +++ b/src/main/java/de/tum/cit/ase/web/websocket/package-info.java @@ -0,0 +1,4 @@ +/** + * This package file was generated by JHipster + */ +package de.tum.cit.ase.web.websocket; diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt new file mode 100644 index 00000000..5be7dbe6 --- /dev/null +++ b/src/main/resources/banner.txt @@ -0,0 +1,10 @@ + + ${AnsiColor.GREEN} ██╗${AnsiColor.RED} ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗ + ${AnsiColor.GREEN} ██║${AnsiColor.RED} ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗ + ${AnsiColor.GREEN} ██║${AnsiColor.RED} ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝ + ${AnsiColor.GREEN}██╗ ██║${AnsiColor.RED} ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║ + ${AnsiColor.GREEN}╚██████╔╝${AnsiColor.RED} ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗ + ${AnsiColor.GREEN} ╚═════╝ ${AnsiColor.RED} ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝ + +${AnsiColor.BRIGHT_BLUE}:: JHipster 🤓 :: Running Spring Boot ${spring-boot.version} :: Startup profile(s) ${spring.profiles.active} :: +:: https://www.jhipster.tech ::${AnsiColor.DEFAULT} diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml new file mode 100644 index 00000000..63a47228 --- /dev/null +++ b/src/main/resources/config/application-dev.yml @@ -0,0 +1,110 @@ +# =================================================================== +# Spring Boot configuration for the "dev" profile. +# +# This configuration overrides the application.yml file. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +logging: + level: + ROOT: DEBUG + tech.jhipster: DEBUG + org.hibernate.SQL: DEBUG + de.tum.cit.ase: DEBUG + +spring: + devtools: + restart: + enabled: true + additional-exclude: static/** + livereload: + enabled: false # we use Webpack dev server + BrowserSync for livereload + jackson: + serialization: + indent-output: true + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:mysql://localhost:3306/artemis-benchmarking?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true + username: root + password: + hikari: + poolName: Hikari + auto-commit: false + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 250 + prepStmtCacheSqlLimit: 2048 + useServerPrepStmts: true + liquibase: + # Remove 'faker' if you do not want the sample data to be loaded automatically + contexts: dev, faker + mail: + host: localhost + port: 25 + username: + password: + messages: + cache-duration: PT1S # 1 second, see the ISO 8601 standard + thymeleaf: + cache: false + +server: + port: 8080 + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + cache: # Cache configuration + hazelcast: # Hazelcast distributed cache + time-to-live-seconds: 3600 + backup-count: 1 + # CORS is only enabled by default with the "dev" profile + cors: + # Allow Ionic for JHipster by default (* no longer allowed in Spring Boot 2.4+) + allowed-origins: 'http://localhost:8100,https://localhost:8100,http://localhost:9000,https://localhost:9000,http://localhost:4200,https://localhost:4200' + # Enable CORS when running in GitHub Codespaces + allowed-origin-patterns: 'https://*.githubpreview.dev' + allowed-methods: '*' + allowed-headers: '*' + exposed-headers: 'Authorization,Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params' + allow-credentials: true + max-age: 1800 + security: + authentication: + jwt: + # This token must be encoded using Base64 and be at least 256 bits long (you can type `openssl rand -base64 64` on your command line to generate a 512 bits one) + base64-secret: YjQzZmE3YzMxODc2NDE1NDY1M2JlYjQxMjhjZWNiOGU1OWM1ZGFhYmY1OWU5ODI0MWMwMDYwY2ZlZDUwZWUzOWY2OGRmY2EwMDJlODY4NGFiNWNmZjhjMWUyZDRjY2IxZTIxOTBlZGI0NzRlMDJjNGNlMTcwZjE2ODRmMjUxNjc= + # Token is valid 24 hours + token-validity-in-seconds: 86400 + token-validity-in-seconds-for-remember-me: 2592000 + mail: # specific JHipster mail property, for standard properties see MailProperties + base-url: http://127.0.0.1:8080 + logging: + use-json-format: false # By default, logs are not in Json format + logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration + enabled: false + host: localhost + port: 5000 + ring-buffer-size: 512 +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/src/main/resources/config/application-prod.yml b/src/main/resources/config/application-prod.yml new file mode 100644 index 00000000..ced8d4a3 --- /dev/null +++ b/src/main/resources/config/application-prod.yml @@ -0,0 +1,129 @@ +# =================================================================== +# Spring Boot configuration for the "prod" profile. +# +# This configuration overrides the application.yml file. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +logging: + level: + ROOT: INFO + tech.jhipster: INFO + de.tum.cit.ase: INFO + +management: + prometheus: + metrics: + export: + enabled: false + +spring: + devtools: + restart: + enabled: false + livereload: + enabled: false + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:mysql://localhost:3306/artemis-benchmarking?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true + username: root + password: + hikari: + poolName: Hikari + auto-commit: false + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 250 + prepStmtCacheSqlLimit: 2048 + useServerPrepStmts: true + # Replace by 'prod, faker' to add the faker context and have sample data loaded in production + liquibase: + contexts: prod + mail: + host: localhost + port: 25 + username: + password: + thymeleaf: + cache: true + +# =================================================================== +# To enable TLS in production, generate a certificate using: +# keytool -genkey -alias artemis-benchmarking -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650 +# +# You can also use Let's Encrypt: +# See details in topic "Create a Java Keystore (.JKS) from Let's Encrypt Certificates" on https://maximilian-boehm.com/en-gb/blog +# +# Then, modify the server.ssl properties so your "server" configuration looks like: +# +# server: +# port: 443 +# ssl: +# key-store: classpath:config/tls/keystore.p12 +# key-store-password: password +# key-store-type: PKCS12 +# key-alias: selfsigned +# # The ciphers suite enforce the security by deactivating some old and deprecated SSL cipher, this list was tested against SSL Labs (https://www.ssllabs.com/ssltest/) +# ciphers: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 ,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 ,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_256_GCM_SHA384,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_RSA_WITH_CAMELLIA_256_CBC_SHA,TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,TLS_RSA_WITH_CAMELLIA_128_CBC_SHA +# =================================================================== +server: + port: 8080 + shutdown: graceful # see https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-graceful-shutdown + compression: + enabled: true + mime-types: text/html,text/xml,text/plain,text/css,application/javascript,application/json,image/svg+xml + min-response-size: 1024 + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + http: + cache: # Used by the CachingHttpHeadersFilter + timeToLiveInDays: 1461 + cache: # Cache configuration + hazelcast: # Hazelcast distributed cache + time-to-live-seconds: 3600 + backup-count: 1 + security: + authentication: + jwt: + # This token must be encoded using Base64 and be at least 256 bits long (you can type `openssl rand -base64 64` on your command line to generate a 512 bits one) + # As this is the PRODUCTION configuration, you MUST change the default key, and store it securely: + # - In the Consul configserver + # - In a separate `application-prod.yml` file, in the same folder as your executable JAR file + # - In the `JHIPSTER_SECURITY_AUTHENTICATION_JWT_BASE64_SECRET` environment variable + base64-secret: YjQzZmE3YzMxODc2NDE1NDY1M2JlYjQxMjhjZWNiOGU1OWM1ZGFhYmY1OWU5ODI0MWMwMDYwY2ZlZDUwZWUzOWY2OGRmY2EwMDJlODY4NGFiNWNmZjhjMWUyZDRjY2IxZTIxOTBlZGI0NzRlMDJjNGNlMTcwZjE2ODRmMjUxNjc= + # Token is valid 24 hours + token-validity-in-seconds: 86400 + token-validity-in-seconds-for-remember-me: 2592000 + mail: # specific JHipster mail property, for standard properties see MailProperties + base-url: http://my-server-url-to-change # Modify according to your server's URL + logging: + use-json-format: false # By default, logs are not in Json format + logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration + enabled: false + host: localhost + port: 5000 + ring-buffer-size: 512 +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/src/main/resources/config/application-tls.yml b/src/main/resources/config/application-tls.yml new file mode 100644 index 00000000..039f6f4a --- /dev/null +++ b/src/main/resources/config/application-tls.yml @@ -0,0 +1,19 @@ +# =================================================================== +# Activate this profile to enable TLS and HTTP/2. +# +# JHipster has generated a self-signed certificate, which will be used to encrypt traffic. +# As your browser will not understand this certificate, you will need to import it. +# +# Another (easiest) solution with Chrome is to enable the "allow-insecure-localhost" flag +# at chrome://flags/#allow-insecure-localhost +# =================================================================== +server: + ssl: + key-store: classpath:config/tls/keystore.p12 + key-store-password: password + key-store-type: PKCS12 + key-alias: selfsigned + ciphers: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + enabled-protocols: TLSv1.2 + http2: + enabled: true diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml new file mode 100644 index 00000000..9076ace5 --- /dev/null +++ b/src/main/resources/config/application.yml @@ -0,0 +1,212 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration will be overridden by the Spring profile you use, +# for example application-dev.yml if you use the "dev" profile. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +--- +# Conditionally disable springdoc on missing api-docs profile +spring: + config: + activate: + on-profile: '!api-docs' +springdoc: + api-docs: + enabled: false +--- +management: + endpoints: + web: + base-path: /management + exposure: + include: + - configprops + - env + - health + - info + - jhimetrics + - jhiopenapigroups + - logfile + - loggers + - prometheus + - threaddump + - caches + - liquibase + endpoint: + health: + show-details: when_authorized + roles: 'ROLE_ADMIN' + probes: + enabled: true + group: + liveness: + include: livenessState + readiness: + include: readinessState,db + jhimetrics: + enabled: true + info: + git: + mode: full + env: + enabled: true + health: + mail: + enabled: false # When using the MailService, configure an SMTP server and set this to true + prometheus: + metrics: + export: + enabled: true + step: 60 + enable: + http: true + jvm: true + logback: true + process: true + system: true + distribution: + percentiles-histogram: + all: true + percentiles: + all: 0, 0.5, 0.75, 0.95, 0.99, 1.0 + tags: + application: ${spring.application.name} + web: + server: + request: + autotime: + enabled: true + +spring: + application: + name: artemis-benchmarking + profiles: + # The commented value for `active` can be replaced with valid Spring profiles to load. + # Otherwise, it will be filled in by gradle when building the JAR file + # Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS` + active: #spring.profiles.active# + group: + dev: + - dev + - api-docs + # Uncomment to activate TLS for the dev profile + #- tls + jmx: + enabled: false + data: + jpa: + repositories: + bootstrap-mode: deferred + jpa: + open-in-view: false + properties: + hibernate.jdbc.time_zone: UTC + hibernate.timezone.default_storage: NORMALIZE + hibernate.type.preferred_instant_jdbc_type: TIMESTAMP + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: false + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: false + # modify batch size as necessary + hibernate.jdbc.batch_size: 25 + hibernate.order_inserts: true + hibernate.order_updates: true + hibernate.query.fail_on_pagination_over_collection_fetch: true + hibernate.query.in_clause_parameter_padding: true + hibernate: + ddl-auto: none + naming: + physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + messages: + basename: i18n/messages + main: + allow-bean-definition-overriding: true + mvc: + problemdetails: + enabled: true + task: + execution: + thread-name-prefix: artemis-benchmarking-task- + pool: + core-size: 2 + max-size: 50 + queue-capacity: 10000 + scheduling: + thread-name-prefix: artemis-benchmarking-scheduling- + pool: + size: 2 + thymeleaf: + mode: HTML + output: + ansi: + console-available: true + +server: + servlet: + session: + cookie: + http-only: true + +springdoc: + show-actuator: true + +# Properties to be exposed on the /info management endpoint +info: + # Comma separated list of profiles that will trigger the ribbon to show + display-ribbon-on-profiles: 'dev' + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +jhipster: + clientApp: + name: 'artemisBenchmarkingApp' + # By default CORS is disabled. Uncomment to enable. + # cors: + # allowed-origins: "http://localhost:8100,http://localhost:9000" + # allowed-methods: "*" + # allowed-headers: "*" + # exposed-headers: "Authorization,Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params" + # allow-credentials: true + # max-age: 1800 + mail: + from: artemis-benchmarking@localhost + api-docs: + default-include-pattern: /api/** + management-include-pattern: /management/** + title: Artemis Benchmarking API + description: Artemis Benchmarking API documentation + version: 0.0.1 + terms-of-service-url: + contact-name: + contact-url: + contact-email: + license: unlicensed + license-url: + security: + content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:" +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: diff --git a/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml b/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml new file mode 100644 index 00000000..e655bd86 --- /dev/null +++ b/src/main/resources/config/liquibase/changelog/00000000000000_initial_schema.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/config/liquibase/data/authority.csv b/src/main/resources/config/liquibase/data/authority.csv new file mode 100644 index 00000000..af5c6dfa --- /dev/null +++ b/src/main/resources/config/liquibase/data/authority.csv @@ -0,0 +1,3 @@ +name +ROLE_ADMIN +ROLE_USER diff --git a/src/main/resources/config/liquibase/data/user.csv b/src/main/resources/config/liquibase/data/user.csv new file mode 100644 index 00000000..fbc52da3 --- /dev/null +++ b/src/main/resources/config/liquibase/data/user.csv @@ -0,0 +1,3 @@ +id;login;password_hash;first_name;last_name;email;image_url;activated;lang_key;created_by;last_modified_by +1;admin;$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC;Administrator;Administrator;admin@localhost;;true;en;system;system +2;user;$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K;User;User;user@localhost;;true;en;system;system diff --git a/src/main/resources/config/liquibase/data/user_authority.csv b/src/main/resources/config/liquibase/data/user_authority.csv new file mode 100644 index 00000000..01dbdef7 --- /dev/null +++ b/src/main/resources/config/liquibase/data/user_authority.csv @@ -0,0 +1,4 @@ +user_id;authority_name +1;ROLE_ADMIN +1;ROLE_USER +2;ROLE_USER diff --git a/src/main/resources/config/liquibase/master.xml b/src/main/resources/config/liquibase/master.xml new file mode 100644 index 00000000..1d197b3f --- /dev/null +++ b/src/main/resources/config/liquibase/master.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties new file mode 100644 index 00000000..afa09d97 --- /dev/null +++ b/src/main/resources/i18n/messages.properties @@ -0,0 +1,21 @@ +# Error page +error.title=Your request cannot be processed +error.subtitle=Sorry, an error has occurred. +error.status=Status: +error.message=Message: + +# Activation email +email.activation.title=artemis-benchmarking account activation is required +email.activation.greeting=Dear {0} +email.activation.text1=Your artemis-benchmarking account has been created, please click on the URL below to activate it: +email.activation.text2=Regards, +email.signature=artemis-benchmarking Team. + +# Creation email +email.creation.text1=Your artemis-benchmarking account has been created, please click on the URL below to access it: + +# Reset email +email.reset.title=artemis-benchmarking password reset +email.reset.greeting=Dear {0} +email.reset.text1=For your artemis-benchmarking account a password reset was requested, please click on the URL below to reset it: +email.reset.text2=Regards, diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 00000000..b8ea4a10 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + diff --git a/src/main/resources/swagger/api.yml b/src/main/resources/swagger/api.yml new file mode 100644 index 00000000..d7de8fcc --- /dev/null +++ b/src/main/resources/swagger/api.yml @@ -0,0 +1,72 @@ +# API-first development with OpenAPI +# This file will be used at compile time to generate Spring-MVC endpoint stubs using openapi-generator +openapi: '3.0.1' +info: + title: 'artemis-benchmarking' + version: 0.0.1 +servers: + - url: http://localhost:8080/api + description: Development server + - url: https://localhost:8080/api + description: Development server with TLS Profile +paths: {} +components: + responses: + Problem: + description: error occurred - see status code and problem object for more information. + content: + application/problem+json: + schema: + type: object + properties: + type: + type: string + format: uri + description: | + An absolute URI that identifies the problem type. When dereferenced, + it SHOULD provide human-readable documentation for the problem type + (e.g., using HTML). + default: 'about:blank' + example: 'https://www.jhipster.tech/problem/constraint-violation' + title: + type: string + description: | + A short, summary of the problem type. Written in english and readable + for engineers (usually not suited for non technical stakeholders and + not localized); example: Service Unavailable + status: + type: integer + format: int32 + description: | + The HTTP status code generated by the origin server for this occurrence + of the problem. + minimum: 100 + maximum: 600 + exclusiveMaximum: true + example: 503 + detail: + type: string + description: | + A human readable explanation specific to this occurrence of the + problem. + example: Connection to database timed out + instance: + type: string + format: uri + description: | + An absolute URI that identifies the specific occurrence of the problem. + It may or may not yield further information if dereferenced. + + securitySchemes: + jwt: + type: http + description: JWT Authentication + scheme: bearer + bearerFormat: JWT + basic: + type: http + description: Basic Authentication + scheme: basic +security: + - jwt: [] + - basic: [] diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html new file mode 100644 index 00000000..31ee9d7d --- /dev/null +++ b/src/main/resources/templates/error.html @@ -0,0 +1,94 @@ + + + + + + Your request cannot be processed + + + +
+

Your request cannot be processed :(

+ +

Sorry, an error has occurred.

+ + Status:  ()
+ + Message: 
+
+
+ + diff --git a/src/main/resources/templates/mail/activationEmail.html b/src/main/resources/templates/mail/activationEmail.html new file mode 100644 index 00000000..6be1e4f2 --- /dev/null +++ b/src/main/resources/templates/mail/activationEmail.html @@ -0,0 +1,20 @@ + + + + JHipster activation + + + + +

Dear

+

Your JHipster account has been created, please click on the URL below to activate it:

+

+ Activation link +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/src/main/resources/templates/mail/creationEmail.html b/src/main/resources/templates/mail/creationEmail.html new file mode 100644 index 00000000..ab466216 --- /dev/null +++ b/src/main/resources/templates/mail/creationEmail.html @@ -0,0 +1,20 @@ + + + + JHipster creation + + + + +

Dear

+

Your JHipster account has been created, please click on the URL below to access it:

+

+ Login link +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/src/main/resources/templates/mail/passwordResetEmail.html b/src/main/resources/templates/mail/passwordResetEmail.html new file mode 100644 index 00000000..eb74196f --- /dev/null +++ b/src/main/resources/templates/mail/passwordResetEmail.html @@ -0,0 +1,22 @@ + + + + JHipster password reset + + + + +

Dear

+

+ For your JHipster account a password reset was requested, please click on the URL below to reset it: +

+

+ Login link +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/src/main/webapp/404.html b/src/main/webapp/404.html new file mode 100644 index 00000000..3202d9ac --- /dev/null +++ b/src/main/webapp/404.html @@ -0,0 +1,58 @@ + + + + + Page Not Found + + + + + +

Page Not Found

+

Sorry, but the page you were trying to view does not exist.

+ + + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..f1611b51 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,13 @@ + + + + + html + text/html;charset=utf-8 + + + diff --git a/src/main/webapp/app/account/account.route.ts b/src/main/webapp/app/account/account.route.ts new file mode 100644 index 00000000..a1a8b462 --- /dev/null +++ b/src/main/webapp/app/account/account.route.ts @@ -0,0 +1,19 @@ +import { Routes } from '@angular/router'; + +import activateRoute from './activate/activate.route'; +import passwordRoute from './password/password.route'; +import passwordResetFinishRoute from './password-reset/finish/password-reset-finish.route'; +import passwordResetInitRoute from './password-reset/init/password-reset-init.route'; +import registerRoute from './register/register.route'; +import settingsRoute from './settings/settings.route'; + +const accountRoutes: Routes = [ + activateRoute, + passwordRoute, + passwordResetFinishRoute, + passwordResetInitRoute, + registerRoute, + settingsRoute, +]; + +export default accountRoutes; diff --git a/src/main/webapp/app/account/activate/activate.component.html b/src/main/webapp/app/account/activate/activate.component.html new file mode 100644 index 00000000..3175114e --- /dev/null +++ b/src/main/webapp/app/account/activate/activate.component.html @@ -0,0 +1,16 @@ +
+
+
+

Activation

+ +
+ Your user account has been activated. Please + sign in. +
+ +
+ Your user could not be activated. Please use the registration form to sign up. +
+
+
+
diff --git a/src/main/webapp/app/account/activate/activate.component.spec.ts b/src/main/webapp/app/account/activate/activate.component.spec.ts new file mode 100644 index 00000000..2a227675 --- /dev/null +++ b/src/main/webapp/app/account/activate/activate.component.spec.ts @@ -0,0 +1,68 @@ +import { TestBed, waitForAsync, tick, fakeAsync, inject } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of, throwError } from 'rxjs'; + +import { ActivateService } from './activate.service'; +import ActivateComponent from './activate.component'; + +describe('ActivateComponent', () => { + let comp: ActivateComponent; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, ActivateComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: { queryParams: of({ key: 'ABC123' }) }, + }, + ], + }) + .overrideTemplate(ActivateComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + const fixture = TestBed.createComponent(ActivateComponent); + comp = fixture.componentInstance; + }); + + it('calls activate.get with the key from params', inject( + [ActivateService], + fakeAsync((service: ActivateService) => { + jest.spyOn(service, 'get').mockReturnValue(of()); + + comp.ngOnInit(); + tick(); + + expect(service.get).toHaveBeenCalledWith('ABC123'); + }), + )); + + it('should set set success to true upon successful activation', inject( + [ActivateService], + fakeAsync((service: ActivateService) => { + jest.spyOn(service, 'get').mockReturnValue(of({})); + + comp.ngOnInit(); + tick(); + + expect(comp.error).toBe(false); + expect(comp.success).toBe(true); + }), + )); + + it('should set set error to true upon activation failure', inject( + [ActivateService], + fakeAsync((service: ActivateService) => { + jest.spyOn(service, 'get').mockReturnValue(throwError('ERROR')); + + comp.ngOnInit(); + tick(); + + expect(comp.error).toBe(true); + expect(comp.success).toBe(false); + }), + )); +}); diff --git a/src/main/webapp/app/account/activate/activate.component.ts b/src/main/webapp/app/account/activate/activate.component.ts new file mode 100644 index 00000000..061c703e --- /dev/null +++ b/src/main/webapp/app/account/activate/activate.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, RouterModule } from '@angular/router'; +import { mergeMap } from 'rxjs/operators'; + +import SharedModule from 'app/shared/shared.module'; +import { ActivateService } from './activate.service'; + +@Component({ + selector: 'jhi-activate', + standalone: true, + imports: [SharedModule, RouterModule], + templateUrl: './activate.component.html', +}) +export default class ActivateComponent implements OnInit { + error = false; + success = false; + + constructor( + private activateService: ActivateService, + private route: ActivatedRoute, + ) {} + + ngOnInit(): void { + this.route.queryParams.pipe(mergeMap(params => this.activateService.get(params.key))).subscribe({ + next: () => (this.success = true), + error: () => (this.error = true), + }); + } +} diff --git a/src/main/webapp/app/account/activate/activate.route.ts b/src/main/webapp/app/account/activate/activate.route.ts new file mode 100644 index 00000000..0a1541c8 --- /dev/null +++ b/src/main/webapp/app/account/activate/activate.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import ActivateComponent from './activate.component'; + +const activateRoute: Route = { + path: 'activate', + component: ActivateComponent, + title: 'Activation', +}; + +export default activateRoute; diff --git a/src/main/webapp/app/account/activate/activate.service.spec.ts b/src/main/webapp/app/account/activate/activate.service.spec.ts new file mode 100644 index 00000000..e33b3bf9 --- /dev/null +++ b/src/main/webapp/app/account/activate/activate.service.spec.ts @@ -0,0 +1,47 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { ActivateService } from './activate.service'; + +describe('ActivateService Service', () => { + let service: ActivateService; + let httpMock: HttpTestingController; + let applicationConfigService: ApplicationConfigService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + service = TestBed.inject(ActivateService); + applicationConfigService = TestBed.inject(ApplicationConfigService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call api/activate endpoint with correct values', () => { + // GIVEN + let expectedResult; + const key = 'key'; + const value = true; + + // WHEN + service.get(key).subscribe(received => { + expectedResult = received; + }); + const testRequest = httpMock.expectOne({ + method: 'GET', + url: applicationConfigService.getEndpointFor(`api/activate?key=${key}`), + }); + testRequest.flush(value); + + // THEN + expect(expectedResult).toEqual(value); + }); + }); +}); diff --git a/src/main/webapp/app/account/activate/activate.service.ts b/src/main/webapp/app/account/activate/activate.service.ts new file mode 100644 index 00000000..9e19475b --- /dev/null +++ b/src/main/webapp/app/account/activate/activate.service.ts @@ -0,0 +1,19 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; + +@Injectable({ providedIn: 'root' }) +export class ActivateService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + get(key: string): Observable<{}> { + return this.http.get(this.applicationConfigService.getEndpointFor('api/activate'), { + params: new HttpParams().set('key', key), + }); + } +} diff --git a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html new file mode 100644 index 00000000..286aad32 --- /dev/null +++ b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html @@ -0,0 +1,97 @@ +
+
+
+

Reset password

+ +
The reset key is missing.
+ +
+ Choose a new password +
+ +
+ Your password couldn't be reset. Remember a password request is only valid for 24 hours. +
+ +
+ Your password has been reset. Please + sign in. +
+ +
The password and its confirmation do not match!
+ +
+
+
+ + + +
+ Your password is required. + + Your password is required to be at least 4 characters. + + Your password cannot be longer than 50 characters. +
+ + +
+ +
+ + + +
+ Your confirmation password is required. + + Your confirmation password is required to be at least 4 characters. + + Your confirmation password cannot be longer than 50 characters. +
+
+ + +
+
+
+
+
diff --git a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.spec.ts b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.spec.ts new file mode 100644 index 00000000..2ed7ba2d --- /dev/null +++ b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.spec.ts @@ -0,0 +1,97 @@ +import { ElementRef } from '@angular/core'; +import { ComponentFixture, TestBed, inject, tick, fakeAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { FormBuilder } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; +import { of, throwError } from 'rxjs'; + +import PasswordResetFinishComponent from './password-reset-finish.component'; +import { PasswordResetFinishService } from './password-reset-finish.service'; + +describe('PasswordResetFinishComponent', () => { + let fixture: ComponentFixture; + let comp: PasswordResetFinishComponent; + + beforeEach(() => { + fixture = TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, PasswordResetFinishComponent], + providers: [ + FormBuilder, + { + provide: ActivatedRoute, + useValue: { queryParams: of({ key: 'XYZPDQ' }) }, + }, + ], + }) + .overrideTemplate(PasswordResetFinishComponent, '') + .createComponent(PasswordResetFinishComponent); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PasswordResetFinishComponent); + comp = fixture.componentInstance; + comp.ngOnInit(); + }); + + it('should define its initial state', () => { + expect(comp.initialized).toBe(true); + expect(comp.key).toEqual('XYZPDQ'); + }); + + it('sets focus after the view has been initialized', () => { + const node = { + focus: jest.fn(), + }; + comp.newPassword = new ElementRef(node); + + comp.ngAfterViewInit(); + + expect(node.focus).toHaveBeenCalled(); + }); + + it('should ensure the two passwords entered match', () => { + comp.passwordForm.patchValue({ + newPassword: 'password', + confirmPassword: 'non-matching', + }); + + comp.finishReset(); + + expect(comp.doNotMatch).toBe(true); + }); + + it('should update success to true after resetting password', inject( + [PasswordResetFinishService], + fakeAsync((service: PasswordResetFinishService) => { + jest.spyOn(service, 'save').mockReturnValue(of({})); + comp.passwordForm.patchValue({ + newPassword: 'password', + confirmPassword: 'password', + }); + + comp.finishReset(); + tick(); + + expect(service.save).toHaveBeenCalledWith('XYZPDQ', 'password'); + expect(comp.success).toBe(true); + }), + )); + + it('should notify of generic error', inject( + [PasswordResetFinishService], + fakeAsync((service: PasswordResetFinishService) => { + jest.spyOn(service, 'save').mockReturnValue(throwError('ERROR')); + comp.passwordForm.patchValue({ + newPassword: 'password', + confirmPassword: 'password', + }); + + comp.finishReset(); + tick(); + + expect(service.save).toHaveBeenCalledWith('XYZPDQ', 'password'); + expect(comp.success).toBe(false); + expect(comp.error).toBe(true); + }), + )); +}); diff --git a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts new file mode 100644 index 00000000..00d5758d --- /dev/null +++ b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts @@ -0,0 +1,71 @@ +import { Component, OnInit, AfterViewInit, ElementRef, ViewChild } from '@angular/core'; +import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { ActivatedRoute, RouterModule } from '@angular/router'; +import PasswordStrengthBarComponent from 'app/account/password/password-strength-bar/password-strength-bar.component'; +import SharedModule from 'app/shared/shared.module'; + +import { PasswordResetFinishService } from './password-reset-finish.service'; + +@Component({ + selector: 'jhi-password-reset-finish', + standalone: true, + imports: [SharedModule, RouterModule, FormsModule, ReactiveFormsModule, PasswordStrengthBarComponent], + templateUrl: './password-reset-finish.component.html', +}) +export default class PasswordResetFinishComponent implements OnInit, AfterViewInit { + @ViewChild('newPassword', { static: false }) + newPassword?: ElementRef; + + initialized = false; + doNotMatch = false; + error = false; + success = false; + key = ''; + + passwordForm = new FormGroup({ + newPassword: new FormControl('', { + nonNullable: true, + validators: [Validators.required, Validators.minLength(4), Validators.maxLength(50)], + }), + confirmPassword: new FormControl('', { + nonNullable: true, + validators: [Validators.required, Validators.minLength(4), Validators.maxLength(50)], + }), + }); + + constructor( + private passwordResetFinishService: PasswordResetFinishService, + private route: ActivatedRoute, + ) {} + + ngOnInit(): void { + this.route.queryParams.subscribe(params => { + if (params['key']) { + this.key = params['key']; + } + this.initialized = true; + }); + } + + ngAfterViewInit(): void { + if (this.newPassword) { + this.newPassword.nativeElement.focus(); + } + } + + finishReset(): void { + this.doNotMatch = false; + this.error = false; + + const { newPassword, confirmPassword } = this.passwordForm.getRawValue(); + + if (newPassword !== confirmPassword) { + this.doNotMatch = true; + } else { + this.passwordResetFinishService.save(this.key, newPassword).subscribe({ + next: () => (this.success = true), + error: () => (this.error = true), + }); + } + } +} diff --git a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts new file mode 100644 index 00000000..f0586e88 --- /dev/null +++ b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import PasswordResetFinishComponent from './password-reset-finish.component'; + +const passwordResetFinishRoute: Route = { + path: 'reset/finish', + component: PasswordResetFinishComponent, + title: 'Password', +}; + +export default passwordResetFinishRoute; diff --git a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.spec.ts b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.spec.ts new file mode 100644 index 00000000..da6a8253 --- /dev/null +++ b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.spec.ts @@ -0,0 +1,44 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { PasswordResetFinishService } from './password-reset-finish.service'; + +describe('PasswordResetFinish Service', () => { + let service: PasswordResetFinishService; + let httpMock: HttpTestingController; + let applicationConfigService: ApplicationConfigService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + service = TestBed.inject(PasswordResetFinishService); + applicationConfigService = TestBed.inject(ApplicationConfigService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call reset-password/finish endpoint with correct values', () => { + // GIVEN + const key = 'abc'; + const newPassword = 'password'; + + // WHEN + service.save(key, newPassword).subscribe(); + + const testRequest = httpMock.expectOne({ + method: 'POST', + url: applicationConfigService.getEndpointFor('api/account/reset-password/finish'), + }); + + // THEN + expect(testRequest.request.body).toEqual({ key, newPassword }); + }); + }); +}); diff --git a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts new file mode 100644 index 00000000..3696e10b --- /dev/null +++ b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.service.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; + +@Injectable({ providedIn: 'root' }) +export class PasswordResetFinishService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + save(key: string, newPassword: string): Observable<{}> { + return this.http.post(this.applicationConfigService.getEndpointFor('api/account/reset-password/finish'), { key, newPassword }); + } +} diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html new file mode 100644 index 00000000..26c9096d --- /dev/null +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html @@ -0,0 +1,53 @@ +
+
+
+

Reset your password

+ + + +
+ Enter the email address you used to register +
+ +
+ Check your email for details on how to reset your password. +
+ +
+
+ + + +
+ Your email is required. + + Your email is invalid. + + Your email is required to be at least 5 characters. + + Your email cannot be longer than 50 characters. +
+
+ + +
+
+
+
diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.spec.ts b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.spec.ts new file mode 100644 index 00000000..42f89650 --- /dev/null +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.spec.ts @@ -0,0 +1,62 @@ +import { ElementRef } from '@angular/core'; +import { ComponentFixture, TestBed, inject } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { FormBuilder } from '@angular/forms'; +import { of, throwError } from 'rxjs'; + +import PasswordResetInitComponent from './password-reset-init.component'; +import { PasswordResetInitService } from './password-reset-init.service'; + +describe('PasswordResetInitComponent', () => { + let fixture: ComponentFixture; + let comp: PasswordResetInitComponent; + + beforeEach(() => { + fixture = TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, PasswordResetInitComponent], + providers: [FormBuilder], + }) + .overrideTemplate(PasswordResetInitComponent, '') + .createComponent(PasswordResetInitComponent); + comp = fixture.componentInstance; + }); + + it('sets focus after the view has been initialized', () => { + const node = { + focus: jest.fn(), + }; + comp.email = new ElementRef(node); + + comp.ngAfterViewInit(); + + expect(node.focus).toHaveBeenCalled(); + }); + + it('notifies of success upon successful requestReset', inject([PasswordResetInitService], (service: PasswordResetInitService) => { + jest.spyOn(service, 'save').mockReturnValue(of({})); + comp.resetRequestForm.patchValue({ + email: 'user@domain.com', + }); + + comp.requestReset(); + + expect(service.save).toHaveBeenCalledWith('user@domain.com'); + expect(comp.success).toBe(true); + })); + + it('no notification of success upon error response', inject([PasswordResetInitService], (service: PasswordResetInitService) => { + jest.spyOn(service, 'save').mockReturnValue( + throwError({ + status: 503, + data: 'something else', + }), + ); + comp.resetRequestForm.patchValue({ + email: 'user@domain.com', + }); + comp.requestReset(); + + expect(service.save).toHaveBeenCalledWith('user@domain.com'); + expect(comp.success).toBe(false); + })); +}); diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts new file mode 100644 index 00000000..71cc7418 --- /dev/null +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts @@ -0,0 +1,36 @@ +import { Component, AfterViewInit, ElementRef, ViewChild } from '@angular/core'; +import { FormBuilder, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; +import SharedModule from 'app/shared/shared.module'; + +import { PasswordResetInitService } from './password-reset-init.service'; + +@Component({ + selector: 'jhi-password-reset-init', + standalone: true, + imports: [SharedModule, FormsModule, ReactiveFormsModule], + templateUrl: './password-reset-init.component.html', +}) +export default class PasswordResetInitComponent implements AfterViewInit { + @ViewChild('email', { static: false }) + email?: ElementRef; + + success = false; + resetRequestForm = this.fb.group({ + email: ['', [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email]], + }); + + constructor( + private passwordResetInitService: PasswordResetInitService, + private fb: FormBuilder, + ) {} + + ngAfterViewInit(): void { + if (this.email) { + this.email.nativeElement.focus(); + } + } + + requestReset(): void { + this.passwordResetInitService.save(this.resetRequestForm.get(['email'])!.value).subscribe(() => (this.success = true)); + } +} diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts b/src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts new file mode 100644 index 00000000..e7abb1d2 --- /dev/null +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import PasswordResetInitComponent from './password-reset-init.component'; + +const passwordResetInitRoute: Route = { + path: 'reset/request', + component: PasswordResetInitComponent, + title: 'Password', +}; + +export default passwordResetInitRoute; diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.service.spec.ts b/src/main/webapp/app/account/password-reset/init/password-reset-init.service.spec.ts new file mode 100644 index 00000000..3a05b2d4 --- /dev/null +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.service.spec.ts @@ -0,0 +1,43 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { PasswordResetInitService } from './password-reset-init.service'; + +describe('PasswordResetInit Service', () => { + let service: PasswordResetInitService; + let httpMock: HttpTestingController; + let applicationConfigService: ApplicationConfigService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + service = TestBed.inject(PasswordResetInitService); + applicationConfigService = TestBed.inject(ApplicationConfigService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call reset-password/init endpoint with correct values', () => { + // GIVEN + const mail = 'test@test.com'; + + // WHEN + service.save(mail).subscribe(); + + const testRequest = httpMock.expectOne({ + method: 'POST', + url: applicationConfigService.getEndpointFor('api/account/reset-password/init'), + }); + + // THEN + expect(testRequest.request.body).toEqual(mail); + }); + }); +}); diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts b/src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts new file mode 100644 index 00000000..31ed7e89 --- /dev/null +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.service.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; + +@Injectable({ providedIn: 'root' }) +export class PasswordResetInitService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + save(mail: string): Observable<{}> { + return this.http.post(this.applicationConfigService.getEndpointFor('api/account/reset-password/init'), mail); + } +} diff --git a/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.html b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.html new file mode 100644 index 00000000..c7c72dc6 --- /dev/null +++ b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.html @@ -0,0 +1,10 @@ +
+ Password strength: +
    +
  • +
  • +
  • +
  • +
  • +
+
diff --git a/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.scss b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.scss new file mode 100644 index 00000000..67ce4687 --- /dev/null +++ b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.scss @@ -0,0 +1,23 @@ +/* ========================================================================== +start Password strength bar style +========================================================================== */ +ul#strength { + display: inline; + list-style: none; + margin: 0; + margin-left: 15px; + padding: 0; + vertical-align: 2px; +} + +.point { + background: #ddd; + border-radius: 2px; + display: inline-block; + height: 5px; + margin-right: 1px; + width: 20px; + &:last-child { + margin: 0 !important; + } +} diff --git a/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.spec.ts b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.spec.ts new file mode 100644 index 00000000..9fd533a7 --- /dev/null +++ b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.spec.ts @@ -0,0 +1,46 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; + +import PasswordStrengthBarComponent from './password-strength-bar.component'; + +describe('PasswordStrengthBarComponent', () => { + let comp: PasswordStrengthBarComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [PasswordStrengthBarComponent], + }) + .overrideTemplate(PasswordStrengthBarComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PasswordStrengthBarComponent); + comp = fixture.componentInstance; + }); + + describe('PasswordStrengthBarComponents', () => { + it('should initialize with default values', () => { + expect(comp.measureStrength('')).toBe(0); + expect(comp.colors).toEqual(['#F00', '#F90', '#FF0', '#9F0', '#0F0']); + expect(comp.getColor(0).idx).toBe(1); + expect(comp.getColor(0).color).toBe(comp.colors[0]); + }); + + it('should increase strength upon password value change', () => { + expect(comp.measureStrength('')).toBe(0); + expect(comp.measureStrength('aa')).toBeGreaterThanOrEqual(comp.measureStrength('')); + expect(comp.measureStrength('aa^6')).toBeGreaterThanOrEqual(comp.measureStrength('aa')); + expect(comp.measureStrength('Aa090(**)')).toBeGreaterThanOrEqual(comp.measureStrength('aa^6')); + expect(comp.measureStrength('Aa090(**)+-07365')).toBeGreaterThanOrEqual(comp.measureStrength('Aa090(**)')); + }); + + it('should change the color based on strength', () => { + expect(comp.getColor(0).color).toBe(comp.colors[0]); + expect(comp.getColor(11).color).toBe(comp.colors[1]); + expect(comp.getColor(22).color).toBe(comp.colors[2]); + expect(comp.getColor(33).color).toBe(comp.colors[3]); + expect(comp.getColor(44).color).toBe(comp.colors[4]); + }); + }); +}); diff --git a/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts new file mode 100644 index 00000000..7f703fa6 --- /dev/null +++ b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts @@ -0,0 +1,79 @@ +import { Component, ElementRef, Input, Renderer2 } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; + +@Component({ + selector: 'jhi-password-strength-bar', + standalone: true, + imports: [SharedModule], + templateUrl: './password-strength-bar.component.html', + styleUrls: ['./password-strength-bar.component.scss'], +}) +export default class PasswordStrengthBarComponent { + colors = ['#F00', '#F90', '#FF0', '#9F0', '#0F0']; + + constructor( + private renderer: Renderer2, + private elementRef: ElementRef, + ) {} + + measureStrength(p: string): number { + let force = 0; + const regex = /[$-/:-?{-~!"^_`[\]]/g; // " + const lowerLetters = /[a-z]+/.test(p); + const upperLetters = /[A-Z]+/.test(p); + const numbers = /\d+/.test(p); + const symbols = regex.test(p); + + const flags = [lowerLetters, upperLetters, numbers, symbols]; + const passedMatches = flags.filter((isMatchedFlag: boolean) => isMatchedFlag === true).length; + + force += 2 * p.length + (p.length >= 10 ? 1 : 0); + force += passedMatches * 10; + + // penalty (short password) + force = p.length <= 6 ? Math.min(force, 10) : force; + + // penalty (poor variety of characters) + force = passedMatches === 1 ? Math.min(force, 10) : force; + force = passedMatches === 2 ? Math.min(force, 20) : force; + force = passedMatches === 3 ? Math.min(force, 40) : force; + + return force; + } + + getColor(s: number): { idx: number; color: string } { + let idx = 0; + if (s > 10) { + if (s <= 20) { + idx = 1; + } else if (s <= 30) { + idx = 2; + } else if (s <= 40) { + idx = 3; + } else { + idx = 4; + } + } + return { idx: idx + 1, color: this.colors[idx] }; + } + + @Input() + set passwordToCheck(password: string) { + if (password) { + const c = this.getColor(this.measureStrength(password)); + const element = this.elementRef.nativeElement; + if (element.className) { + this.renderer.removeClass(element, element.className); + } + const lis = element.getElementsByTagName('li'); + for (let i = 0; i < lis.length; i++) { + if (i < c.idx) { + this.renderer.setStyle(lis[i], 'backgroundColor', c.color); + } else { + this.renderer.setStyle(lis[i], 'backgroundColor', '#DDD'); + } + } + } + } +} diff --git a/src/main/webapp/app/account/password/password.component.html b/src/main/webapp/app/account/password/password.component.html new file mode 100644 index 00000000..759f4ac3 --- /dev/null +++ b/src/main/webapp/app/account/password/password.component.html @@ -0,0 +1,110 @@ +
+
+
+

+ Password for [{{ account.login }}] +

+ +
Password changed!
+ +
An error has occurred! The password could not be changed.
+ +
The password and its confirmation do not match!
+ +
+
+ + + +
+ Your password is required. +
+
+ +
+ + + +
+ Your password is required. + + Your password is required to be at least 4 characters. + + Your password cannot be longer than 50 characters. +
+ + +
+ +
+ + + +
+ Your confirmation password is required. + + Your confirmation password is required to be at least 4 characters. + + Your confirmation password cannot be longer than 50 characters. +
+
+ + +
+
+
+
diff --git a/src/main/webapp/app/account/password/password.component.spec.ts b/src/main/webapp/app/account/password/password.component.spec.ts new file mode 100644 index 00000000..50cd6c05 --- /dev/null +++ b/src/main/webapp/app/account/password/password.component.spec.ts @@ -0,0 +1,103 @@ +jest.mock('app/core/auth/account.service'); + +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpResponse } from '@angular/common/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { FormBuilder } from '@angular/forms'; +import { of, throwError } from 'rxjs'; + +import { AccountService } from 'app/core/auth/account.service'; + +import PasswordComponent from './password.component'; +import { PasswordService } from './password.service'; + +describe('PasswordComponent', () => { + let comp: PasswordComponent; + let fixture: ComponentFixture; + let service: PasswordService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, PasswordComponent], + providers: [FormBuilder, AccountService], + }) + .overrideTemplate(PasswordComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PasswordComponent); + comp = fixture.componentInstance; + service = TestBed.inject(PasswordService); + }); + + it('should show error if passwords do not match', () => { + // GIVEN + comp.passwordForm.patchValue({ + newPassword: 'password1', + confirmPassword: 'password2', + }); + // WHEN + comp.changePassword(); + // THEN + expect(comp.doNotMatch).toBe(true); + expect(comp.error).toBe(false); + expect(comp.success).toBe(false); + }); + + it('should call Auth.changePassword when passwords match', () => { + // GIVEN + const passwordValues = { + currentPassword: 'oldPassword', + newPassword: 'myPassword', + }; + + jest.spyOn(service, 'save').mockReturnValue(of(new HttpResponse({ body: true }))); + + comp.passwordForm.patchValue({ + currentPassword: passwordValues.currentPassword, + newPassword: passwordValues.newPassword, + confirmPassword: passwordValues.newPassword, + }); + + // WHEN + comp.changePassword(); + + // THEN + expect(service.save).toHaveBeenCalledWith(passwordValues.newPassword, passwordValues.currentPassword); + }); + + it('should set success to true upon success', () => { + // GIVEN + jest.spyOn(service, 'save').mockReturnValue(of(new HttpResponse({ body: true }))); + comp.passwordForm.patchValue({ + newPassword: 'myPassword', + confirmPassword: 'myPassword', + }); + + // WHEN + comp.changePassword(); + + // THEN + expect(comp.doNotMatch).toBe(false); + expect(comp.error).toBe(false); + expect(comp.success).toBe(true); + }); + + it('should notify of error if change password fails', () => { + // GIVEN + jest.spyOn(service, 'save').mockReturnValue(throwError('ERROR')); + comp.passwordForm.patchValue({ + newPassword: 'myPassword', + confirmPassword: 'myPassword', + }); + + // WHEN + comp.changePassword(); + + // THEN + expect(comp.doNotMatch).toBe(false); + expect(comp.success).toBe(false); + expect(comp.error).toBe(true); + }); +}); diff --git a/src/main/webapp/app/account/password/password.component.ts b/src/main/webapp/app/account/password/password.component.ts new file mode 100644 index 00000000..7a086432 --- /dev/null +++ b/src/main/webapp/app/account/password/password.component.ts @@ -0,0 +1,58 @@ +import { Component, OnInit } from '@angular/core'; +import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { Observable } from 'rxjs'; + +import SharedModule from 'app/shared/shared.module'; +import { AccountService } from 'app/core/auth/account.service'; +import { Account } from 'app/core/auth/account.model'; +import { PasswordService } from './password.service'; +import PasswordStrengthBarComponent from './password-strength-bar/password-strength-bar.component'; + +@Component({ + selector: 'jhi-password', + standalone: true, + imports: [SharedModule, FormsModule, ReactiveFormsModule, PasswordStrengthBarComponent], + templateUrl: './password.component.html', +}) +export default class PasswordComponent implements OnInit { + doNotMatch = false; + error = false; + success = false; + account$?: Observable; + passwordForm = new FormGroup({ + currentPassword: new FormControl('', { nonNullable: true, validators: Validators.required }), + newPassword: new FormControl('', { + nonNullable: true, + validators: [Validators.required, Validators.minLength(4), Validators.maxLength(50)], + }), + confirmPassword: new FormControl('', { + nonNullable: true, + validators: [Validators.required, Validators.minLength(4), Validators.maxLength(50)], + }), + }); + + constructor( + private passwordService: PasswordService, + private accountService: AccountService, + ) {} + + ngOnInit(): void { + this.account$ = this.accountService.identity(); + } + + changePassword(): void { + this.error = false; + this.success = false; + this.doNotMatch = false; + + const { newPassword, confirmPassword, currentPassword } = this.passwordForm.getRawValue(); + if (newPassword !== confirmPassword) { + this.doNotMatch = true; + } else { + this.passwordService.save(newPassword, currentPassword).subscribe({ + next: () => (this.success = true), + error: () => (this.error = true), + }); + } + } +} diff --git a/src/main/webapp/app/account/password/password.route.ts b/src/main/webapp/app/account/password/password.route.ts new file mode 100644 index 00000000..1713610d --- /dev/null +++ b/src/main/webapp/app/account/password/password.route.ts @@ -0,0 +1,13 @@ +import { Route } from '@angular/router'; + +import { UserRouteAccessService } from 'app/core/auth/user-route-access.service'; +import PasswordComponent from './password.component'; + +const passwordRoute: Route = { + path: 'password', + component: PasswordComponent, + title: 'Password', + canActivate: [UserRouteAccessService], +}; + +export default passwordRoute; diff --git a/src/main/webapp/app/account/password/password.service.spec.ts b/src/main/webapp/app/account/password/password.service.spec.ts new file mode 100644 index 00000000..b669e5a3 --- /dev/null +++ b/src/main/webapp/app/account/password/password.service.spec.ts @@ -0,0 +1,44 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { PasswordService } from './password.service'; + +describe('Password Service', () => { + let service: PasswordService; + let httpMock: HttpTestingController; + let applicationConfigService: ApplicationConfigService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + service = TestBed.inject(PasswordService); + applicationConfigService = TestBed.inject(ApplicationConfigService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call change-password endpoint with correct values', () => { + // GIVEN + const password1 = 'password1'; + const password2 = 'password2'; + + // WHEN + service.save(password2, password1).subscribe(); + + const testRequest = httpMock.expectOne({ + method: 'POST', + url: applicationConfigService.getEndpointFor('api/account/change-password'), + }); + + // THEN + expect(testRequest.request.body).toEqual({ currentPassword: password1, newPassword: password2 }); + }); + }); +}); diff --git a/src/main/webapp/app/account/password/password.service.ts b/src/main/webapp/app/account/password/password.service.ts new file mode 100644 index 00000000..e29258f5 --- /dev/null +++ b/src/main/webapp/app/account/password/password.service.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; + +@Injectable({ providedIn: 'root' }) +export class PasswordService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + save(newPassword: string, currentPassword: string): Observable<{}> { + return this.http.post(this.applicationConfigService.getEndpointFor('api/account/change-password'), { currentPassword, newPassword }); + } +} diff --git a/src/main/webapp/app/account/register/register.component.html b/src/main/webapp/app/account/register/register.component.html new file mode 100644 index 00000000..29384f45 --- /dev/null +++ b/src/main/webapp/app/account/register/register.component.html @@ -0,0 +1,152 @@ +
+
+
+

Registration

+ +
Registration saved! Please check your email for confirmation.
+ +
Registration failed! Please try again later.
+ +
+ Login name already registered! Please choose another one. +
+ +
Email is already in use! Please choose another one.
+ +
The password and its confirmation do not match!
+
+
+ +
+
+
+
+ + + +
+ Your username is required. + + Your username is required to be at least 1 character. + + Your username cannot be longer than 50 characters. + + Your username is invalid. +
+
+ +
+ + + +
+ Your email is required. + + Your email is invalid. + + Your email is required to be at least 5 characters. + + Your email cannot be longer than 50 characters. +
+
+ +
+ + + +
+ Your password is required. + + Your password is required to be at least 4 characters. + + Your password cannot be longer than 50 characters. +
+ + +
+ +
+ + + +
+ Your confirmation password is required. + + Your confirmation password is required to be at least 4 characters. + + Your confirmation password cannot be longer than 50 characters. +
+
+ + +
+ +
+ If you want to + sign in, you can try the default accounts:
- Administrator (login="admin" and password="admin")
- User (login="user" and + password="user").
+
+
+
+
diff --git a/src/main/webapp/app/account/register/register.component.spec.ts b/src/main/webapp/app/account/register/register.component.spec.ts new file mode 100644 index 00000000..bbe17d84 --- /dev/null +++ b/src/main/webapp/app/account/register/register.component.spec.ts @@ -0,0 +1,132 @@ +import { ComponentFixture, TestBed, waitForAsync, inject, tick, fakeAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { FormBuilder } from '@angular/forms'; +import { of, throwError } from 'rxjs'; + +import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from 'app/config/error.constants'; + +import { RegisterService } from './register.service'; +import RegisterComponent from './register.component'; + +describe('RegisterComponent', () => { + let fixture: ComponentFixture; + let comp: RegisterComponent; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, RegisterComponent], + providers: [FormBuilder], + }) + .overrideTemplate(RegisterComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RegisterComponent); + comp = fixture.componentInstance; + }); + + it('should ensure the two passwords entered match', () => { + comp.registerForm.patchValue({ + password: 'password', + confirmPassword: 'non-matching', + }); + + comp.register(); + + expect(comp.doNotMatch).toBe(true); + }); + + it('should update success to true after creating an account', inject( + [RegisterService], + fakeAsync((service: RegisterService) => { + jest.spyOn(service, 'save').mockReturnValue(of({})); + comp.registerForm.patchValue({ + password: 'password', + confirmPassword: 'password', + }); + + comp.register(); + tick(); + + expect(service.save).toHaveBeenCalledWith({ + email: '', + password: 'password', + login: '', + langKey: 'en', + }); + expect(comp.success).toBe(true); + expect(comp.errorUserExists).toBe(false); + expect(comp.errorEmailExists).toBe(false); + expect(comp.error).toBe(false); + }), + )); + + it('should notify of user existence upon 400/login already in use', inject( + [RegisterService], + fakeAsync((service: RegisterService) => { + jest.spyOn(service, 'save').mockReturnValue( + throwError({ + status: 400, + error: { type: LOGIN_ALREADY_USED_TYPE }, + }), + ); + comp.registerForm.patchValue({ + password: 'password', + confirmPassword: 'password', + }); + + comp.register(); + tick(); + + expect(comp.errorUserExists).toBe(true); + expect(comp.errorEmailExists).toBe(false); + expect(comp.error).toBe(false); + }), + )); + + it('should notify of email existence upon 400/email address already in use', inject( + [RegisterService], + fakeAsync((service: RegisterService) => { + jest.spyOn(service, 'save').mockReturnValue( + throwError({ + status: 400, + error: { type: EMAIL_ALREADY_USED_TYPE }, + }), + ); + comp.registerForm.patchValue({ + password: 'password', + confirmPassword: 'password', + }); + + comp.register(); + tick(); + + expect(comp.errorEmailExists).toBe(true); + expect(comp.errorUserExists).toBe(false); + expect(comp.error).toBe(false); + }), + )); + + it('should notify of generic error', inject( + [RegisterService], + fakeAsync((service: RegisterService) => { + jest.spyOn(service, 'save').mockReturnValue( + throwError({ + status: 503, + }), + ); + comp.registerForm.patchValue({ + password: 'password', + confirmPassword: 'password', + }); + + comp.register(); + tick(); + + expect(comp.errorUserExists).toBe(false); + expect(comp.errorEmailExists).toBe(false); + expect(comp.error).toBe(true); + }), + )); +}); diff --git a/src/main/webapp/app/account/register/register.component.ts b/src/main/webapp/app/account/register/register.component.ts new file mode 100644 index 00000000..a0848550 --- /dev/null +++ b/src/main/webapp/app/account/register/register.component.ts @@ -0,0 +1,85 @@ +import { Component, AfterViewInit, ElementRef, ViewChild } from '@angular/core'; +import { HttpErrorResponse } from '@angular/common/http'; +import { RouterModule } from '@angular/router'; +import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms'; + +import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from 'app/config/error.constants'; +import SharedModule from 'app/shared/shared.module'; +import PasswordStrengthBarComponent from '../password/password-strength-bar/password-strength-bar.component'; +import { RegisterService } from './register.service'; + +@Component({ + selector: 'jhi-register', + standalone: true, + imports: [SharedModule, RouterModule, FormsModule, ReactiveFormsModule, PasswordStrengthBarComponent], + templateUrl: './register.component.html', +}) +export default class RegisterComponent implements AfterViewInit { + @ViewChild('login', { static: false }) + login?: ElementRef; + + doNotMatch = false; + error = false; + errorEmailExists = false; + errorUserExists = false; + success = false; + + registerForm = new FormGroup({ + login: new FormControl('', { + nonNullable: true, + validators: [ + Validators.required, + Validators.minLength(1), + Validators.maxLength(50), + Validators.pattern('^[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$|^[_.@A-Za-z0-9-]+$'), + ], + }), + email: new FormControl('', { + nonNullable: true, + validators: [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email], + }), + password: new FormControl('', { + nonNullable: true, + validators: [Validators.required, Validators.minLength(4), Validators.maxLength(50)], + }), + confirmPassword: new FormControl('', { + nonNullable: true, + validators: [Validators.required, Validators.minLength(4), Validators.maxLength(50)], + }), + }); + + constructor(private registerService: RegisterService) {} + + ngAfterViewInit(): void { + if (this.login) { + this.login.nativeElement.focus(); + } + } + + register(): void { + this.doNotMatch = false; + this.error = false; + this.errorEmailExists = false; + this.errorUserExists = false; + + const { password, confirmPassword } = this.registerForm.getRawValue(); + if (password !== confirmPassword) { + this.doNotMatch = true; + } else { + const { login, email } = this.registerForm.getRawValue(); + this.registerService + .save({ login, email, password, langKey: 'en' }) + .subscribe({ next: () => (this.success = true), error: response => this.processError(response) }); + } + } + + private processError(response: HttpErrorResponse): void { + if (response.status === 400 && response.error.type === LOGIN_ALREADY_USED_TYPE) { + this.errorUserExists = true; + } else if (response.status === 400 && response.error.type === EMAIL_ALREADY_USED_TYPE) { + this.errorEmailExists = true; + } else { + this.error = true; + } + } +} diff --git a/src/main/webapp/app/account/register/register.model.ts b/src/main/webapp/app/account/register/register.model.ts new file mode 100644 index 00000000..02e04a14 --- /dev/null +++ b/src/main/webapp/app/account/register/register.model.ts @@ -0,0 +1,8 @@ +export class Registration { + constructor( + public login: string, + public email: string, + public password: string, + public langKey: string, + ) {} +} diff --git a/src/main/webapp/app/account/register/register.route.ts b/src/main/webapp/app/account/register/register.route.ts new file mode 100644 index 00000000..99b0f36e --- /dev/null +++ b/src/main/webapp/app/account/register/register.route.ts @@ -0,0 +1,11 @@ +import { Route } from '@angular/router'; + +import RegisterComponent from './register.component'; + +const registerRoute: Route = { + path: 'register', + component: RegisterComponent, + title: 'Registration', +}; + +export default registerRoute; diff --git a/src/main/webapp/app/account/register/register.service.spec.ts b/src/main/webapp/app/account/register/register.service.spec.ts new file mode 100644 index 00000000..fb9d8a73 --- /dev/null +++ b/src/main/webapp/app/account/register/register.service.spec.ts @@ -0,0 +1,48 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { RegisterService } from './register.service'; +import { Registration } from './register.model'; + +describe('RegisterService Service', () => { + let service: RegisterService; + let httpMock: HttpTestingController; + let applicationConfigService: ApplicationConfigService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + service = TestBed.inject(RegisterService); + applicationConfigService = TestBed.inject(ApplicationConfigService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call register endpoint with correct values', () => { + // GIVEN + const login = 'abc'; + const email = 'test@test.com'; + const password = 'pass'; + const langKey = 'FR'; + const registration = new Registration(login, email, password, langKey); + + // WHEN + service.save(registration).subscribe(); + + const testRequest = httpMock.expectOne({ + method: 'POST', + url: applicationConfigService.getEndpointFor('api/register'), + }); + + // THEN + expect(testRequest.request.body).toEqual({ email, langKey, login, password }); + }); + }); +}); diff --git a/src/main/webapp/app/account/register/register.service.ts b/src/main/webapp/app/account/register/register.service.ts new file mode 100644 index 00000000..29c18330 --- /dev/null +++ b/src/main/webapp/app/account/register/register.service.ts @@ -0,0 +1,18 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { Registration } from './register.model'; + +@Injectable({ providedIn: 'root' }) +export class RegisterService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + save(registration: Registration): Observable<{}> { + return this.http.post(this.applicationConfigService.getEndpointFor('api/register'), registration); + } +} diff --git a/src/main/webapp/app/account/settings/settings.component.html b/src/main/webapp/app/account/settings/settings.component.html new file mode 100644 index 00000000..c0d86417 --- /dev/null +++ b/src/main/webapp/app/account/settings/settings.component.html @@ -0,0 +1,103 @@ +
+
+
+

+ User settings for [{{ settingsForm.value.login }}] +

+ +
Settings saved!
+ + + +
+
+ + + +
+ Your first name is required. + + Your first name is required to be at least 1 character + + Your first name cannot be longer than 50 characters +
+
+ +
+ + + +
+ Your last name is required. + + Your last name is required to be at least 1 character + + Your last name cannot be longer than 50 characters +
+
+ +
+ + + +
+ Your email is required. + + Your email is invalid. + + Your email is required to be at least 5 characters. + + Your email cannot be longer than 50 characters. +
+
+ + +
+
+
+
diff --git a/src/main/webapp/app/account/settings/settings.component.spec.ts b/src/main/webapp/app/account/settings/settings.component.spec.ts new file mode 100644 index 00000000..72e90f3c --- /dev/null +++ b/src/main/webapp/app/account/settings/settings.component.spec.ts @@ -0,0 +1,88 @@ +jest.mock('app/core/auth/account.service'); + +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { FormBuilder } from '@angular/forms'; +import { throwError, of } from 'rxjs'; + +import { AccountService } from 'app/core/auth/account.service'; +import { Account } from 'app/core/auth/account.model'; + +import SettingsComponent from './settings.component'; + +describe('SettingsComponent', () => { + let comp: SettingsComponent; + let fixture: ComponentFixture; + let mockAccountService: AccountService; + const account: Account = { + firstName: 'John', + lastName: 'Doe', + activated: true, + email: 'john.doe@mail.com', + langKey: 'en', + login: 'john', + authorities: [], + imageUrl: '', + }; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, SettingsComponent], + providers: [FormBuilder, AccountService], + }) + .overrideTemplate(SettingsComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SettingsComponent); + comp = fixture.componentInstance; + mockAccountService = TestBed.inject(AccountService); + mockAccountService.identity = jest.fn(() => of(account)); + mockAccountService.getAuthenticationState = jest.fn(() => of(account)); + }); + + it('should send the current identity upon save', () => { + // GIVEN + mockAccountService.save = jest.fn(() => of({})); + const settingsFormValues = { + firstName: 'John', + lastName: 'Doe', + email: 'john.doe@mail.com', + }; + + // WHEN + comp.ngOnInit(); + comp.save(); + + // THEN + expect(mockAccountService.identity).toHaveBeenCalled(); + expect(mockAccountService.save).toHaveBeenCalledWith(account); + expect(mockAccountService.authenticate).toHaveBeenCalledWith(account); + expect(comp.settingsForm.value).toMatchObject(expect.objectContaining(settingsFormValues)); + }); + + it('should notify of success upon successful save', () => { + // GIVEN + mockAccountService.save = jest.fn(() => of({})); + + // WHEN + comp.ngOnInit(); + comp.save(); + + // THEN + expect(comp.success).toBe(true); + }); + + it('should notify of error upon failed save', () => { + // GIVEN + mockAccountService.save = jest.fn(() => throwError('ERROR')); + + // WHEN + comp.ngOnInit(); + comp.save(); + + // THEN + expect(comp.success).toBe(false); + }); +}); diff --git a/src/main/webapp/app/account/settings/settings.component.ts b/src/main/webapp/app/account/settings/settings.component.ts new file mode 100644 index 00000000..3edffa1c --- /dev/null +++ b/src/main/webapp/app/account/settings/settings.component.ts @@ -0,0 +1,60 @@ +import { Component, OnInit } from '@angular/core'; +import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms'; + +import SharedModule from 'app/shared/shared.module'; +import { AccountService } from 'app/core/auth/account.service'; +import { Account } from 'app/core/auth/account.model'; + +const initialAccount: Account = {} as Account; + +@Component({ + selector: 'jhi-settings', + standalone: true, + imports: [SharedModule, FormsModule, ReactiveFormsModule], + templateUrl: './settings.component.html', +}) +export default class SettingsComponent implements OnInit { + success = false; + + settingsForm = new FormGroup({ + firstName: new FormControl(initialAccount.firstName, { + nonNullable: true, + validators: [Validators.required, Validators.minLength(1), Validators.maxLength(50)], + }), + lastName: new FormControl(initialAccount.lastName, { + nonNullable: true, + validators: [Validators.required, Validators.minLength(1), Validators.maxLength(50)], + }), + email: new FormControl(initialAccount.email, { + nonNullable: true, + validators: [Validators.required, Validators.minLength(5), Validators.maxLength(254), Validators.email], + }), + langKey: new FormControl(initialAccount.langKey, { nonNullable: true }), + + activated: new FormControl(initialAccount.activated, { nonNullable: true }), + authorities: new FormControl(initialAccount.authorities, { nonNullable: true }), + imageUrl: new FormControl(initialAccount.imageUrl, { nonNullable: true }), + login: new FormControl(initialAccount.login, { nonNullable: true }), + }); + + constructor(private accountService: AccountService) {} + + ngOnInit(): void { + this.accountService.identity().subscribe(account => { + if (account) { + this.settingsForm.patchValue(account); + } + }); + } + + save(): void { + this.success = false; + + const account = this.settingsForm.getRawValue(); + this.accountService.save(account).subscribe(() => { + this.success = true; + + this.accountService.authenticate(account); + }); + } +} diff --git a/src/main/webapp/app/account/settings/settings.route.ts b/src/main/webapp/app/account/settings/settings.route.ts new file mode 100644 index 00000000..67570abf --- /dev/null +++ b/src/main/webapp/app/account/settings/settings.route.ts @@ -0,0 +1,13 @@ +import { Route } from '@angular/router'; + +import { UserRouteAccessService } from 'app/core/auth/user-route-access.service'; +import SettingsComponent from './settings.component'; + +const settingsRoute: Route = { + path: 'settings', + component: SettingsComponent, + title: 'Settings', + canActivate: [UserRouteAccessService], +}; + +export default settingsRoute; diff --git a/src/main/webapp/app/admin/admin-routing.module.ts b/src/main/webapp/app/admin/admin-routing.module.ts new file mode 100644 index 00000000..dc1eccc7 --- /dev/null +++ b/src/main/webapp/app/admin/admin-routing.module.ts @@ -0,0 +1,48 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; +/* jhipster-needle-add-admin-module-import - JHipster will add admin modules imports here */ + +@NgModule({ + imports: [ + /* jhipster-needle-add-admin-module - JHipster will add admin modules here */ + RouterModule.forChild([ + { + path: 'user-management', + loadChildren: () => import('./user-management/user-management.route'), + title: 'Users', + }, + { + path: 'docs', + loadComponent: () => import('./docs/docs.component'), + title: 'API', + }, + { + path: 'configuration', + loadComponent: () => import('./configuration/configuration.component'), + title: 'Configuration', + }, + { + path: 'health', + loadComponent: () => import('./health/health.component'), + title: 'Health Checks', + }, + { + path: 'logs', + loadComponent: () => import('./logs/logs.component'), + title: 'Logs', + }, + { + path: 'metrics', + loadComponent: () => import('./metrics/metrics.component'), + title: 'Application Metrics', + }, + { + path: 'tracker', + loadComponent: () => import('./tracker/tracker.component'), + title: 'Real-time user activities', + }, + /* jhipster-needle-add-admin-route - JHipster will add admin routes here */ + ]), + ], +}) +export default class AdminRoutingModule {} diff --git a/src/main/webapp/app/admin/configuration/configuration.component.html b/src/main/webapp/app/admin/configuration/configuration.component.html new file mode 100644 index 00000000..1e35c674 --- /dev/null +++ b/src/main/webapp/app/admin/configuration/configuration.component.html @@ -0,0 +1,55 @@ +
+

Configuration

+ + Filter (by prefix) + + +

Spring configuration

+ + + + + + + + + + + + + + +
Prefix Properties
+ {{ bean.prefix }} + +
+
{{ property.key }}
+
+ {{ property.value | json }} +
+
+
+ +
+

+ {{ propertySource.name }} +

+ + + + + + + + + + + + + + +
PropertyValue
{{ property.key }} + {{ property.value.value }} +
+
+
diff --git a/src/main/webapp/app/admin/configuration/configuration.component.spec.ts b/src/main/webapp/app/admin/configuration/configuration.component.spec.ts new file mode 100644 index 00000000..cebc2793 --- /dev/null +++ b/src/main/webapp/app/admin/configuration/configuration.component.spec.ts @@ -0,0 +1,66 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { of } from 'rxjs'; + +import ConfigurationComponent from './configuration.component'; +import { ConfigurationService } from './configuration.service'; +import { Bean, PropertySource } from './configuration.model'; + +describe('ConfigurationComponent', () => { + let comp: ConfigurationComponent; + let fixture: ComponentFixture; + let service: ConfigurationService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, ConfigurationComponent], + providers: [ConfigurationService], + }) + .overrideTemplate(ConfigurationComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfigurationComponent); + comp = fixture.componentInstance; + service = TestBed.inject(ConfigurationService); + }); + + describe('OnInit', () => { + it('Should call load all on init', () => { + // GIVEN + const beans: Bean[] = [ + { + prefix: 'jhipster', + properties: { + clientApp: { + name: 'jhipsterApp', + }, + }, + }, + ]; + const propertySources: PropertySource[] = [ + { + name: 'server.ports', + properties: { + 'local.server.port': { + value: '8080', + }, + }, + }, + ]; + jest.spyOn(service, 'getBeans').mockReturnValue(of(beans)); + jest.spyOn(service, 'getPropertySources').mockReturnValue(of(propertySources)); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.getBeans).toHaveBeenCalled(); + expect(service.getPropertySources).toHaveBeenCalled(); + expect(comp.allBeans).toEqual(beans); + expect(comp.beans).toEqual(beans); + expect(comp.propertySources).toEqual(propertySources); + }); + }); +}); diff --git a/src/main/webapp/app/admin/configuration/configuration.component.ts b/src/main/webapp/app/admin/configuration/configuration.component.ts new file mode 100644 index 00000000..ee97f6bc --- /dev/null +++ b/src/main/webapp/app/admin/configuration/configuration.component.ts @@ -0,0 +1,40 @@ +import { Component, OnInit } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; +import { FormsModule } from '@angular/forms'; +import { SortDirective, SortByDirective } from 'app/shared/sort'; +import { ConfigurationService } from './configuration.service'; +import { Bean, PropertySource } from './configuration.model'; + +@Component({ + standalone: true, + selector: 'jhi-configuration', + templateUrl: './configuration.component.html', + imports: [SharedModule, FormsModule, SortDirective, SortByDirective], +}) +export default class ConfigurationComponent implements OnInit { + allBeans!: Bean[]; + beans: Bean[] = []; + beansFilter = ''; + beansAscending = true; + propertySources: PropertySource[] = []; + + constructor(private configurationService: ConfigurationService) {} + + ngOnInit(): void { + this.configurationService.getBeans().subscribe(beans => { + this.allBeans = beans; + this.filterAndSortBeans(); + }); + + this.configurationService.getPropertySources().subscribe(propertySources => (this.propertySources = propertySources)); + } + + filterAndSortBeans(): void { + const beansAscendingValue = this.beansAscending ? -1 : 1; + const beansAscendingValueReverse = this.beansAscending ? 1 : -1; + this.beans = this.allBeans + .filter(bean => !this.beansFilter || bean.prefix.toLowerCase().includes(this.beansFilter.toLowerCase())) + .sort((a, b) => (a.prefix < b.prefix ? beansAscendingValue : beansAscendingValueReverse)); + } +} diff --git a/src/main/webapp/app/admin/configuration/configuration.model.ts b/src/main/webapp/app/admin/configuration/configuration.model.ts new file mode 100644 index 00000000..6a671e0a --- /dev/null +++ b/src/main/webapp/app/admin/configuration/configuration.model.ts @@ -0,0 +1,40 @@ +export interface ConfigProps { + contexts: Contexts; +} + +export interface Contexts { + [key: string]: Context; +} + +export interface Context { + beans: Beans; + parentId?: any; +} + +export interface Beans { + [key: string]: Bean; +} + +export interface Bean { + prefix: string; + properties: any; +} + +export interface Env { + activeProfiles?: string[]; + propertySources: PropertySource[]; +} + +export interface PropertySource { + name: string; + properties: Properties; +} + +export interface Properties { + [key: string]: Property; +} + +export interface Property { + value: string; + origin?: string; +} diff --git a/src/main/webapp/app/admin/configuration/configuration.service.spec.ts b/src/main/webapp/app/admin/configuration/configuration.service.spec.ts new file mode 100644 index 00000000..6e6ff7f4 --- /dev/null +++ b/src/main/webapp/app/admin/configuration/configuration.service.spec.ts @@ -0,0 +1,71 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { ConfigurationService } from './configuration.service'; +import { Bean, ConfigProps, Env, PropertySource } from './configuration.model'; + +describe('Logs Service', () => { + let service: ConfigurationService; + let httpMock: HttpTestingController; + let expectedResult: Bean[] | PropertySource[] | null; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + expectedResult = null; + service = TestBed.inject(ConfigurationService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should get the config', () => { + const bean: Bean = { + prefix: 'jhipster', + properties: { + clientApp: { + name: 'jhipsterApp', + }, + }, + }; + const configProps: ConfigProps = { + contexts: { + jhipster: { + beans: { + 'tech.jhipster.config.JHipsterProperties': bean, + }, + }, + }, + }; + service.getBeans().subscribe(received => (expectedResult = received)); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(configProps); + expect(expectedResult).toEqual([bean]); + }); + + it('should get the env', () => { + const propertySources: PropertySource[] = [ + { + name: 'server.ports', + properties: { + 'local.server.port': { + value: '8080', + }, + }, + }, + ]; + const env: Env = { propertySources }; + service.getPropertySources().subscribe(received => (expectedResult = received)); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(env); + expect(expectedResult).toEqual(propertySources); + }); + }); +}); diff --git a/src/main/webapp/app/admin/configuration/configuration.service.ts b/src/main/webapp/app/admin/configuration/configuration.service.ts new file mode 100644 index 00000000..f03a0cce --- /dev/null +++ b/src/main/webapp/app/admin/configuration/configuration.service.ts @@ -0,0 +1,31 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { Bean, Beans, ConfigProps, Env, PropertySource } from './configuration.model'; + +@Injectable({ providedIn: 'root' }) +export class ConfigurationService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + getBeans(): Observable { + return this.http.get(this.applicationConfigService.getEndpointFor('management/configprops')).pipe( + map(configProps => + Object.values( + Object.values(configProps.contexts) + .map(context => context.beans) + .reduce((allBeans: Beans, contextBeans: Beans) => ({ ...allBeans, ...contextBeans })), + ), + ), + ); + } + + getPropertySources(): Observable { + return this.http.get(this.applicationConfigService.getEndpointFor('management/env')).pipe(map(env => env.propertySources)); + } +} diff --git a/src/main/webapp/app/admin/docs/docs.component.html b/src/main/webapp/app/admin/docs/docs.component.html new file mode 100644 index 00000000..24025522 --- /dev/null +++ b/src/main/webapp/app/admin/docs/docs.component.html @@ -0,0 +1,10 @@ + diff --git a/src/main/webapp/app/admin/docs/docs.component.scss b/src/main/webapp/app/admin/docs/docs.component.scss new file mode 100644 index 00000000..bb9a6cc8 --- /dev/null +++ b/src/main/webapp/app/admin/docs/docs.component.scss @@ -0,0 +1,6 @@ +@import 'bootstrap/scss/functions'; +@import 'bootstrap/scss/variables'; + +iframe { + background: white; +} diff --git a/src/main/webapp/app/admin/docs/docs.component.ts b/src/main/webapp/app/admin/docs/docs.component.ts new file mode 100644 index 00000000..ea418835 --- /dev/null +++ b/src/main/webapp/app/admin/docs/docs.component.ts @@ -0,0 +1,9 @@ +import { Component } from '@angular/core'; + +@Component({ + standalone: true, + selector: 'jhi-docs', + templateUrl: './docs.component.html', + styleUrls: ['./docs.component.scss'], +}) +export default class DocsComponent {} diff --git a/src/main/webapp/app/admin/health/health.component.html b/src/main/webapp/app/admin/health/health.component.html new file mode 100644 index 00000000..6844d9b6 --- /dev/null +++ b/src/main/webapp/app/admin/health/health.component.html @@ -0,0 +1,42 @@ +
+

+ Health Checks + + +

+ +
+ + + + + + + + + + + + + + + +
Service nameStatusDetails
+ {{ componentHealth.key }} + + + {{ + { UNKNOWN: 'UNKNOWN', UP: 'UP', OUT_OF_SERVICE: 'OUT_OF_SERVICE', DOWN: 'DOWN' }[componentHealth.value!.status || 'UNKNOWN'] + }} + + + + + +
+
+
diff --git a/src/main/webapp/app/admin/health/health.component.spec.ts b/src/main/webapp/app/admin/health/health.component.spec.ts new file mode 100644 index 00000000..97ce8aba --- /dev/null +++ b/src/main/webapp/app/admin/health/health.component.spec.ts @@ -0,0 +1,65 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpErrorResponse } from '@angular/common/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { of, throwError } from 'rxjs'; + +import HealthComponent from './health.component'; +import { HealthService } from './health.service'; +import { Health } from './health.model'; + +describe('HealthComponent', () => { + let comp: HealthComponent; + let fixture: ComponentFixture; + let service: HealthService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, HealthComponent], + }) + .overrideTemplate(HealthComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HealthComponent); + comp = fixture.componentInstance; + service = TestBed.inject(HealthService); + }); + + describe('getBadgeClass', () => { + it('should get badge class', () => { + const upBadgeClass = comp.getBadgeClass('UP'); + const downBadgeClass = comp.getBadgeClass('DOWN'); + expect(upBadgeClass).toEqual('bg-success'); + expect(downBadgeClass).toEqual('bg-danger'); + }); + }); + + describe('refresh', () => { + it('should call refresh on init', () => { + // GIVEN + const health: Health = { status: 'UP', components: { mail: { status: 'UP', details: { mailDetail: 'mail' } } } }; + jest.spyOn(service, 'checkHealth').mockReturnValue(of(health)); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.checkHealth).toHaveBeenCalled(); + expect(comp.health).toEqual(health); + }); + + it('should handle a 503 on refreshing health data', () => { + // GIVEN + const health: Health = { status: 'DOWN', components: { mail: { status: 'DOWN' } } }; + jest.spyOn(service, 'checkHealth').mockReturnValue(throwError(new HttpErrorResponse({ status: 503, error: health }))); + + // WHEN + comp.refresh(); + + // THEN + expect(service.checkHealth).toHaveBeenCalled(); + expect(comp.health).toEqual(health); + }); + }); +}); diff --git a/src/main/webapp/app/admin/health/health.component.ts b/src/main/webapp/app/admin/health/health.component.ts new file mode 100644 index 00000000..4e33b9c0 --- /dev/null +++ b/src/main/webapp/app/admin/health/health.component.ts @@ -0,0 +1,50 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpErrorResponse } from '@angular/common/http'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import SharedModule from 'app/shared/shared.module'; +import { HealthService } from './health.service'; +import { Health, HealthDetails, HealthStatus } from './health.model'; +import HealthModalComponent from './modal/health-modal.component'; + +@Component({ + standalone: true, + selector: 'jhi-health', + templateUrl: './health.component.html', + imports: [SharedModule, HealthModalComponent], +}) +export default class HealthComponent implements OnInit { + health?: Health; + + constructor( + private modalService: NgbModal, + private healthService: HealthService, + ) {} + + ngOnInit(): void { + this.refresh(); + } + + getBadgeClass(statusState: HealthStatus): string { + if (statusState === 'UP') { + return 'bg-success'; + } + return 'bg-danger'; + } + + refresh(): void { + this.healthService.checkHealth().subscribe({ + next: health => (this.health = health), + error: (error: HttpErrorResponse) => { + if (error.status === 503) { + this.health = error.error; + } + }, + }); + } + + showHealth(health: { key: string; value: HealthDetails }): void { + const modalRef = this.modalService.open(HealthModalComponent); + modalRef.componentInstance.health = health; + } +} diff --git a/src/main/webapp/app/admin/health/health.model.ts b/src/main/webapp/app/admin/health/health.model.ts new file mode 100644 index 00000000..08112898 --- /dev/null +++ b/src/main/webapp/app/admin/health/health.model.ts @@ -0,0 +1,15 @@ +export type HealthStatus = 'UP' | 'DOWN' | 'UNKNOWN' | 'OUT_OF_SERVICE'; + +export type HealthKey = 'diskSpace' | 'mail' | 'ping' | 'livenessState' | 'readinessState' | 'db'; + +export interface Health { + status: HealthStatus; + components: { + [key in HealthKey]?: HealthDetails; + }; +} + +export interface HealthDetails { + status: HealthStatus; + details?: { [key: string]: unknown }; +} diff --git a/src/main/webapp/app/admin/health/health.service.spec.ts b/src/main/webapp/app/admin/health/health.service.spec.ts new file mode 100644 index 00000000..1e1ff19c --- /dev/null +++ b/src/main/webapp/app/admin/health/health.service.spec.ts @@ -0,0 +1,48 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { HealthService } from './health.service'; + +describe('HealthService Service', () => { + let service: HealthService; + let httpMock: HttpTestingController; + let applicationConfigService: ApplicationConfigService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + service = TestBed.inject(HealthService); + applicationConfigService = TestBed.inject(ApplicationConfigService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should call management/health endpoint with correct values', () => { + // GIVEN + let expectedResult; + const checkHealth = { + components: [], + }; + + // WHEN + service.checkHealth().subscribe(received => { + expectedResult = received; + }); + const testRequest = httpMock.expectOne({ + method: 'GET', + url: applicationConfigService.getEndpointFor('management/health'), + }); + testRequest.flush(checkHealth); + + // THEN + expect(expectedResult).toEqual(checkHealth); + }); + }); +}); diff --git a/src/main/webapp/app/admin/health/health.service.ts b/src/main/webapp/app/admin/health/health.service.ts new file mode 100644 index 00000000..7a2d420d --- /dev/null +++ b/src/main/webapp/app/admin/health/health.service.ts @@ -0,0 +1,18 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { Health } from './health.model'; + +@Injectable({ providedIn: 'root' }) +export class HealthService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + checkHealth(): Observable { + return this.http.get(this.applicationConfigService.getEndpointFor('management/health')); + } +} diff --git a/src/main/webapp/app/admin/health/modal/health-modal.component.html b/src/main/webapp/app/admin/health/modal/health-modal.component.html new file mode 100644 index 00000000..95d6687d --- /dev/null +++ b/src/main/webapp/app/admin/health/modal/health-modal.component.html @@ -0,0 +1,36 @@ + + + + + diff --git a/src/main/webapp/app/admin/health/modal/health-modal.component.spec.ts b/src/main/webapp/app/admin/health/modal/health-modal.component.spec.ts new file mode 100644 index 00000000..b9aa047b --- /dev/null +++ b/src/main/webapp/app/admin/health/modal/health-modal.component.spec.ts @@ -0,0 +1,111 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +import HealthModalComponent from './health-modal.component'; + +describe('HealthModalComponent', () => { + let comp: HealthModalComponent; + let fixture: ComponentFixture; + let mockActiveModal: NgbActiveModal; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, HealthModalComponent], + providers: [NgbActiveModal], + }) + .overrideTemplate(HealthModalComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HealthModalComponent); + comp = fixture.componentInstance; + mockActiveModal = TestBed.inject(NgbActiveModal); + }); + + describe('readableValue', () => { + it('should return stringify value', () => { + // GIVEN + comp.health = undefined; + + // WHEN + const result = comp.readableValue({ name: 'jhipster' }); + + // THEN + expect(result).toEqual('{"name":"jhipster"}'); + }); + + it('should return string value', () => { + // GIVEN + comp.health = undefined; + + // WHEN + const result = comp.readableValue('jhipster'); + + // THEN + expect(result).toEqual('jhipster'); + }); + + it('should return storage space in an human readable unit (GB)', () => { + // GIVEN + comp.health = { + key: 'diskSpace', + value: { + status: 'UP', + }, + }; + + // WHEN + const result = comp.readableValue(1073741825); + + // THEN + expect(result).toEqual('1.00 GB'); + }); + + it('should return storage space in an human readable unit (MB)', () => { + // GIVEN + comp.health = { + key: 'diskSpace', + value: { + status: 'UP', + }, + }; + + // WHEN + const result = comp.readableValue(1073741824); + + // THEN + expect(result).toEqual('1024.00 MB'); + }); + + it('should return string value', () => { + // GIVEN + comp.health = { + key: 'mail', + value: { + status: 'UP', + }, + }; + + // WHEN + const result = comp.readableValue(1234); + + // THEN + expect(result).toEqual('1234'); + }); + }); + + describe('dismiss', () => { + it('should call dismiss when dismiss modal is called', () => { + // GIVEN + const spy = jest.spyOn(mockActiveModal, 'dismiss'); + + // WHEN + comp.dismiss(); + + // THEN + expect(spy).toHaveBeenCalled(); + }); + }); +}); diff --git a/src/main/webapp/app/admin/health/modal/health-modal.component.ts b/src/main/webapp/app/admin/health/modal/health-modal.component.ts new file mode 100644 index 00000000..9eefa8bb --- /dev/null +++ b/src/main/webapp/app/admin/health/modal/health-modal.component.ts @@ -0,0 +1,37 @@ +import { Component } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +import SharedModule from 'app/shared/shared.module'; +import { HealthKey, HealthDetails } from '../health.model'; + +@Component({ + standalone: true, + selector: 'jhi-health-modal', + templateUrl: './health-modal.component.html', + imports: [SharedModule], +}) +export default class HealthModalComponent { + health?: { key: HealthKey; value: HealthDetails }; + + constructor(private activeModal: NgbActiveModal) {} + + readableValue(value: any): string { + if (this.health?.key === 'diskSpace') { + // Should display storage space in an human readable unit + const val = value / 1073741824; + if (val > 1) { + return `${val.toFixed(2)} GB`; + } + return `${(value / 1048576).toFixed(2)} MB`; + } + + if (typeof value === 'object') { + return JSON.stringify(value); + } + return String(value); + } + + dismiss(): void { + this.activeModal.dismiss(); + } +} diff --git a/src/main/webapp/app/admin/logs/log.model.ts b/src/main/webapp/app/admin/logs/log.model.ts new file mode 100644 index 00000000..2606a885 --- /dev/null +++ b/src/main/webapp/app/admin/logs/log.model.ts @@ -0,0 +1,18 @@ +export type Level = 'TRACE' | 'DEBUG' | 'INFO' | 'WARN' | 'ERROR' | 'OFF'; + +export interface Logger { + configuredLevel: Level | null; + effectiveLevel: Level; +} + +export interface LoggersResponse { + levels: Level[]; + loggers: { [key: string]: Logger }; +} + +export class Log { + constructor( + public name: string, + public level: Level, + ) {} +} diff --git a/src/main/webapp/app/admin/logs/logs.component.html b/src/main/webapp/app/admin/logs/logs.component.html new file mode 100644 index 00000000..e84b96f9 --- /dev/null +++ b/src/main/webapp/app/admin/logs/logs.component.html @@ -0,0 +1,78 @@ +
+

Logs

+ +
+
+
+ +

There are {{ loggers.length }} loggers.

+ + Filter + + + + + + + + + + + + + + + + +
Name Level
+ {{ logger.name | slice: 0 : 140 }} + + + + + + + + + + + + +
+
diff --git a/src/main/webapp/app/admin/logs/logs.component.spec.ts b/src/main/webapp/app/admin/logs/logs.component.spec.ts new file mode 100644 index 00000000..611b47d4 --- /dev/null +++ b/src/main/webapp/app/admin/logs/logs.component.spec.ts @@ -0,0 +1,82 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { of } from 'rxjs'; + +import LogsComponent from './logs.component'; +import { LogsService } from './logs.service'; +import { Log, LoggersResponse } from './log.model'; + +describe('LogsComponent', () => { + let comp: LogsComponent; + let fixture: ComponentFixture; + let service: LogsService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, LogsComponent], + providers: [LogsService], + }) + .overrideTemplate(LogsComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(LogsComponent); + comp = fixture.componentInstance; + service = TestBed.inject(LogsService); + }); + + describe('OnInit', () => { + it('should set all default values correctly', () => { + expect(comp.filter).toBe(''); + expect(comp.orderProp).toBe('name'); + expect(comp.ascending).toBe(true); + }); + + it('Should call load all on init', () => { + // GIVEN + const log = new Log('main', 'WARN'); + jest.spyOn(service, 'findAll').mockReturnValue( + of({ + loggers: { + main: { + effectiveLevel: 'WARN', + }, + }, + } as unknown as LoggersResponse), + ); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.findAll).toHaveBeenCalled(); + expect(comp.loggers?.[0]).toEqual(expect.objectContaining(log)); + }); + }); + + describe('change log level', () => { + it('should change log level correctly', () => { + // GIVEN + const log = new Log('main', 'ERROR'); + jest.spyOn(service, 'changeLevel').mockReturnValue(of({})); + jest.spyOn(service, 'findAll').mockReturnValue( + of({ + loggers: { + main: { + effectiveLevel: 'ERROR', + }, + }, + } as unknown as LoggersResponse), + ); + + // WHEN + comp.changeLevel('main', 'ERROR'); + + // THEN + expect(service.changeLevel).toHaveBeenCalled(); + expect(service.findAll).toHaveBeenCalled(); + expect(comp.loggers?.[0]).toEqual(expect.objectContaining(log)); + }); + }); +}); diff --git a/src/main/webapp/app/admin/logs/logs.component.ts b/src/main/webapp/app/admin/logs/logs.component.ts new file mode 100644 index 00000000..e899e368 --- /dev/null +++ b/src/main/webapp/app/admin/logs/logs.component.ts @@ -0,0 +1,65 @@ +import { Component, OnInit } from '@angular/core'; +import { finalize } from 'rxjs/operators'; + +import SharedModule from 'app/shared/shared.module'; +import { FormsModule } from '@angular/forms'; +import { SortDirective, SortByDirective } from 'app/shared/sort'; +import { Log, LoggersResponse, Level } from './log.model'; +import { LogsService } from './logs.service'; + +@Component({ + standalone: true, + selector: 'jhi-logs', + templateUrl: './logs.component.html', + imports: [SharedModule, FormsModule, SortDirective, SortByDirective], +}) +export default class LogsComponent implements OnInit { + loggers?: Log[]; + filteredAndOrderedLoggers?: Log[]; + isLoading = false; + filter = ''; + orderProp: keyof Log = 'name'; + ascending = true; + + constructor(private logsService: LogsService) {} + + ngOnInit(): void { + this.findAndExtractLoggers(); + } + + changeLevel(name: string, level: Level): void { + this.logsService.changeLevel(name, level).subscribe(() => this.findAndExtractLoggers()); + } + + filterAndSort(): void { + this.filteredAndOrderedLoggers = this.loggers!.filter( + logger => !this.filter || logger.name.toLowerCase().includes(this.filter.toLowerCase()), + ).sort((a, b) => { + if (a[this.orderProp] < b[this.orderProp]) { + return this.ascending ? -1 : 1; + } else if (a[this.orderProp] > b[this.orderProp]) { + return this.ascending ? 1 : -1; + } else if (this.orderProp === 'level') { + return a.name < b.name ? -1 : 1; + } + return 0; + }); + } + + private findAndExtractLoggers(): void { + this.isLoading = true; + this.logsService + .findAll() + .pipe( + finalize(() => { + this.filterAndSort(); + this.isLoading = false; + }), + ) + .subscribe({ + next: (response: LoggersResponse) => + (this.loggers = Object.entries(response.loggers).map(([key, logger]) => new Log(key, logger.effectiveLevel))), + error: () => (this.loggers = []), + }); + } +} diff --git a/src/main/webapp/app/admin/logs/logs.service.spec.ts b/src/main/webapp/app/admin/logs/logs.service.spec.ts new file mode 100644 index 00000000..cebee2cc --- /dev/null +++ b/src/main/webapp/app/admin/logs/logs.service.spec.ts @@ -0,0 +1,31 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { LogsService } from './logs.service'; + +describe('Logs Service', () => { + let service: LogsService; + let httpMock: HttpTestingController; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + service = TestBed.inject(LogsService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should change log level', () => { + service.changeLevel('main', 'ERROR').subscribe(); + + const req = httpMock.expectOne({ method: 'POST' }); + expect(req.request.body).toEqual({ configuredLevel: 'ERROR' }); + }); + }); +}); diff --git a/src/main/webapp/app/admin/logs/logs.service.ts b/src/main/webapp/app/admin/logs/logs.service.ts new file mode 100644 index 00000000..61f64f23 --- /dev/null +++ b/src/main/webapp/app/admin/logs/logs.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { LoggersResponse, Level } from './log.model'; + +@Injectable({ providedIn: 'root' }) +export class LogsService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + changeLevel(name: string, configuredLevel: Level): Observable<{}> { + return this.http.post(this.applicationConfigService.getEndpointFor(`management/loggers/${name}`), { configuredLevel }); + } + + findAll(): Observable { + return this.http.get(this.applicationConfigService.getEndpointFor('management/loggers')); + } +} diff --git a/src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.html b/src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.html new file mode 100644 index 00000000..9009456d --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.html @@ -0,0 +1,28 @@ +

Memory

+ +
+
+ + {{ entry.key }} + ({{ entry.value.used / 1048576 | number: '1.0-0' }}M / {{ entry.value.max / 1048576 | number: '1.0-0' }}M) + + +
Committed : {{ entry.value.committed / 1048576 | number: '1.0-0' }}M
+ + {{ entry.key }} {{ entry.value.used / 1048576 | number: '1.0-0' }}M + + + {{ (entry.value.used * 100) / entry.value.max | number: '1.0-0' }}% + +
+
diff --git a/src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.ts b/src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.ts new file mode 100644 index 00000000..8654a8b9 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/jvm-memory/jvm-memory.component.ts @@ -0,0 +1,22 @@ +import { Component, Input } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; +import { JvmMetrics } from 'app/admin/metrics/metrics.model'; + +@Component({ + standalone: true, + selector: 'jhi-jvm-memory', + templateUrl: './jvm-memory.component.html', + imports: [SharedModule], +}) +export class JvmMemoryComponent { + /** + * object containing all jvm memory metrics + */ + @Input() jvmMemoryMetrics?: { [key: string]: JvmMetrics }; + + /** + * boolean field saying if the metrics are in the process of being updated + */ + @Input() updating?: boolean; +} diff --git a/src/main/webapp/app/admin/metrics/blocks/jvm-threads/jvm-threads.component.html b/src/main/webapp/app/admin/metrics/blocks/jvm-threads/jvm-threads.component.html new file mode 100644 index 00000000..df0a5df2 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/jvm-threads/jvm-threads.component.html @@ -0,0 +1,55 @@ +

Threads

+ +Runnable {{ threadStats.threadDumpRunnable }} + + + {{ (threadStats.threadDumpRunnable * 100) / threadStats.threadDumpAll | number: '1.0-0' }}% + + +Timed waiting ({{ threadStats.threadDumpTimedWaiting }}) + + + {{ (threadStats.threadDumpTimedWaiting * 100) / threadStats.threadDumpAll | number: '1.0-0' }}% + + +Waiting ({{ threadStats.threadDumpWaiting }}) + + + {{ (threadStats.threadDumpWaiting * 100) / threadStats.threadDumpAll | number: '1.0-0' }}% + + +Blocked ({{ threadStats.threadDumpBlocked }}) + + + {{ (threadStats.threadDumpBlocked * 100) / threadStats.threadDumpAll | number: '1.0-0' }}% + + +
Total: {{ threadStats.threadDumpAll }}
+ + diff --git a/src/main/webapp/app/admin/metrics/blocks/jvm-threads/jvm-threads.component.ts b/src/main/webapp/app/admin/metrics/blocks/jvm-threads/jvm-threads.component.ts new file mode 100644 index 00000000..dc726935 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/jvm-threads/jvm-threads.component.ts @@ -0,0 +1,58 @@ +import { Component, Input } from '@angular/core'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import SharedModule from 'app/shared/shared.module'; +import { Thread, ThreadState } from 'app/admin/metrics/metrics.model'; +import { MetricsModalThreadsComponent } from '../metrics-modal-threads/metrics-modal-threads.component'; + +@Component({ + standalone: true, + selector: 'jhi-jvm-threads', + templateUrl: './jvm-threads.component.html', + imports: [SharedModule], +}) +export class JvmThreadsComponent { + threadStats = { + threadDumpAll: 0, + threadDumpRunnable: 0, + threadDumpTimedWaiting: 0, + threadDumpWaiting: 0, + threadDumpBlocked: 0, + }; + + @Input() + set threads(threads: Thread[] | undefined) { + this._threads = threads; + + threads?.forEach(thread => { + if (thread.threadState === ThreadState.Runnable) { + this.threadStats.threadDumpRunnable += 1; + } else if (thread.threadState === ThreadState.Waiting) { + this.threadStats.threadDumpWaiting += 1; + } else if (thread.threadState === ThreadState.TimedWaiting) { + this.threadStats.threadDumpTimedWaiting += 1; + } else if (thread.threadState === ThreadState.Blocked) { + this.threadStats.threadDumpBlocked += 1; + } + }); + + this.threadStats.threadDumpAll = + this.threadStats.threadDumpRunnable + + this.threadStats.threadDumpWaiting + + this.threadStats.threadDumpTimedWaiting + + this.threadStats.threadDumpBlocked; + } + + get threads(): Thread[] | undefined { + return this._threads; + } + + private _threads: Thread[] | undefined; + + constructor(private modalService: NgbModal) {} + + open(): void { + const modalRef = this.modalService.open(MetricsModalThreadsComponent); + modalRef.componentInstance.threads = this.threads; + } +} diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.html b/src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.html new file mode 100644 index 00000000..2cfd0311 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.html @@ -0,0 +1,42 @@ +

Cache statistics

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Cache nameCache HitsCache MissesCache GetsCache PutsCache RemovalsCache EvictionsCache Hit %Cache Miss %
{{ entry.key }}{{ entry.value['cache.gets.hit'] }}{{ entry.value['cache.gets.miss'] }}{{ entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'] }}{{ entry.value['cache.puts'] }}{{ entry.value['cache.removals'] }}{{ entry.value['cache.evictions'] }} + {{ + filterNaN((100 * entry.value['cache.gets.hit']) / (entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'])) + | number: '1.0-4' + }} + + {{ + filterNaN((100 * entry.value['cache.gets.miss']) / (entry.value['cache.gets.hit'] + entry.value['cache.gets.miss'])) + | number: '1.0-4' + }} +
+
diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.ts b/src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.ts new file mode 100644 index 00000000..5a174f7c --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-cache/metrics-cache.component.ts @@ -0,0 +1,26 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; +import { CacheMetrics } from 'app/admin/metrics/metrics.model'; +import { filterNaN } from 'app/core/util/operators'; + +@Component({ + standalone: true, + selector: 'jhi-metrics-cache', + templateUrl: './metrics-cache.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [SharedModule], +}) +export class MetricsCacheComponent { + /** + * object containing all cache related metrics + */ + @Input() cacheMetrics?: { [key: string]: CacheMetrics }; + + /** + * boolean field saying if the metrics are in the process of being updated + */ + @Input() updating?: boolean; + + filterNaN = (input: number): number => filterNaN(input); +} diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.html b/src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.html new file mode 100644 index 00000000..99c61203 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.html @@ -0,0 +1,57 @@ +

DataSource statistics (time in millisecond)

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Connection Pool Usage (active: {{ datasourceMetrics.active.value }}, min: {{ datasourceMetrics.min.value }}, max: + {{ datasourceMetrics.max.value }}, idle: {{ datasourceMetrics.idle.value }}) + CountMeanMinp50p75p95p99Max
Acquire{{ datasourceMetrics.acquire.count }}{{ filterNaN(datasourceMetrics.acquire.mean) | number: '1.0-2' }}{{ datasourceMetrics.acquire['0.0'] | number: '1.0-3' }}{{ datasourceMetrics.acquire['0.5'] | number: '1.0-3' }}{{ datasourceMetrics.acquire['0.75'] | number: '1.0-3' }}{{ datasourceMetrics.acquire['0.95'] | number: '1.0-3' }}{{ datasourceMetrics.acquire['0.99'] | number: '1.0-3' }}{{ filterNaN(datasourceMetrics.acquire.max) | number: '1.0-2' }}
Creation{{ datasourceMetrics.creation.count }}{{ filterNaN(datasourceMetrics.creation.mean) | number: '1.0-2' }}{{ datasourceMetrics.creation['0.0'] | number: '1.0-3' }}{{ datasourceMetrics.creation['0.5'] | number: '1.0-3' }}{{ datasourceMetrics.creation['0.75'] | number: '1.0-3' }}{{ datasourceMetrics.creation['0.95'] | number: '1.0-3' }}{{ datasourceMetrics.creation['0.99'] | number: '1.0-3' }}{{ filterNaN(datasourceMetrics.creation.max) | number: '1.0-2' }}
Usage{{ datasourceMetrics.usage.count }}{{ filterNaN(datasourceMetrics.usage.mean) | number: '1.0-2' }}{{ datasourceMetrics.usage['0.0'] | number: '1.0-3' }}{{ datasourceMetrics.usage['0.5'] | number: '1.0-3' }}{{ datasourceMetrics.usage['0.75'] | number: '1.0-3' }}{{ datasourceMetrics.usage['0.95'] | number: '1.0-3' }}{{ datasourceMetrics.usage['0.99'] | number: '1.0-3' }}{{ filterNaN(datasourceMetrics.usage.max) | number: '1.0-2' }}
+
diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.ts b/src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.ts new file mode 100644 index 00000000..b666e1a3 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-datasource/metrics-datasource.component.ts @@ -0,0 +1,26 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; +import { Databases } from 'app/admin/metrics/metrics.model'; +import { filterNaN } from 'app/core/util/operators'; + +@Component({ + standalone: true, + selector: 'jhi-metrics-datasource', + templateUrl: './metrics-datasource.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [SharedModule], +}) +export class MetricsDatasourceComponent { + /** + * object containing all datasource related metrics + */ + @Input() datasourceMetrics?: Databases; + + /** + * boolean field saying if the metrics are in the process of being updated + */ + @Input() updating?: boolean; + + filterNaN = (input: number): number => filterNaN(input); +} diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.html b/src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.html new file mode 100644 index 00000000..ee47ec7e --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.html @@ -0,0 +1,24 @@ +

Endpoints requests (time in millisecond)

+ +
+ + + + + + + + + + + + + + + + + + + +
MethodEndpoint urlCountMean
{{ method.key }}{{ entry.key }}{{ method.value!.count }}{{ method.value!.mean | number: '1.0-3' }}
+
diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.ts b/src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.ts new file mode 100644 index 00000000..f96e80ad --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-endpoints-requests/metrics-endpoints-requests.component.ts @@ -0,0 +1,22 @@ +import { Component, Input } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; +import { Services } from 'app/admin/metrics/metrics.model'; + +@Component({ + standalone: true, + selector: 'jhi-metrics-endpoints-requests', + templateUrl: './metrics-endpoints-requests.component.html', + imports: [SharedModule], +}) +export class MetricsEndpointsRequestsComponent { + /** + * object containing service related metrics + */ + @Input() endpointsRequestsMetrics?: Services; + + /** + * boolean field saying if the metrics are in the process of being updated + */ + @Input() updating?: boolean; +} diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.html b/src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.html new file mode 100644 index 00000000..219acf94 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.html @@ -0,0 +1,92 @@ +

Garbage collections

+ +
+
+
+ + GC Live Data Size/GC Max Data Size ({{ garbageCollectorMetrics['jvm.gc.live.data.size'] / 1048576 | number: '1.0-0' }}M / + {{ garbageCollectorMetrics['jvm.gc.max.data.size'] / 1048576 | number: '1.0-0' }}M) + + + + + {{ + (100 * garbageCollectorMetrics['jvm.gc.live.data.size']) / garbageCollectorMetrics['jvm.gc.max.data.size'] | number: '1.0-2' + }}% + + +
+
+ +
+
+ + GC Memory Promoted/GC Memory Allocated ({{ garbageCollectorMetrics['jvm.gc.memory.promoted'] / 1048576 | number: '1.0-0' }}M / + {{ garbageCollectorMetrics['jvm.gc.memory.allocated'] / 1048576 | number: '1.0-0' }}M) + + + + + {{ + (100 * garbageCollectorMetrics['jvm.gc.memory.promoted']) / garbageCollectorMetrics['jvm.gc.memory.allocated'] + | number: '1.0-2' + }}% + + +
+
+ +
+
+
Classes loaded
+
{{ garbageCollectorMetrics.classesLoaded }}
+
+
+
Classes unloaded
+
{{ garbageCollectorMetrics.classesUnloaded }}
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
CountMeanMinp50p75p95p99Max
jvm.gc.pause{{ garbageCollectorMetrics['jvm.gc.pause'].count }}{{ garbageCollectorMetrics['jvm.gc.pause'].mean | number: '1.0-3' }}{{ garbageCollectorMetrics['jvm.gc.pause']['0.0'] | number: '1.0-3' }}{{ garbageCollectorMetrics['jvm.gc.pause']['0.5'] | number: '1.0-3' }}{{ garbageCollectorMetrics['jvm.gc.pause']['0.75'] | number: '1.0-3' }}{{ garbageCollectorMetrics['jvm.gc.pause']['0.95'] | number: '1.0-3' }}{{ garbageCollectorMetrics['jvm.gc.pause']['0.99'] | number: '1.0-3' }}{{ garbageCollectorMetrics['jvm.gc.pause'].max | number: '1.0-3' }}
+
+
diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.ts b/src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.ts new file mode 100644 index 00000000..49e397d6 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-garbagecollector/metrics-garbagecollector.component.ts @@ -0,0 +1,22 @@ +import { Component, Input } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; +import { GarbageCollector } from 'app/admin/metrics/metrics.model'; + +@Component({ + standalone: true, + selector: 'jhi-metrics-garbagecollector', + templateUrl: './metrics-garbagecollector.component.html', + imports: [SharedModule], +}) +export class MetricsGarbageCollectorComponent { + /** + * object containing garbage collector related metrics + */ + @Input() garbageCollectorMetrics?: GarbageCollector; + + /** + * boolean field saying if the metrics are in the process of being updated + */ + @Input() updating?: boolean; +} diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.html b/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.html new file mode 100644 index 00000000..e725a60e --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.html @@ -0,0 +1,90 @@ + + + + diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.spec.ts b/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.spec.ts new file mode 100644 index 00000000..11326f75 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.spec.ts @@ -0,0 +1,325 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +import { ThreadState } from '../../metrics.model'; +import { MetricsModalThreadsComponent } from './metrics-modal-threads.component'; + +describe('MetricsModalThreadsComponent', () => { + let comp: MetricsModalThreadsComponent; + let fixture: ComponentFixture; + let mockActiveModal: NgbActiveModal; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, MetricsModalThreadsComponent], + providers: [NgbActiveModal], + }) + .overrideTemplate(MetricsModalThreadsComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MetricsModalThreadsComponent); + comp = fixture.componentInstance; + mockActiveModal = TestBed.inject(NgbActiveModal); + }); + + describe('ngOnInit', () => { + it('should count threads on init', () => { + // GIVEN + comp.threads = [ + { + threadName: '', + threadId: 1, + blockedTime: 1, + blockedCount: 1, + waitedTime: 1, + waitedCount: 1, + lockName: 'lock1', + lockOwnerId: 1, + lockOwnerName: 'lock1', + daemon: true, + inNative: true, + suspended: true, + threadState: ThreadState.Blocked, + priority: 1, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }, + { + threadName: '', + threadId: 2, + blockedTime: 2, + blockedCount: 2, + waitedTime: 2, + waitedCount: 2, + lockName: 'lock2', + lockOwnerId: 2, + lockOwnerName: 'lock2', + daemon: false, + inNative: false, + suspended: false, + threadState: ThreadState.Runnable, + priority: 2, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }, + { + threadName: '', + threadId: 3, + blockedTime: 3, + blockedCount: 3, + waitedTime: 3, + waitedCount: 3, + lockName: 'lock3', + lockOwnerId: 3, + lockOwnerName: 'lock3', + daemon: false, + inNative: false, + suspended: false, + threadState: ThreadState.TimedWaiting, + priority: 3, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }, + { + threadName: '', + threadId: 4, + blockedTime: 4, + blockedCount: 4, + waitedTime: 4, + waitedCount: 4, + lockName: 'lock4', + lockOwnerId: 4, + lockOwnerName: 'lock4', + daemon: false, + inNative: false, + suspended: false, + threadState: ThreadState.Waiting, + priority: 4, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }, + ]; + + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.threadDumpRunnable).toEqual(1); + expect(comp.threadDumpWaiting).toEqual(1); + expect(comp.threadDumpTimedWaiting).toEqual(1); + expect(comp.threadDumpBlocked).toEqual(1); + expect(comp.threadDumpAll).toEqual(4); + }); + }); + + describe('getBadgeClass', () => { + it('should return a success badge class for runnable thread state', () => { + // GIVEN + const threadState = ThreadState.Runnable; + + // WHEN + const badgeClass = comp.getBadgeClass(threadState); + + // THEN + expect(badgeClass).toEqual('bg-success'); + }); + + it('should return an info badge class for waiting thread state', () => { + // GIVEN + const threadState = ThreadState.Waiting; + + // WHEN + const badgeClass = comp.getBadgeClass(threadState); + + // THEN + expect(badgeClass).toEqual('bg-info'); + }); + + it('should return a warning badge class for time waiting thread state', () => { + // GIVEN + const threadState = ThreadState.TimedWaiting; + + // WHEN + const badgeClass = comp.getBadgeClass(threadState); + + // THEN + expect(badgeClass).toEqual('bg-warning'); + }); + + it('should return a danger badge class for blocked thread state', () => { + // GIVEN + const threadState = ThreadState.Blocked; + + // WHEN + const badgeClass = comp.getBadgeClass(threadState); + + // THEN + expect(badgeClass).toEqual('bg-danger'); + }); + + it('should return an empty string for others threads', () => { + // GIVEN + const threadState = ThreadState.New; + + // WHEN + const badgeClass = comp.getBadgeClass(threadState); + + // THEN + expect(badgeClass).toEqual(''); + }); + }); + + describe('getThreads', () => { + it('should return blocked threads', () => { + // GIVEN + const thread1 = { + threadName: '', + threadId: 1, + blockedTime: 1, + blockedCount: 1, + waitedTime: 1, + waitedCount: 1, + lockName: 'lock1', + lockOwnerId: 1, + lockOwnerName: 'lock1', + daemon: true, + inNative: true, + suspended: true, + threadState: ThreadState.Blocked, + priority: 1, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }; + const thread2 = { + threadName: '', + threadId: 2, + blockedTime: 2, + blockedCount: 2, + waitedTime: 2, + waitedCount: 2, + lockName: 'lock2', + lockOwnerId: 1, + lockOwnerName: 'lock2', + daemon: false, + inNative: false, + suspended: false, + threadState: ThreadState.Runnable, + priority: 2, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }; + comp.threads = [thread1, thread2]; + comp.threadStateFilter = ThreadState.Blocked; + + // WHEN + const threadsFiltered = comp.getThreads(); + + // THEN + expect(threadsFiltered).toEqual([thread1]); + }); + + it('should return an empty array of threads', () => { + // GIVEN + comp.threads = []; + comp.threadStateFilter = ThreadState.Blocked; + + // WHEN + const threadsFiltered = comp.getThreads(); + + // THEN + expect(threadsFiltered).toEqual([]); + }); + + it('should return all threads if there is no filter', () => { + // GIVEN + const thread1 = { + threadName: '', + threadId: 1, + blockedTime: 1, + blockedCount: 1, + waitedTime: 1, + waitedCount: 1, + lockName: 'lock1', + lockOwnerId: 1, + lockOwnerName: 'lock1', + daemon: true, + inNative: true, + suspended: true, + threadState: ThreadState.Blocked, + priority: 1, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }; + const thread2 = { + threadName: '', + threadId: 2, + blockedTime: 2, + blockedCount: 2, + waitedTime: 2, + waitedCount: 2, + lockName: 'lock2', + lockOwnerId: 1, + lockOwnerName: 'lock2', + daemon: false, + inNative: false, + suspended: false, + threadState: ThreadState.Runnable, + priority: 2, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }; + comp.threads = [thread1, thread2]; + comp.threadStateFilter = undefined; + + // WHEN + const threadsFiltered = comp.getThreads(); + + // THEN + expect(threadsFiltered).toEqual(comp.threads); + }); + + it('should return an empty array if there are no threads to filter', () => { + // GIVEN + comp.threads = undefined; + comp.threadStateFilter = ThreadState.Blocked; + + // WHEN + const threadsFiltered = comp.getThreads(); + + // THEN + expect(threadsFiltered).toEqual([]); + }); + }); + + describe('dismiss', () => { + it('should call dismiss function for modal on dismiss', () => { + // GIVEN + jest.spyOn(mockActiveModal, 'dismiss').mockReturnValue(undefined); + + // WHEN + comp.dismiss(); + + // THEN + expect(mockActiveModal.dismiss).toHaveBeenCalled(); + }); + }); +}); diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.ts b/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.ts new file mode 100644 index 00000000..72c05cc7 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.ts @@ -0,0 +1,62 @@ +import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +import SharedModule from 'app/shared/shared.module'; +import { Thread, ThreadState } from 'app/admin/metrics/metrics.model'; + +@Component({ + standalone: true, + selector: 'jhi-thread-modal', + templateUrl: './metrics-modal-threads.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [SharedModule], +}) +export class MetricsModalThreadsComponent implements OnInit { + ThreadState = ThreadState; + threadStateFilter?: ThreadState; + threads?: Thread[]; + threadDumpAll = 0; + threadDumpBlocked = 0; + threadDumpRunnable = 0; + threadDumpTimedWaiting = 0; + threadDumpWaiting = 0; + + constructor(private activeModal: NgbActiveModal) {} + + ngOnInit(): void { + this.threads?.forEach(thread => { + if (thread.threadState === ThreadState.Runnable) { + this.threadDumpRunnable += 1; + } else if (thread.threadState === ThreadState.Waiting) { + this.threadDumpWaiting += 1; + } else if (thread.threadState === ThreadState.TimedWaiting) { + this.threadDumpTimedWaiting += 1; + } else if (thread.threadState === ThreadState.Blocked) { + this.threadDumpBlocked += 1; + } + }); + + this.threadDumpAll = this.threadDumpRunnable + this.threadDumpWaiting + this.threadDumpTimedWaiting + this.threadDumpBlocked; + } + + getBadgeClass(threadState: ThreadState): string { + if (threadState === ThreadState.Runnable) { + return 'bg-success'; + } else if (threadState === ThreadState.Waiting) { + return 'bg-info'; + } else if (threadState === ThreadState.TimedWaiting) { + return 'bg-warning'; + } else if (threadState === ThreadState.Blocked) { + return 'bg-danger'; + } + return ''; + } + + getThreads(): Thread[] { + return this.threads?.filter(thread => !this.threadStateFilter || thread.threadState === this.threadStateFilter) ?? []; + } + + dismiss(): void { + this.activeModal.dismiss(); + } +} diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.html b/src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.html new file mode 100644 index 00000000..9be2f80a --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.html @@ -0,0 +1,26 @@ +

HTTP requests (time in millisecond)

+ + + + + + + + + + + + + + + + + + +
CodeCountMeanMax
{{ entry.key }} + + {{ entry.value.count }} + + + {{ filterNaN(entry.value.mean) | number: '1.0-2' }} + {{ entry.value.max | number: '1.0-2' }}
diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.ts b/src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.ts new file mode 100644 index 00000000..d19bb059 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-request/metrics-request.component.ts @@ -0,0 +1,26 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; +import { HttpServerRequests } from 'app/admin/metrics/metrics.model'; +import { filterNaN } from 'app/core/util/operators'; + +@Component({ + standalone: true, + selector: 'jhi-metrics-request', + templateUrl: './metrics-request.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [SharedModule], +}) +export class MetricsRequestComponent { + /** + * object containing http request related metrics + */ + @Input() requestMetrics?: HttpServerRequests; + + /** + * boolean field saying if the metrics are in the process of being updated + */ + @Input() updating?: boolean; + + filterNaN = (input: number): number => filterNaN(input); +} diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.html b/src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.html new file mode 100644 index 00000000..d35be0cf --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.html @@ -0,0 +1,51 @@ +

System

+ + +
+
Uptime
+
{{ convertMillisecondsToDuration(systemMetrics['process.uptime']) }}
+
+ +
+
Start time
+
{{ systemMetrics['process.start.time'] | date: 'full' }}
+
+ +
+
Process CPU usage
+
{{ 100 * systemMetrics['process.cpu.usage'] | number: '1.0-2' }} %
+
+ + + {{ 100 * systemMetrics['process.cpu.usage'] | number: '1.0-2' }} % + + +
+
System CPU usage
+
{{ 100 * systemMetrics['system.cpu.usage'] | number: '1.0-2' }} %
+
+ + + {{ 100 * systemMetrics['system.cpu.usage'] | number: '1.0-2' }} % + + +
+
System CPU count
+
{{ systemMetrics['system.cpu.count'] }}
+
+ +
+
System 1m Load average
+
{{ systemMetrics['system.load.average.1m'] | number: '1.0-2' }}
+
+ +
+
Process files max
+
{{ systemMetrics['process.files.max'] | number: '1.0-0' }}
+
+ +
+
Process files open
+
{{ systemMetrics['process.files.open'] | number: '1.0-0' }}
+
+
diff --git a/src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.ts b/src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.ts new file mode 100644 index 00000000..14329897 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/blocks/metrics-system/metrics-system.component.ts @@ -0,0 +1,46 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +import SharedModule from 'app/shared/shared.module'; +import { ProcessMetrics } from 'app/admin/metrics/metrics.model'; + +@Component({ + standalone: true, + selector: 'jhi-metrics-system', + templateUrl: './metrics-system.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [SharedModule], +}) +export class MetricsSystemComponent { + /** + * object containing thread related metrics + */ + @Input() systemMetrics?: ProcessMetrics; + + /** + * boolean field saying if the metrics are in the process of being updated + */ + @Input() updating?: boolean; + + convertMillisecondsToDuration(ms: number): string { + const times = { + year: 31557600000, + month: 2629746000, + day: 86400000, + hour: 3600000, + minute: 60000, + second: 1000, + }; + let timeString = ''; + for (const [key, value] of Object.entries(times)) { + if (Math.floor(ms / value) > 0) { + let plural = ''; + if (Math.floor(ms / value) > 1) { + plural = 's'; + } + timeString += `${Math.floor(ms / value).toString()} ${key.toString()}${plural} `; + ms = ms - value * Math.floor(ms / value); + } + } + return timeString; + } +} diff --git a/src/main/webapp/app/admin/metrics/metrics.component.html b/src/main/webapp/app/admin/metrics/metrics.component.html new file mode 100644 index 00000000..4445a9f5 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/metrics.component.html @@ -0,0 +1,49 @@ +
+

+ Application Metrics + + +

+ +

JVM Metrics

+ +
+ + + + + +
+ + + +
Updating...
+ + + + + + + + +
diff --git a/src/main/webapp/app/admin/metrics/metrics.component.spec.ts b/src/main/webapp/app/admin/metrics/metrics.component.spec.ts new file mode 100644 index 00000000..8160dfae --- /dev/null +++ b/src/main/webapp/app/admin/metrics/metrics.component.spec.ts @@ -0,0 +1,146 @@ +import { ChangeDetectorRef } from '@angular/core'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { of } from 'rxjs'; + +import MetricsComponent from './metrics.component'; +import { MetricsService } from './metrics.service'; +import { Metrics, Thread, ThreadDump } from './metrics.model'; + +describe('MetricsComponent', () => { + let comp: MetricsComponent; + let fixture: ComponentFixture; + let service: MetricsService; + let changeDetector: ChangeDetectorRef; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, MetricsComponent], + }) + .overrideTemplate(MetricsComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MetricsComponent); + comp = fixture.componentInstance; + service = TestBed.inject(MetricsService); + changeDetector = fixture.debugElement.injector.get(ChangeDetectorRef); + }); + + describe('refresh', () => { + it('should call refresh on init', () => { + // GIVEN + const metrics = { + garbageCollector: { + 'PS Scavenge': { + collectionCount: 0, + collectionTime: 0, + }, + 'PS MarkSweep': { + collectionCount: 0, + collectionTime: 0, + }, + }, + } as unknown as Metrics; + const threadDump = { threads: [{ threadName: 'thread 1' } as Thread] } as ThreadDump; + + jest.spyOn(service, 'getMetrics').mockReturnValue(of(metrics)); + jest.spyOn(service, 'threadDump').mockReturnValue(of(threadDump)); + jest.spyOn(changeDetector.constructor.prototype, 'markForCheck'); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.getMetrics).toHaveBeenCalled(); + expect(comp.metrics).toEqual(metrics); + expect(comp.threads).toEqual(threadDump.threads); + expect(comp.updatingMetrics).toBeFalsy(); + expect(changeDetector.constructor.prototype.markForCheck).toHaveBeenCalled(); + }); + }); + + describe('metricsKeyExists', () => { + it('should check that metrics key exists', () => { + // GIVEN + comp.metrics = { + garbageCollector: { + 'PS Scavenge': { + collectionCount: 0, + collectionTime: 0, + }, + 'PS MarkSweep': { + collectionCount: 0, + collectionTime: 0, + }, + }, + } as unknown as Metrics; + + // WHEN + const garbageCollectorKeyExists = comp.metricsKeyExists('garbageCollector'); + + // THEN + expect(garbageCollectorKeyExists).toBeTruthy(); + }); + + it('should check that metrics key does not exist', () => { + // GIVEN + comp.metrics = { + garbageCollector: { + 'PS Scavenge': { + collectionCount: 0, + collectionTime: 0, + }, + 'PS MarkSweep': { + collectionCount: 0, + collectionTime: 0, + }, + }, + } as unknown as Metrics; + + // WHEN + const databasesCollectorKeyExists = comp.metricsKeyExists('databases'); + + // THEN + expect(databasesCollectorKeyExists).toBeFalsy(); + }); + }); + + describe('metricsKeyExistsAndObjectNotEmpty', () => { + it('should check that metrics key exists and is not empty', () => { + // GIVEN + comp.metrics = { + garbageCollector: { + 'PS Scavenge': { + collectionCount: 0, + collectionTime: 0, + }, + 'PS MarkSweep': { + collectionCount: 0, + collectionTime: 0, + }, + }, + } as unknown as Metrics; + + // WHEN + const garbageCollectorKeyExistsAndNotEmpty = comp.metricsKeyExistsAndObjectNotEmpty('garbageCollector'); + + // THEN + expect(garbageCollectorKeyExistsAndNotEmpty).toBeTruthy(); + }); + + it('should check that metrics key is empty', () => { + // GIVEN + comp.metrics = { + garbageCollector: {}, + } as Metrics; + + // WHEN + const garbageCollectorKeyEmpty = comp.metricsKeyExistsAndObjectNotEmpty('garbageCollector'); + + // THEN + expect(garbageCollectorKeyEmpty).toBeFalsy(); + }); + }); +}); diff --git a/src/main/webapp/app/admin/metrics/metrics.component.ts b/src/main/webapp/app/admin/metrics/metrics.component.ts new file mode 100644 index 00000000..93f7a3fe --- /dev/null +++ b/src/main/webapp/app/admin/metrics/metrics.component.ts @@ -0,0 +1,66 @@ +import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; +import { combineLatest } from 'rxjs'; + +import SharedModule from 'app/shared/shared.module'; +import { MetricsService } from './metrics.service'; +import { Metrics, Thread } from './metrics.model'; +import { JvmMemoryComponent } from './blocks/jvm-memory/jvm-memory.component'; +import { JvmThreadsComponent } from './blocks/jvm-threads/jvm-threads.component'; +import { MetricsCacheComponent } from './blocks/metrics-cache/metrics-cache.component'; +import { MetricsDatasourceComponent } from './blocks/metrics-datasource/metrics-datasource.component'; +import { MetricsEndpointsRequestsComponent } from './blocks/metrics-endpoints-requests/metrics-endpoints-requests.component'; +import { MetricsGarbageCollectorComponent } from './blocks/metrics-garbagecollector/metrics-garbagecollector.component'; +import { MetricsModalThreadsComponent } from './blocks/metrics-modal-threads/metrics-modal-threads.component'; +import { MetricsRequestComponent } from './blocks/metrics-request/metrics-request.component'; +import { MetricsSystemComponent } from './blocks/metrics-system/metrics-system.component'; + +@Component({ + standalone: true, + selector: 'jhi-metrics', + templateUrl: './metrics.component.html', + changeDetection: ChangeDetectionStrategy.OnPush, + imports: [ + SharedModule, + JvmMemoryComponent, + JvmThreadsComponent, + MetricsCacheComponent, + MetricsDatasourceComponent, + MetricsEndpointsRequestsComponent, + MetricsGarbageCollectorComponent, + MetricsModalThreadsComponent, + MetricsRequestComponent, + MetricsSystemComponent, + ], +}) +export default class MetricsComponent implements OnInit { + metrics?: Metrics; + threads?: Thread[]; + updatingMetrics = true; + + constructor( + private metricsService: MetricsService, + private changeDetector: ChangeDetectorRef, + ) {} + + ngOnInit(): void { + this.refresh(); + } + + refresh(): void { + this.updatingMetrics = true; + combineLatest([this.metricsService.getMetrics(), this.metricsService.threadDump()]).subscribe(([metrics, threadDump]) => { + this.metrics = metrics; + this.threads = threadDump.threads; + this.updatingMetrics = false; + this.changeDetector.markForCheck(); + }); + } + + metricsKeyExists(key: keyof Metrics): boolean { + return Boolean(this.metrics?.[key]); + } + + metricsKeyExistsAndObjectNotEmpty(key: keyof Metrics): boolean { + return Boolean(this.metrics?.[key] && JSON.stringify(this.metrics[key]) !== '{}'); + } +} diff --git a/src/main/webapp/app/admin/metrics/metrics.model.ts b/src/main/webapp/app/admin/metrics/metrics.model.ts new file mode 100644 index 00000000..d9576a90 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/metrics.model.ts @@ -0,0 +1,159 @@ +export interface Metrics { + jvm: { [key: string]: JvmMetrics }; + databases: Databases; + 'http.server.requests': HttpServerRequests; + cache: { [key: string]: CacheMetrics }; + garbageCollector: GarbageCollector; + services: Services; + processMetrics: ProcessMetrics; +} + +export interface JvmMetrics { + committed: number; + max: number; + used: number; +} + +export interface Databases { + min: Value; + idle: Value; + max: Value; + usage: MetricsWithPercentile; + pending: Value; + active: Value; + acquire: MetricsWithPercentile; + creation: MetricsWithPercentile; + connections: Value; +} + +export interface Value { + value: number; +} + +export interface MetricsWithPercentile { + '0.0': number; + '1.0': number; + max: number; + totalTime: number; + mean: number; + '0.5': number; + count: number; + '0.99': number; + '0.75': number; + '0.95': number; +} + +export interface HttpServerRequests { + all: { + count: number; + }; + percode: { [key: string]: MaxMeanCount }; +} + +export interface MaxMeanCount { + max: number; + mean: number; + count: number; +} + +export interface CacheMetrics { + 'cache.gets.miss': number; + 'cache.puts': number; + 'cache.gets.hit': number; + 'cache.removals': number; + 'cache.evictions': number; +} + +export interface GarbageCollector { + 'jvm.gc.max.data.size': number; + 'jvm.gc.pause': MetricsWithPercentile; + 'jvm.gc.memory.promoted': number; + 'jvm.gc.memory.allocated': number; + classesLoaded: number; + 'jvm.gc.live.data.size': number; + classesUnloaded: number; +} + +export interface Services { + [key: string]: { + [key in HttpMethod]?: MaxMeanCount; + }; +} + +export enum HttpMethod { + Post = 'POST', + Get = 'GET', + Put = 'PUT', + Patch = 'PATCH', + Delete = 'DELETE', +} + +export interface ProcessMetrics { + 'system.cpu.usage': number; + 'system.cpu.count': number; + 'system.load.average.1m'?: number; + 'process.cpu.usage': number; + 'process.files.max'?: number; + 'process.files.open'?: number; + 'process.start.time': number; + 'process.uptime': number; +} + +export interface ThreadDump { + threads: Thread[]; +} + +export interface Thread { + threadName: string; + threadId: number; + blockedTime: number; + blockedCount: number; + waitedTime: number; + waitedCount: number; + lockName: string | null; + lockOwnerId: number; + lockOwnerName: string | null; + daemon: boolean; + inNative: boolean; + suspended: boolean; + threadState: ThreadState; + priority: number; + stackTrace: StackTrace[]; + lockedMonitors: LockedMonitor[]; + lockedSynchronizers: string[]; + lockInfo: LockInfo | null; + // custom field for showing-hiding thread dump + showThreadDump?: boolean; +} + +export interface LockInfo { + className: string; + identityHashCode: number; +} + +export interface LockedMonitor { + className: string; + identityHashCode: number; + lockedStackDepth: number; + lockedStackFrame: StackTrace; +} + +export interface StackTrace { + classLoaderName: string | null; + moduleName: string | null; + moduleVersion: string | null; + methodName: string; + fileName: string; + lineNumber: number; + className: string; + nativeMethod: boolean; +} + +export enum ThreadState { + Runnable = 'RUNNABLE', + TimedWaiting = 'TIMED_WAITING', + Waiting = 'WAITING', + Blocked = 'BLOCKED', + New = 'NEW', + Terminated = 'TERMINATED', +} diff --git a/src/main/webapp/app/admin/metrics/metrics.service.spec.ts b/src/main/webapp/app/admin/metrics/metrics.service.spec.ts new file mode 100644 index 00000000..468ebd52 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/metrics.service.spec.ts @@ -0,0 +1,81 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { MetricsService } from './metrics.service'; +import { ThreadDump, ThreadState } from './metrics.model'; + +describe('Logs Service', () => { + let service: MetricsService; + let httpMock: HttpTestingController; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + service = TestBed.inject(MetricsService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should return Metrics', () => { + let expectedResult; + const metrics = { + jvm: {}, + 'http.server.requests': {}, + cache: {}, + services: {}, + databases: {}, + garbageCollector: {}, + processMetrics: {}, + }; + + service.getMetrics().subscribe(received => { + expectedResult = received; + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(metrics); + expect(expectedResult).toEqual(metrics); + }); + + it('should return Thread Dump', () => { + let expectedResult: ThreadDump | null = null; + const dump: ThreadDump = { + threads: [ + { + threadName: 'Reference Handler', + threadId: 2, + blockedTime: -1, + blockedCount: 7, + waitedTime: -1, + waitedCount: 0, + lockName: null, + lockOwnerId: -1, + lockOwnerName: null, + daemon: true, + inNative: false, + suspended: false, + threadState: ThreadState.Runnable, + priority: 10, + stackTrace: [], + lockedMonitors: [], + lockedSynchronizers: [], + lockInfo: null, + }, + ], + }; + + service.threadDump().subscribe(received => { + expectedResult = received; + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(dump); + expect(expectedResult).toEqual(dump); + }); + }); +}); diff --git a/src/main/webapp/app/admin/metrics/metrics.service.ts b/src/main/webapp/app/admin/metrics/metrics.service.ts new file mode 100644 index 00000000..5adb05c0 --- /dev/null +++ b/src/main/webapp/app/admin/metrics/metrics.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { Metrics, ThreadDump } from './metrics.model'; + +@Injectable({ providedIn: 'root' }) +export class MetricsService { + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + getMetrics(): Observable { + return this.http.get(this.applicationConfigService.getEndpointFor('management/jhimetrics')); + } + + threadDump(): Observable { + return this.http.get(this.applicationConfigService.getEndpointFor('management/threaddump')); + } +} diff --git a/src/main/webapp/app/admin/tracker/tracker.component.html b/src/main/webapp/app/admin/tracker/tracker.component.html new file mode 100644 index 00000000..82c6a204 --- /dev/null +++ b/src/main/webapp/app/admin/tracker/tracker.component.html @@ -0,0 +1,25 @@ +
+

Real-time user activities

+ +
+ + + + + + + + + + + + + + + + + + +
UserIP AddressCurrent pageTime
{{ activity.userLogin }}{{ activity.ipAddress }}{{ activity.page }}{{ activity.time | date: 'yyyy-MM-dd HH:mm:ss' }}
+
+
diff --git a/src/main/webapp/app/admin/tracker/tracker.component.ts b/src/main/webapp/app/admin/tracker/tracker.component.ts new file mode 100644 index 00000000..0ead32dd --- /dev/null +++ b/src/main/webapp/app/admin/tracker/tracker.component.ts @@ -0,0 +1,52 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Subscription } from 'rxjs'; + +import { TrackerService } from 'app/core/tracker/tracker.service'; +import { TrackerActivity } from 'app/core/tracker/tracker-activity.model'; +import SharedModule from 'app/shared/shared.module'; + +@Component({ + selector: 'jhi-tracker', + standalone: true, + imports: [SharedModule], + templateUrl: './tracker.component.html', +}) +export default class TrackerComponent implements OnInit, OnDestroy { + activities: TrackerActivity[] = []; + subscription?: Subscription; + + constructor(private trackerService: TrackerService) {} + + showActivity(activity: TrackerActivity): void { + let existingActivity = false; + + for (let index = 0; index < this.activities.length; index++) { + if (this.activities[index].sessionId === activity.sessionId) { + existingActivity = true; + if (activity.page === 'logout') { + this.activities.splice(index, 1); + } else { + this.activities[index] = activity; + } + } + } + + if (!existingActivity && activity.page !== 'logout') { + this.activities.push(activity); + } + } + + ngOnInit(): void { + this.subscription = this.trackerService.subscribe({ + next: (activity: TrackerActivity) => { + this.showActivity(activity); + }, + }); + } + + ngOnDestroy(): void { + if (this.subscription) { + this.subscription.unsubscribe(); + } + } +} diff --git a/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.html b/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.html new file mode 100644 index 00000000..1fdee270 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.html @@ -0,0 +1,21 @@ +
+ + + + + +
diff --git a/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.spec.ts b/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.spec.ts new file mode 100644 index 00000000..d4fc0a4c --- /dev/null +++ b/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.spec.ts @@ -0,0 +1,51 @@ +jest.mock('@ng-bootstrap/ng-bootstrap'); + +import { ComponentFixture, TestBed, waitForAsync, inject, fakeAsync, tick } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { of } from 'rxjs'; + +import { UserManagementService } from '../service/user-management.service'; + +import UserManagementDeleteDialogComponent from './user-management-delete-dialog.component'; + +describe('User Management Delete Component', () => { + let comp: UserManagementDeleteDialogComponent; + let fixture: ComponentFixture; + let service: UserManagementService; + let mockActiveModal: NgbActiveModal; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, UserManagementDeleteDialogComponent], + providers: [NgbActiveModal], + }) + .overrideTemplate(UserManagementDeleteDialogComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserManagementDeleteDialogComponent); + comp = fixture.componentInstance; + service = TestBed.inject(UserManagementService); + mockActiveModal = TestBed.inject(NgbActiveModal); + }); + + describe('confirmDelete', () => { + it('Should call delete service on confirmDelete', inject( + [], + fakeAsync(() => { + // GIVEN + jest.spyOn(service, 'delete').mockReturnValue(of({})); + + // WHEN + comp.confirmDelete('user'); + tick(); + + // THEN + expect(service.delete).toHaveBeenCalledWith('user'); + expect(mockActiveModal.close).toHaveBeenCalledWith('deleted'); + }), + )); + }); +}); diff --git a/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.ts b/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.ts new file mode 100644 index 00000000..382b6409 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.ts @@ -0,0 +1,32 @@ +import { Component } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +import SharedModule from 'app/shared/shared.module'; +import { User } from '../user-management.model'; +import { UserManagementService } from '../service/user-management.service'; + +@Component({ + standalone: true, + selector: 'jhi-user-mgmt-delete-dialog', + templateUrl: './user-management-delete-dialog.component.html', + imports: [SharedModule, FormsModule], +}) +export default class UserManagementDeleteDialogComponent { + user?: User; + + constructor( + private userService: UserManagementService, + private activeModal: NgbActiveModal, + ) {} + + cancel(): void { + this.activeModal.dismiss(); + } + + confirmDelete(login: string): void { + this.userService.delete(login).subscribe(() => { + this.activeModal.close('deleted'); + }); + } +} diff --git a/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.html b/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.html new file mode 100644 index 00000000..48def30d --- /dev/null +++ b/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.html @@ -0,0 +1,51 @@ +
+
+
+

+ User [{{ user.login }}] +

+ +
+
Login
+
+ {{ user.login }} + Activated + Deactivated +
+ +
First name
+
{{ user.firstName }}
+ +
Last name
+
{{ user.lastName }}
+ +
Email
+
{{ user.email }}
+ +
Created by
+
{{ user.createdBy }}
+ +
Created date
+
{{ user.createdDate | date: 'dd/MM/yy HH:mm' }}
+ +
Modified by
+
{{ user.lastModifiedBy }}
+ +
Modified date
+
{{ user.lastModifiedDate | date: 'dd/MM/yy HH:mm' }}
+ +
Profiles
+
+
    +
  • + {{ authority }} +
  • +
+
+
+ + +
+
+
diff --git a/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.spec.ts b/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.spec.ts new file mode 100644 index 00000000..21bc6121 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.spec.ts @@ -0,0 +1,56 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { Authority } from 'app/config/authority.constants'; +import { User } from '../user-management.model'; + +import UserManagementDetailComponent from './user-management-detail.component'; + +describe('User Management Detail Component', () => { + let comp: UserManagementDetailComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [UserManagementDetailComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: { + data: of({ user: new User(123, 'user', 'first', 'last', 'first@last.com', true, 'en', [Authority.USER], 'admin') }), + }, + }, + ], + }) + .overrideTemplate(UserManagementDetailComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserManagementDetailComponent); + comp = fixture.componentInstance; + }); + + describe('OnInit', () => { + it('Should call load all on init', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.user).toEqual( + expect.objectContaining({ + id: 123, + login: 'user', + firstName: 'first', + lastName: 'last', + email: 'first@last.com', + activated: true, + langKey: 'en', + authorities: [Authority.USER], + createdBy: 'admin', + }), + ); + }); + }); +}); diff --git a/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.ts b/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.ts new file mode 100644 index 00000000..b8a7c8fe --- /dev/null +++ b/src/main/webapp/app/admin/user-management/detail/user-management-detail.component.ts @@ -0,0 +1,23 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import SharedModule from 'app/shared/shared.module'; + +import { User } from '../user-management.model'; + +@Component({ + standalone: true, + selector: 'jhi-user-mgmt-detail', + templateUrl: './user-management-detail.component.html', + imports: [SharedModule], +}) +export default class UserManagementDetailComponent implements OnInit { + user: User | null = null; + + constructor(private route: ActivatedRoute) {} + + ngOnInit(): void { + this.route.data.subscribe(({ user }) => { + this.user = user; + }); + } +} diff --git a/src/main/webapp/app/admin/user-management/list/user-management.component.html b/src/main/webapp/app/admin/user-management/list/user-management.component.html new file mode 100644 index 00000000..0c44d9cf --- /dev/null +++ b/src/main/webapp/app/admin/user-management/list/user-management.component.html @@ -0,0 +1,106 @@ +
+

+ Users + +
+ + +
+

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID Login Email ProfilesCreated date Modified by Modified date
+ {{ user.id }} + {{ user.login }}{{ user.email }} + + + +
+ {{ authority }} +
+
{{ user.createdDate | date: 'dd/MM/yy HH:mm' }}{{ user.lastModifiedBy }}{{ user.lastModifiedDate | date: 'dd/MM/yy HH:mm' }} +
+ + + + + +
+
+
+ +
+
+ +
+ +
+ +
+
+
diff --git a/src/main/webapp/app/admin/user-management/list/user-management.component.spec.ts b/src/main/webapp/app/admin/user-management/list/user-management.component.spec.ts new file mode 100644 index 00000000..ab9cbde6 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/list/user-management.component.spec.ts @@ -0,0 +1,103 @@ +jest.mock('app/core/auth/account.service'); + +import { ComponentFixture, TestBed, waitForAsync, inject, fakeAsync, tick } from '@angular/core/testing'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { ActivatedRoute } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; +import { of } from 'rxjs'; + +import { AccountService } from 'app/core/auth/account.service'; +import { UserManagementService } from '../service/user-management.service'; +import { User } from '../user-management.model'; + +import UserManagementComponent from './user-management.component'; + +describe('User Management Component', () => { + let comp: UserManagementComponent; + let fixture: ComponentFixture; + let service: UserManagementService; + let mockAccountService: AccountService; + const data = of({ + defaultSort: 'id,asc', + }); + const queryParamMap = of( + jest.requireActual('@angular/router').convertToParamMap({ + page: '1', + size: '1', + sort: 'id,desc', + }), + ); + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, RouterTestingModule.withRoutes([]), UserManagementComponent], + providers: [{ provide: ActivatedRoute, useValue: { data, queryParamMap } }, AccountService], + }) + .overrideTemplate(UserManagementComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserManagementComponent); + comp = fixture.componentInstance; + service = TestBed.inject(UserManagementService); + mockAccountService = TestBed.inject(AccountService); + mockAccountService.identity = jest.fn(() => of(null)); + }); + + describe('OnInit', () => { + it('Should call load all on init', inject( + [], + fakeAsync(() => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + jest.spyOn(service, 'query').mockReturnValue( + of( + new HttpResponse({ + body: [new User(123)], + headers, + }), + ), + ); + + // WHEN + comp.ngOnInit(); + tick(); // simulate async + + // THEN + expect(service.query).toHaveBeenCalled(); + expect(comp.users?.[0]).toEqual(expect.objectContaining({ id: 123 })); + }), + )); + }); + + describe('setActive', () => { + it('Should update user and call load all', inject( + [], + fakeAsync(() => { + // GIVEN + const headers = new HttpHeaders().append('link', 'link;link'); + const user = new User(123); + jest.spyOn(service, 'query').mockReturnValue( + of( + new HttpResponse({ + body: [user], + headers, + }), + ), + ); + jest.spyOn(service, 'update').mockReturnValue(of(user)); + + // WHEN + comp.setActive(user, true); + tick(); // simulate async + + // THEN + expect(service.update).toHaveBeenCalledWith({ ...user, activated: true }); + expect(service.query).toHaveBeenCalled(); + expect(comp.users?.[0]).toEqual(expect.objectContaining({ id: 123 })); + }), + )); + }); +}); diff --git a/src/main/webapp/app/admin/user-management/list/user-management.component.ts b/src/main/webapp/app/admin/user-management/list/user-management.component.ts new file mode 100644 index 00000000..96b3e9d6 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/list/user-management.component.ts @@ -0,0 +1,116 @@ +import { Component, OnInit } from '@angular/core'; +import { RouterModule, ActivatedRoute, Router } from '@angular/router'; +import { HttpResponse, HttpHeaders } from '@angular/common/http'; +import { combineLatest } from 'rxjs'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; + +import SharedModule from 'app/shared/shared.module'; +import { SortDirective, SortByDirective } from 'app/shared/sort'; +import { ITEMS_PER_PAGE } from 'app/config/pagination.constants'; +import { ASC, DESC, SORT } from 'app/config/navigation.constants'; +import { ItemCountComponent } from 'app/shared/pagination'; +import { AccountService } from 'app/core/auth/account.service'; +import { Account } from 'app/core/auth/account.model'; +import { UserManagementService } from '../service/user-management.service'; +import { User } from '../user-management.model'; +import UserManagementDeleteDialogComponent from '../delete/user-management-delete-dialog.component'; + +@Component({ + standalone: true, + selector: 'jhi-user-mgmt', + templateUrl: './user-management.component.html', + imports: [RouterModule, SharedModule, SortDirective, SortByDirective, UserManagementDeleteDialogComponent, ItemCountComponent], +}) +export default class UserManagementComponent implements OnInit { + currentAccount: Account | null = null; + users: User[] | null = null; + isLoading = false; + totalItems = 0; + itemsPerPage = ITEMS_PER_PAGE; + page!: number; + predicate!: string; + ascending!: boolean; + + constructor( + private userService: UserManagementService, + private accountService: AccountService, + private activatedRoute: ActivatedRoute, + private router: Router, + private modalService: NgbModal, + ) {} + + ngOnInit(): void { + this.accountService.identity().subscribe(account => (this.currentAccount = account)); + this.handleNavigation(); + } + + setActive(user: User, isActivated: boolean): void { + this.userService.update({ ...user, activated: isActivated }).subscribe(() => this.loadAll()); + } + + trackIdentity(_index: number, item: User): number { + return item.id!; + } + + deleteUser(user: User): void { + const modalRef = this.modalService.open(UserManagementDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); + modalRef.componentInstance.user = user; + // unsubscribe not needed because closed completes on modal close + modalRef.closed.subscribe(reason => { + if (reason === 'deleted') { + this.loadAll(); + } + }); + } + + loadAll(): void { + this.isLoading = true; + this.userService + .query({ + page: this.page - 1, + size: this.itemsPerPage, + sort: this.sort(), + }) + .subscribe({ + next: (res: HttpResponse) => { + this.isLoading = false; + this.onSuccess(res.body, res.headers); + }, + error: () => (this.isLoading = false), + }); + } + + transition(): void { + this.router.navigate(['./'], { + relativeTo: this.activatedRoute.parent, + queryParams: { + page: this.page, + sort: `${this.predicate},${this.ascending ? ASC : DESC}`, + }, + }); + } + + private handleNavigation(): void { + combineLatest([this.activatedRoute.data, this.activatedRoute.queryParamMap]).subscribe(([data, params]) => { + const page = params.get('page'); + this.page = +(page ?? 1); + const sort = (params.get(SORT) ?? data['defaultSort']).split(','); + this.predicate = sort[0]; + this.ascending = sort[1] === ASC; + this.loadAll(); + }); + } + + private sort(): string[] { + const result = [`${this.predicate},${this.ascending ? ASC : DESC}`]; + if (this.predicate !== 'id') { + result.push('id'); + } + return result; + } + + private onSuccess(users: User[] | null, headers: HttpHeaders): void { + this.totalItems = Number(headers.get('X-Total-Count')); + this.users = users; + } +} diff --git a/src/main/webapp/app/admin/user-management/service/user-management.service.spec.ts b/src/main/webapp/app/admin/user-management/service/user-management.service.spec.ts new file mode 100644 index 00000000..41a6ec89 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/service/user-management.service.spec.ts @@ -0,0 +1,67 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpErrorResponse } from '@angular/common/http'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { Authority } from 'app/config/authority.constants'; +import { User } from '../user-management.model'; + +import { UserManagementService } from './user-management.service'; + +describe('User Service', () => { + let service: UserManagementService; + let httpMock: HttpTestingController; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + service = TestBed.inject(UserManagementService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should return User', () => { + let expectedResult: string | undefined; + + service.find('user').subscribe(received => { + expectedResult = received.login; + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush(new User(123, 'user')); + expect(expectedResult).toEqual('user'); + }); + + it('should return Authorities', () => { + let expectedResult: string[] = []; + + service.authorities().subscribe(authorities => { + expectedResult = authorities; + }); + const req = httpMock.expectOne({ method: 'GET' }); + + req.flush([Authority.USER, Authority.ADMIN]); + expect(expectedResult).toEqual([Authority.USER, Authority.ADMIN]); + }); + + it('should propagate not found response', () => { + let expectedResult = 0; + + service.find('user').subscribe({ + error: (error: HttpErrorResponse) => (expectedResult = error.status), + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush('Invalid request parameters', { + status: 404, + statusText: 'Bad Request', + }); + expect(expectedResult).toEqual(404); + }); + }); +}); diff --git a/src/main/webapp/app/admin/user-management/service/user-management.service.ts b/src/main/webapp/app/admin/user-management/service/user-management.service.ts new file mode 100644 index 00000000..fda617aa --- /dev/null +++ b/src/main/webapp/app/admin/user-management/service/user-management.service.ts @@ -0,0 +1,43 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { createRequestOption } from 'app/core/request/request-util'; +import { Pagination } from 'app/core/request/request.model'; +import { IUser } from '../user-management.model'; + +@Injectable({ providedIn: 'root' }) +export class UserManagementService { + private resourceUrl = this.applicationConfigService.getEndpointFor('api/admin/users'); + + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + create(user: IUser): Observable { + return this.http.post(this.resourceUrl, user); + } + + update(user: IUser): Observable { + return this.http.put(this.resourceUrl, user); + } + + find(login: string): Observable { + return this.http.get(`${this.resourceUrl}/${login}`); + } + + query(req?: Pagination): Observable> { + const options = createRequestOption(req); + return this.http.get(this.resourceUrl, { params: options, observe: 'response' }); + } + + delete(login: string): Observable<{}> { + return this.http.delete(`${this.resourceUrl}/${login}`); + } + + authorities(): Observable { + return this.http.get(this.applicationConfigService.getEndpointFor('api/authorities')); + } +} diff --git a/src/main/webapp/app/admin/user-management/update/user-management-update.component.html b/src/main/webapp/app/admin/user-management/update/user-management-update.component.html new file mode 100644 index 00000000..4f83903b --- /dev/null +++ b/src/main/webapp/app/admin/user-management/update/user-management-update.component.html @@ -0,0 +1,100 @@ +
+
+
+

Create or edit a user

+ + + +
+ + +
+ +
+ + + +
+ This field is required. + + This field cannot be longer than 50 characters. + + This field can only contain letters, digits and e-mail addresses. +
+
+ +
+ + + +
+ This field cannot be longer than 50 characters. +
+
+ +
+ + + +
+ This field cannot be longer than 50 characters. +
+
+ +
+ + + +
+ This field is required. + + This field cannot be longer than 100 characters. + + This field is required to be at least 5 characters. + + Your email is invalid. +
+
+ +
+ +
+ +
+ + +
+ + + +
+
+
diff --git a/src/main/webapp/app/admin/user-management/update/user-management-update.component.spec.ts b/src/main/webapp/app/admin/user-management/update/user-management-update.component.spec.ts new file mode 100644 index 00000000..199eb493 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/update/user-management-update.component.spec.ts @@ -0,0 +1,94 @@ +import { ComponentFixture, TestBed, waitForAsync, inject, fakeAsync, tick } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { FormBuilder } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { Authority } from 'app/config/authority.constants'; +import { UserManagementService } from '../service/user-management.service'; +import { User } from '../user-management.model'; + +import UserManagementUpdateComponent from './user-management-update.component'; + +describe('User Management Update Component', () => { + let comp: UserManagementUpdateComponent; + let fixture: ComponentFixture; + let service: UserManagementService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, UserManagementUpdateComponent], + providers: [ + FormBuilder, + { + provide: ActivatedRoute, + useValue: { + data: of({ user: new User(123, 'user', 'first', 'last', 'first@last.com', true, 'en', [Authority.USER], 'admin') }), + }, + }, + ], + }) + .overrideTemplate(UserManagementUpdateComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UserManagementUpdateComponent); + comp = fixture.componentInstance; + service = TestBed.inject(UserManagementService); + }); + + describe('OnInit', () => { + it('Should load authorities and language on init', inject( + [], + fakeAsync(() => { + // GIVEN + jest.spyOn(service, 'authorities').mockReturnValue(of(['USER'])); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(service.authorities).toHaveBeenCalled(); + expect(comp.authorities).toEqual(['USER']); + }), + )); + }); + + describe('save', () => { + it('Should call update service on save for existing user', inject( + [], + fakeAsync(() => { + // GIVEN + const entity = { id: 123 }; + jest.spyOn(service, 'update').mockReturnValue(of(entity)); + comp.editForm.patchValue(entity); + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(service.update).toHaveBeenCalledWith(expect.objectContaining(entity)); + expect(comp.isSaving).toEqual(false); + }), + )); + + it('Should call create service on save for new user', inject( + [], + fakeAsync(() => { + // GIVEN + const entity = { login: 'foo' } as User; + jest.spyOn(service, 'create').mockReturnValue(of(entity)); + comp.editForm.patchValue(entity); + // WHEN + comp.save(); + tick(); // simulate async + + // THEN + expect(comp.editForm.getRawValue().id).toBeNull(); + expect(service.create).toHaveBeenCalledWith(expect.objectContaining(entity)); + expect(comp.isSaving).toEqual(false); + }), + )); + }); +}); diff --git a/src/main/webapp/app/admin/user-management/update/user-management-update.component.ts b/src/main/webapp/app/admin/user-management/update/user-management-update.component.ts new file mode 100644 index 00000000..1f153723 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/update/user-management-update.component.ts @@ -0,0 +1,90 @@ +import { Component, OnInit } from '@angular/core'; +import { FormGroup, FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; + +import SharedModule from 'app/shared/shared.module'; +import { IUser } from '../user-management.model'; +import { UserManagementService } from '../service/user-management.service'; + +const userTemplate = {} as IUser; + +const newUser: IUser = { + activated: true, +} as IUser; + +@Component({ + standalone: true, + selector: 'jhi-user-mgmt-update', + templateUrl: './user-management-update.component.html', + imports: [SharedModule, FormsModule, ReactiveFormsModule], +}) +export default class UserManagementUpdateComponent implements OnInit { + authorities: string[] = []; + isSaving = false; + + editForm = new FormGroup({ + id: new FormControl(userTemplate.id), + login: new FormControl(userTemplate.login, { + nonNullable: true, + validators: [ + Validators.required, + Validators.minLength(1), + Validators.maxLength(50), + Validators.pattern('^[a-zA-Z0-9!$&*+=?^_`{|}~.-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$|^[_.@A-Za-z0-9-]+$'), + ], + }), + firstName: new FormControl(userTemplate.firstName, { validators: [Validators.maxLength(50)] }), + lastName: new FormControl(userTemplate.lastName, { validators: [Validators.maxLength(50)] }), + email: new FormControl(userTemplate.email, { + nonNullable: true, + validators: [Validators.minLength(5), Validators.maxLength(254), Validators.email], + }), + activated: new FormControl(userTemplate.activated, { nonNullable: true }), + authorities: new FormControl(userTemplate.authorities, { nonNullable: true }), + }); + + constructor( + private userService: UserManagementService, + private route: ActivatedRoute, + ) {} + + ngOnInit(): void { + this.route.data.subscribe(({ user }) => { + if (user) { + this.editForm.reset(user); + } else { + this.editForm.reset(newUser); + } + }); + this.userService.authorities().subscribe(authorities => (this.authorities = authorities)); + } + + previousState(): void { + window.history.back(); + } + + save(): void { + this.isSaving = true; + const user = this.editForm.getRawValue(); + if (user.id !== null) { + this.userService.update(user).subscribe({ + next: () => this.onSaveSuccess(), + error: () => this.onSaveError(), + }); + } else { + this.userService.create(user).subscribe({ + next: () => this.onSaveSuccess(), + error: () => this.onSaveError(), + }); + } + } + + private onSaveSuccess(): void { + this.isSaving = false; + this.previousState(); + } + + private onSaveError(): void { + this.isSaving = false; + } +} diff --git a/src/main/webapp/app/admin/user-management/user-management.model.ts b/src/main/webapp/app/admin/user-management/user-management.model.ts new file mode 100644 index 00000000..bdb2844c --- /dev/null +++ b/src/main/webapp/app/admin/user-management/user-management.model.ts @@ -0,0 +1,31 @@ +export interface IUser { + id: number | null; + login?: string; + firstName?: string | null; + lastName?: string | null; + email?: string; + activated?: boolean; + langKey?: string; + authorities?: string[]; + createdBy?: string; + createdDate?: Date; + lastModifiedBy?: string; + lastModifiedDate?: Date; +} + +export class User implements IUser { + constructor( + public id: number | null, + public login?: string, + public firstName?: string | null, + public lastName?: string | null, + public email?: string, + public activated?: boolean, + public langKey?: string, + public authorities?: string[], + public createdBy?: string, + public createdDate?: Date, + public lastModifiedBy?: string, + public lastModifiedDate?: Date, + ) {} +} diff --git a/src/main/webapp/app/admin/user-management/user-management.route.ts b/src/main/webapp/app/admin/user-management/user-management.route.ts new file mode 100644 index 00000000..1a8f7644 --- /dev/null +++ b/src/main/webapp/app/admin/user-management/user-management.route.ts @@ -0,0 +1,50 @@ +import { inject } from '@angular/core'; +import { ActivatedRouteSnapshot, Routes, ResolveFn } from '@angular/router'; +import { of } from 'rxjs'; + +import { IUser } from './user-management.model'; +import { UserManagementService } from './service/user-management.service'; +import UserManagementComponent from './list/user-management.component'; +import UserManagementDetailComponent from './detail/user-management-detail.component'; +import UserManagementUpdateComponent from './update/user-management-update.component'; + +export const UserManagementResolve: ResolveFn = (route: ActivatedRouteSnapshot) => { + const login = route.paramMap.get('login'); + if (login) { + return inject(UserManagementService).find(login); + } + return of(null); +}; + +const userManagementRoute: Routes = [ + { + path: '', + component: UserManagementComponent, + data: { + defaultSort: 'id,asc', + }, + }, + { + path: ':login/view', + component: UserManagementDetailComponent, + resolve: { + user: UserManagementResolve, + }, + }, + { + path: 'new', + component: UserManagementUpdateComponent, + resolve: { + user: UserManagementResolve, + }, + }, + { + path: ':login/edit', + component: UserManagementUpdateComponent, + resolve: { + user: UserManagementResolve, + }, + }, +]; + +export default userManagementRoute; diff --git a/src/main/webapp/app/app-page-title-strategy.ts b/src/main/webapp/app/app-page-title-strategy.ts new file mode 100644 index 00000000..5aca2c6d --- /dev/null +++ b/src/main/webapp/app/app-page-title-strategy.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core'; +import { RouterStateSnapshot, TitleStrategy } from '@angular/router'; + +@Injectable() +export class AppPageTitleStrategy extends TitleStrategy { + constructor() { + super(); + } + + override updateTitle(routerState: RouterStateSnapshot): void { + let pageTitle = this.buildTitle(routerState); + if (!pageTitle) { + pageTitle = 'Artemis Benchmarking'; + } + document.title = pageTitle; + } +} diff --git a/src/main/webapp/app/app-routing.module.ts b/src/main/webapp/app/app-routing.module.ts new file mode 100644 index 00000000..9d3ed7d3 --- /dev/null +++ b/src/main/webapp/app/app-routing.module.ts @@ -0,0 +1,55 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { DEBUG_INFO_ENABLED } from 'app/app.constants'; +import { Authority } from 'app/config/authority.constants'; +import { UserRouteAccessService } from 'app/core/auth/user-route-access.service'; +import { errorRoute } from './layouts/error/error.route'; + +import HomeComponent from './home/home.component'; +import NavbarComponent from './layouts/navbar/navbar.component'; +import LoginComponent from './login/login.component'; + +@NgModule({ + imports: [ + RouterModule.forRoot( + [ + { + path: '', + component: HomeComponent, + title: 'Welcome, Java Hipster!', + }, + { + path: '', + component: NavbarComponent, + outlet: 'navbar', + }, + { + path: 'admin', + data: { + authorities: [Authority.ADMIN], + }, + canActivate: [UserRouteAccessService], + loadChildren: () => import('./admin/admin-routing.module'), + }, + { + path: 'account', + loadChildren: () => import('./account/account.route'), + }, + { + path: 'login', + component: LoginComponent, + title: 'Sign in', + }, + { + path: '', + loadChildren: () => import(`./entities/entity-routing.module`).then(({ EntityRoutingModule }) => EntityRoutingModule), + }, + ...errorRoute, + ], + { enableTracing: DEBUG_INFO_ENABLED, bindToComponentInputs: true }, + ), + ], + exports: [RouterModule], +}) +export class AppRoutingModule {} diff --git a/src/main/webapp/app/app.constants.ts b/src/main/webapp/app/app.constants.ts new file mode 100644 index 00000000..695015c4 --- /dev/null +++ b/src/main/webapp/app/app.constants.ts @@ -0,0 +1,9 @@ +// These constants are injected via webpack DefinePlugin variables. +// You can add more variables in webpack.common.js or in profile specific webpack..js files. +// If you change the values in the webpack config files, you need to re run webpack to update the application + +declare const __DEBUG_INFO_ENABLED__: boolean; +declare const __VERSION__: string; + +export const VERSION = __VERSION__; +export const DEBUG_INFO_ENABLED = __DEBUG_INFO_ENABLED__; diff --git a/src/main/webapp/app/app.module.ts b/src/main/webapp/app/app.module.ts new file mode 100644 index 00000000..b11dd360 --- /dev/null +++ b/src/main/webapp/app/app.module.ts @@ -0,0 +1,56 @@ +import { NgModule, LOCALE_ID } from '@angular/core'; +import { registerLocaleData } from '@angular/common'; +import { HttpClientModule } from '@angular/common/http'; +import locale from '@angular/common/locales/en'; +import { BrowserModule, Title } from '@angular/platform-browser'; +import { TitleStrategy } from '@angular/router'; +import { ServiceWorkerModule } from '@angular/service-worker'; +import { FaIconLibrary } from '@fortawesome/angular-fontawesome'; +import dayjs from 'dayjs/esm'; +import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import './config/dayjs'; +import { httpInterceptorProviders } from 'app/core/interceptor/index'; +import { AppRoutingModule } from './app-routing.module'; +// jhipster-needle-angular-add-module-import JHipster will add new module here +import { NgbDateDayjsAdapter } from './config/datepicker-adapter'; +import { fontAwesomeIcons } from './config/font-awesome-icons'; +import MainComponent from './layouts/main/main.component'; +import MainModule from './layouts/main/main.module'; +import { AppPageTitleStrategy } from './app-page-title-strategy'; +import { TrackerService } from './core/tracker/tracker.service'; + +@NgModule({ + imports: [ + BrowserModule, + // jhipster-needle-angular-add-module JHipster will add new module here + AppRoutingModule, + // Set this to true to enable service worker (PWA) + ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }), + HttpClientModule, + MainModule, + ], + providers: [ + Title, + { provide: LOCALE_ID, useValue: 'en' }, + { provide: NgbDateAdapter, useClass: NgbDateDayjsAdapter }, + httpInterceptorProviders, + { provide: TitleStrategy, useClass: AppPageTitleStrategy }, + ], + bootstrap: [MainComponent], +}) +export class AppModule { + constructor( + applicationConfigService: ApplicationConfigService, + iconLibrary: FaIconLibrary, + trackerService: TrackerService, + dpConfig: NgbDatepickerConfig, + ) { + trackerService.setup(); + applicationConfigService.setEndpointPrefix(SERVER_API_URL); + registerLocaleData(locale); + iconLibrary.addIcons(...fontAwesomeIcons); + dpConfig.minDate = { year: dayjs().subtract(100, 'year').year(), month: 1, day: 1 }; + } +} diff --git a/src/main/webapp/app/config/authority.constants.ts b/src/main/webapp/app/config/authority.constants.ts new file mode 100644 index 00000000..1501bcf4 --- /dev/null +++ b/src/main/webapp/app/config/authority.constants.ts @@ -0,0 +1,4 @@ +export enum Authority { + ADMIN = 'ROLE_ADMIN', + USER = 'ROLE_USER', +} diff --git a/src/main/webapp/app/config/datepicker-adapter.ts b/src/main/webapp/app/config/datepicker-adapter.ts new file mode 100644 index 00000000..3f8b16c6 --- /dev/null +++ b/src/main/webapp/app/config/datepicker-adapter.ts @@ -0,0 +1,20 @@ +/** + * Angular bootstrap Date adapter + */ +import { Injectable } from '@angular/core'; +import { NgbDateAdapter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'; +import dayjs from 'dayjs/esm'; + +@Injectable() +export class NgbDateDayjsAdapter extends NgbDateAdapter { + fromModel(date: dayjs.Dayjs | null): NgbDateStruct | null { + if (date && dayjs.isDayjs(date) && date.isValid()) { + return { year: date.year(), month: date.month() + 1, day: date.date() }; + } + return null; + } + + toModel(date: NgbDateStruct | null): dayjs.Dayjs | null { + return date ? dayjs(`${date.year}-${date.month}-${date.day}`) : null; + } +} diff --git a/src/main/webapp/app/config/dayjs.ts b/src/main/webapp/app/config/dayjs.ts new file mode 100644 index 00000000..23e825d3 --- /dev/null +++ b/src/main/webapp/app/config/dayjs.ts @@ -0,0 +1,11 @@ +import dayjs from 'dayjs/esm'; +import customParseFormat from 'dayjs/esm/plugin/customParseFormat'; +import duration from 'dayjs/esm/plugin/duration'; +import relativeTime from 'dayjs/esm/plugin/relativeTime'; + +// jhipster-needle-i18n-language-dayjs-imports - JHipster will import languages from dayjs here + +// DAYJS CONFIGURATION +dayjs.extend(customParseFormat); +dayjs.extend(duration); +dayjs.extend(relativeTime); diff --git a/src/main/webapp/app/config/error.constants.ts b/src/main/webapp/app/config/error.constants.ts new file mode 100644 index 00000000..eff19a30 --- /dev/null +++ b/src/main/webapp/app/config/error.constants.ts @@ -0,0 +1,3 @@ +export const PROBLEM_BASE_URL = 'https://www.jhipster.tech/problem'; +export const EMAIL_ALREADY_USED_TYPE = `${PROBLEM_BASE_URL}/email-already-used`; +export const LOGIN_ALREADY_USED_TYPE = `${PROBLEM_BASE_URL}/login-already-used`; diff --git a/src/main/webapp/app/config/font-awesome-icons.ts b/src/main/webapp/app/config/font-awesome-icons.ts new file mode 100644 index 00000000..7fcf1696 --- /dev/null +++ b/src/main/webapp/app/config/font-awesome-icons.ts @@ -0,0 +1,83 @@ +import { + faArrowLeft, + faAsterisk, + faBan, + faBars, + faBell, + faBook, + faCalendarAlt, + faCheck, + faCloud, + faCogs, + faDatabase, + faEye, + faFlag, + faHeart, + faHome, + faList, + faLock, + faPencilAlt, + faPlus, + faRoad, + faSave, + faSearch, + faSignOutAlt, + faSignInAlt, + faSort, + faSortDown, + faSortUp, + faSync, + faTachometerAlt, + faTasks, + faThList, + faTimes, + faTrashAlt, + faUser, + faUserPlus, + faUsers, + faUsersCog, + faWrench, + // jhipster-needle-add-icon-import +} from '@fortawesome/free-solid-svg-icons'; + +export const fontAwesomeIcons = [ + faArrowLeft, + faAsterisk, + faBan, + faBars, + faBell, + faBook, + faCalendarAlt, + faCheck, + faCloud, + faCogs, + faDatabase, + faEye, + faFlag, + faHeart, + faHome, + faList, + faLock, + faPencilAlt, + faPlus, + faRoad, + faSave, + faSearch, + faSignOutAlt, + faSignInAlt, + faSort, + faSortDown, + faSortUp, + faSync, + faTachometerAlt, + faTasks, + faThList, + faTimes, + faTrashAlt, + faUser, + faUserPlus, + faUsers, + faUsersCog, + faWrench, + // jhipster-needle-add-icon-import +]; diff --git a/src/main/webapp/app/config/input.constants.ts b/src/main/webapp/app/config/input.constants.ts new file mode 100644 index 00000000..1e3978a9 --- /dev/null +++ b/src/main/webapp/app/config/input.constants.ts @@ -0,0 +1,2 @@ +export const DATE_FORMAT = 'YYYY-MM-DD'; +export const DATE_TIME_FORMAT = 'YYYY-MM-DDTHH:mm'; diff --git a/src/main/webapp/app/config/navigation.constants.ts b/src/main/webapp/app/config/navigation.constants.ts new file mode 100644 index 00000000..609160d1 --- /dev/null +++ b/src/main/webapp/app/config/navigation.constants.ts @@ -0,0 +1,5 @@ +export const ASC = 'asc'; +export const DESC = 'desc'; +export const SORT = 'sort'; +export const ITEM_DELETED_EVENT = 'deleted'; +export const DEFAULT_SORT_DATA = 'defaultSort'; diff --git a/src/main/webapp/app/config/pagination.constants.ts b/src/main/webapp/app/config/pagination.constants.ts new file mode 100644 index 00000000..6bee3ff5 --- /dev/null +++ b/src/main/webapp/app/config/pagination.constants.ts @@ -0,0 +1,3 @@ +export const TOTAL_COUNT_RESPONSE_HEADER = 'X-Total-Count'; +export const PAGE_HEADER = 'page'; +export const ITEMS_PER_PAGE = 20; diff --git a/src/main/webapp/app/config/uib-pagination.config.ts b/src/main/webapp/app/config/uib-pagination.config.ts new file mode 100644 index 00000000..ecabe165 --- /dev/null +++ b/src/main/webapp/app/config/uib-pagination.config.ts @@ -0,0 +1,14 @@ +import { Injectable } from '@angular/core'; +import { NgbPaginationConfig } from '@ng-bootstrap/ng-bootstrap'; + +import { ITEMS_PER_PAGE } from 'app/config/pagination.constants'; + +@Injectable({ providedIn: 'root' }) +export class PaginationConfig { + constructor(config: NgbPaginationConfig) { + config.boundaryLinks = true; + config.maxSize = 5; + config.pageSize = ITEMS_PER_PAGE; + config.size = 'sm'; + } +} diff --git a/src/main/webapp/app/core/auth/account.model.ts b/src/main/webapp/app/core/auth/account.model.ts new file mode 100644 index 00000000..76e67637 --- /dev/null +++ b/src/main/webapp/app/core/auth/account.model.ts @@ -0,0 +1,12 @@ +export class Account { + constructor( + public activated: boolean, + public authorities: string[], + public email: string, + public firstName: string | null, + public langKey: string, + public lastName: string | null, + public login: string, + public imageUrl: string | null, + ) {} +} diff --git a/src/main/webapp/app/core/auth/account.service.spec.ts b/src/main/webapp/app/core/auth/account.service.spec.ts new file mode 100644 index 00000000..721ac966 --- /dev/null +++ b/src/main/webapp/app/core/auth/account.service.spec.ts @@ -0,0 +1,216 @@ +jest.mock('app/core/auth/state-storage.service'); + +import { Router } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { TestBed } from '@angular/core/testing'; + +import { Account } from 'app/core/auth/account.model'; +import { Authority } from 'app/config/authority.constants'; +import { StateStorageService } from 'app/core/auth/state-storage.service'; +import { ApplicationConfigService } from 'app/core/config/application-config.service'; + +import { AccountService } from './account.service'; + +function accountWithAuthorities(authorities: string[]): Account { + return { + activated: true, + authorities, + email: '', + firstName: '', + langKey: '', + lastName: '', + login: '', + imageUrl: '', + }; +} + +describe('Account Service', () => { + let service: AccountService; + let applicationConfigService: ApplicationConfigService; + let httpMock: HttpTestingController; + let mockStorageService: StateStorageService; + let mockRouter: Router; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, RouterTestingModule.withRoutes([])], + providers: [StateStorageService], + }); + + service = TestBed.inject(AccountService); + applicationConfigService = TestBed.inject(ApplicationConfigService); + httpMock = TestBed.inject(HttpTestingController); + mockStorageService = TestBed.inject(StateStorageService); + mockRouter = TestBed.inject(Router); + jest.spyOn(mockRouter, 'navigateByUrl').mockImplementation(() => Promise.resolve(true)); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('save', () => { + it('should call account saving endpoint with correct values', () => { + // GIVEN + const account = accountWithAuthorities([]); + + // WHEN + service.save(account).subscribe(); + const testRequest = httpMock.expectOne({ method: 'POST', url: applicationConfigService.getEndpointFor('api/account') }); + testRequest.flush({}); + + // THEN + expect(testRequest.request.body).toEqual(account); + }); + }); + + describe('authenticate', () => { + it('authenticationState should emit null if input is null', () => { + // GIVEN + let userIdentity: Account | null = accountWithAuthorities([]); + service.getAuthenticationState().subscribe(account => (userIdentity = account)); + + // WHEN + service.authenticate(null); + + // THEN + expect(userIdentity).toBeNull(); + expect(service.isAuthenticated()).toBe(false); + }); + + it('authenticationState should emit the same account as was in input parameter', () => { + // GIVEN + const expectedResult = accountWithAuthorities([]); + let userIdentity: Account | null = null; + service.getAuthenticationState().subscribe(account => (userIdentity = account)); + + // WHEN + service.authenticate(expectedResult); + + // THEN + expect(userIdentity).toEqual(expectedResult); + expect(service.isAuthenticated()).toBe(true); + }); + }); + + describe('identity', () => { + it('should call /account only once if last call have not returned', () => { + // When I call + service.identity().subscribe(); + // Once more + service.identity().subscribe(); + // Then there is only request + httpMock.expectOne({ method: 'GET' }); + }); + + it('should call /account only once if not logged out after first authentication and should call /account again if user has logged out', () => { + // Given the user is authenticated + service.identity().subscribe(); + httpMock.expectOne({ method: 'GET' }).flush({}); + + // When I call + service.identity().subscribe(); + + // Then there is no second request + httpMock.expectNone({ method: 'GET' }); + + // When I log out + service.authenticate(null); + // and then call + service.identity().subscribe(); + + // Then there is a new request + httpMock.expectOne({ method: 'GET' }); + }); + + describe('navigateToStoredUrl', () => { + it('should navigate to the previous stored url post successful authentication', () => { + // GIVEN + mockStorageService.getUrl = jest.fn(() => 'admin/users?page=0'); + + // WHEN + service.identity().subscribe(); + httpMock.expectOne({ method: 'GET' }).flush({}); + + // THEN + expect(mockStorageService.getUrl).toHaveBeenCalledTimes(1); + expect(mockStorageService.clearUrl).toHaveBeenCalledTimes(1); + expect(mockRouter.navigateByUrl).toHaveBeenCalledWith('admin/users?page=0'); + }); + + it('should not navigate to the previous stored url when authentication fails', () => { + // WHEN + service.identity().subscribe(); + httpMock.expectOne({ method: 'GET' }).error(new ErrorEvent('')); + + // THEN + expect(mockStorageService.getUrl).not.toHaveBeenCalled(); + expect(mockStorageService.clearUrl).not.toHaveBeenCalled(); + expect(mockRouter.navigateByUrl).not.toHaveBeenCalled(); + }); + + it('should not navigate to the previous stored url when no such url exists post successful authentication', () => { + // GIVEN + mockStorageService.getUrl = jest.fn(() => null); + + // WHEN + service.identity().subscribe(); + httpMock.expectOne({ method: 'GET' }).flush({}); + + // THEN + expect(mockStorageService.getUrl).toHaveBeenCalledTimes(1); + expect(mockStorageService.clearUrl).not.toHaveBeenCalled(); + expect(mockRouter.navigateByUrl).not.toHaveBeenCalled(); + }); + }); + }); + + describe('hasAnyAuthority', () => { + describe('hasAnyAuthority string parameter', () => { + it('should return false if user is not logged', () => { + const hasAuthority = service.hasAnyAuthority(Authority.USER); + expect(hasAuthority).toBe(false); + }); + + it('should return false if user is logged and has not authority', () => { + service.authenticate(accountWithAuthorities([Authority.USER])); + + const hasAuthority = service.hasAnyAuthority(Authority.ADMIN); + + expect(hasAuthority).toBe(false); + }); + + it('should return true if user is logged and has authority', () => { + service.authenticate(accountWithAuthorities([Authority.USER])); + + const hasAuthority = service.hasAnyAuthority(Authority.USER); + + expect(hasAuthority).toBe(true); + }); + }); + + describe('hasAnyAuthority array parameter', () => { + it('should return false if user is not logged', () => { + const hasAuthority = service.hasAnyAuthority([Authority.USER]); + expect(hasAuthority).toBeFalsy(); + }); + + it('should return false if user is logged and has not authority', () => { + service.authenticate(accountWithAuthorities([Authority.USER])); + + const hasAuthority = service.hasAnyAuthority([Authority.ADMIN]); + + expect(hasAuthority).toBe(false); + }); + + it('should return true if user is logged and has authority', () => { + service.authenticate(accountWithAuthorities([Authority.USER])); + + const hasAuthority = service.hasAnyAuthority([Authority.USER, Authority.ADMIN]); + + expect(hasAuthority).toBe(true); + }); + }); + }); +}); diff --git a/src/main/webapp/app/core/auth/account.service.ts b/src/main/webapp/app/core/auth/account.service.ts new file mode 100644 index 00000000..cefe1d1a --- /dev/null +++ b/src/main/webapp/app/core/auth/account.service.ts @@ -0,0 +1,81 @@ +import { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; +import { HttpClient } from '@angular/common/http'; +import { Observable, ReplaySubject, of } from 'rxjs'; +import { shareReplay, tap, catchError } from 'rxjs/operators'; + +import { StateStorageService } from 'app/core/auth/state-storage.service'; +import { Account } from 'app/core/auth/account.model'; +import { ApplicationConfigService } from '../config/application-config.service'; + +@Injectable({ providedIn: 'root' }) +export class AccountService { + private userIdentity: Account | null = null; + private authenticationState = new ReplaySubject(1); + private accountCache$?: Observable | null; + + constructor( + private http: HttpClient, + private stateStorageService: StateStorageService, + private router: Router, + private applicationConfigService: ApplicationConfigService, + ) {} + + save(account: Account): Observable<{}> { + return this.http.post(this.applicationConfigService.getEndpointFor('api/account'), account); + } + + authenticate(identity: Account | null): void { + this.userIdentity = identity; + this.authenticationState.next(this.userIdentity); + if (!identity) { + this.accountCache$ = null; + } + } + + hasAnyAuthority(authorities: string[] | string): boolean { + if (!this.userIdentity) { + return false; + } + if (!Array.isArray(authorities)) { + authorities = [authorities]; + } + return this.userIdentity.authorities.some((authority: string) => authorities.includes(authority)); + } + + identity(force?: boolean): Observable { + if (!this.accountCache$ || force) { + this.accountCache$ = this.fetch().pipe( + tap((account: Account) => { + this.authenticate(account); + + this.navigateToStoredUrl(); + }), + shareReplay(), + ); + } + return this.accountCache$.pipe(catchError(() => of(null))); + } + + isAuthenticated(): boolean { + return this.userIdentity !== null; + } + + getAuthenticationState(): Observable { + return this.authenticationState.asObservable(); + } + + private fetch(): Observable { + return this.http.get(this.applicationConfigService.getEndpointFor('api/account')); + } + + private navigateToStoredUrl(): void { + // previousState can be set in the authExpiredInterceptor and in the userRouteAccessService + // if login is successful, go to stored previousState and clear previousState + const previousUrl = this.stateStorageService.getUrl(); + if (previousUrl) { + this.stateStorageService.clearUrl(); + this.router.navigateByUrl(previousUrl); + } + } +} diff --git a/src/main/webapp/app/core/auth/auth-jwt.service.spec.ts b/src/main/webapp/app/core/auth/auth-jwt.service.spec.ts new file mode 100644 index 00000000..5b0e83c6 --- /dev/null +++ b/src/main/webapp/app/core/auth/auth-jwt.service.spec.ts @@ -0,0 +1,80 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { AuthServerProvider } from 'app/core/auth/auth-jwt.service'; +import { StateStorageService } from './state-storage.service'; + +describe('Auth JWT', () => { + let service: AuthServerProvider; + let httpMock: HttpTestingController; + let mockStorageService: StateStorageService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + + mockStorageService = TestBed.inject(StateStorageService); + httpMock = TestBed.inject(HttpTestingController); + service = TestBed.inject(AuthServerProvider); + }); + + describe('Get Token', () => { + it('should return empty token if not found in local storage nor session storage', () => { + const result = service.getToken(); + expect(result).toEqual(''); + }); + + it('should return token from session storage if local storage is empty', () => { + sessionStorage.setItem('jhi-authenticationToken', JSON.stringify('sessionStorageToken')); + const result = service.getToken(); + expect(result).toEqual('sessionStorageToken'); + }); + + it('should return token from localstorage storage', () => { + localStorage.setItem('jhi-authenticationToken', JSON.stringify('localStorageToken')); + const result = service.getToken(); + expect(result).toEqual('localStorageToken'); + }); + }); + + describe('Login', () => { + it('should clear session storage and save in local storage when rememberMe is true', () => { + // GIVEN + mockStorageService.storeAuthenticationToken = jest.fn(); + + // WHEN + service.login({ username: 'John', password: '123', rememberMe: true }).subscribe(); + httpMock.expectOne('api/authenticate').flush({ id_token: '1' }); + + // THEN + httpMock.verify(); + expect(mockStorageService.storeAuthenticationToken).toHaveBeenCalledWith('1', true); + }); + + it('should clear local storage and save in session storage when rememberMe is false', () => { + // GIVEN + mockStorageService.storeAuthenticationToken = jest.fn(); + + // WHEN + service.login({ username: 'John', password: '123', rememberMe: false }).subscribe(); + httpMock.expectOne('api/authenticate').flush({ id_token: '1' }); + + // THEN + httpMock.verify(); + expect(mockStorageService.storeAuthenticationToken).toHaveBeenCalledWith('1', false); + }); + }); + + describe('Logout', () => { + it('should clear storage', () => { + // GIVEN + mockStorageService.clearAuthenticationToken = jest.fn(); + + // WHEN + service.logout().subscribe(); + + // THEN + expect(mockStorageService.clearAuthenticationToken).toHaveBeenCalled(); + }); + }); +}); diff --git a/src/main/webapp/app/core/auth/auth-jwt.service.ts b/src/main/webapp/app/core/auth/auth-jwt.service.ts new file mode 100644 index 00000000..1b6dc1f3 --- /dev/null +++ b/src/main/webapp/app/core/auth/auth-jwt.service.ts @@ -0,0 +1,42 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import { Login } from 'app/login/login.model'; +import { ApplicationConfigService } from '../config/application-config.service'; +import { StateStorageService } from './state-storage.service'; + +type JwtToken = { + id_token: string; +}; + +@Injectable({ providedIn: 'root' }) +export class AuthServerProvider { + constructor( + private http: HttpClient, + private stateStorageService: StateStorageService, + private applicationConfigService: ApplicationConfigService, + ) {} + + getToken(): string { + return this.stateStorageService.getAuthenticationToken() ?? ''; + } + + login(credentials: Login): Observable { + return this.http + .post(this.applicationConfigService.getEndpointFor('api/authenticate'), credentials) + .pipe(map(response => this.authenticateSuccess(response, credentials.rememberMe))); + } + + logout(): Observable { + return new Observable(observer => { + this.stateStorageService.clearAuthenticationToken(); + observer.complete(); + }); + } + + private authenticateSuccess(response: JwtToken, rememberMe: boolean): void { + this.stateStorageService.storeAuthenticationToken(response.id_token, rememberMe); + } +} diff --git a/src/main/webapp/app/core/auth/state-storage.service.ts b/src/main/webapp/app/core/auth/state-storage.service.ts new file mode 100644 index 00000000..af8b5629 --- /dev/null +++ b/src/main/webapp/app/core/auth/state-storage.service.ts @@ -0,0 +1,40 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ providedIn: 'root' }) +export class StateStorageService { + private previousUrlKey = 'previousUrl'; + private authenticationKey = 'jhi-authenticationToken'; + + storeUrl(url: string): void { + sessionStorage.setItem(this.previousUrlKey, JSON.stringify(url)); + } + + getUrl(): string | null { + const previousUrl = sessionStorage.getItem(this.previousUrlKey); + return previousUrl ? (JSON.parse(previousUrl) as string | null) : previousUrl; + } + + clearUrl(): void { + sessionStorage.removeItem(this.previousUrlKey); + } + + storeAuthenticationToken(authenticationToken: string, rememberMe: boolean): void { + authenticationToken = JSON.stringify(authenticationToken); + this.clearAuthenticationToken(); + if (rememberMe) { + localStorage.setItem(this.authenticationKey, authenticationToken); + } else { + sessionStorage.setItem(this.authenticationKey, authenticationToken); + } + } + + getAuthenticationToken(): string | null { + const authenticationToken = localStorage.getItem(this.authenticationKey) ?? sessionStorage.getItem(this.authenticationKey); + return authenticationToken ? (JSON.parse(authenticationToken) as string | null) : authenticationToken; + } + + clearAuthenticationToken(): void { + sessionStorage.removeItem(this.authenticationKey); + localStorage.removeItem(this.authenticationKey); + } +} diff --git a/src/main/webapp/app/core/auth/user-route-access.service.ts b/src/main/webapp/app/core/auth/user-route-access.service.ts new file mode 100644 index 00000000..6bdf53bd --- /dev/null +++ b/src/main/webapp/app/core/auth/user-route-access.service.ts @@ -0,0 +1,33 @@ +import { inject, isDevMode } from '@angular/core'; +import { ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot } from '@angular/router'; +import { map } from 'rxjs/operators'; + +import { AccountService } from 'app/core/auth/account.service'; +import { StateStorageService } from './state-storage.service'; + +export const UserRouteAccessService: CanActivateFn = (next: ActivatedRouteSnapshot, state: RouterStateSnapshot) => { + const accountService = inject(AccountService); + const router = inject(Router); + const stateStorageService = inject(StateStorageService); + return accountService.identity().pipe( + map(account => { + if (account) { + const authorities = next.data['authorities']; + + if (!authorities || authorities.length === 0 || accountService.hasAnyAuthority(authorities)) { + return true; + } + + if (isDevMode()) { + console.error('User has not any of required authorities: ', authorities); + } + router.navigate(['accessdenied']); + return false; + } + + stateStorageService.storeUrl(state.url); + router.navigate(['/login']); + return false; + }), + ); +}; diff --git a/src/main/webapp/app/core/config/application-config.service.spec.ts b/src/main/webapp/app/core/config/application-config.service.spec.ts new file mode 100644 index 00000000..4451c9bb --- /dev/null +++ b/src/main/webapp/app/core/config/application-config.service.spec.ts @@ -0,0 +1,40 @@ +import { TestBed } from '@angular/core/testing'; + +import { ApplicationConfigService } from './application-config.service'; + +describe('ApplicationConfigService', () => { + let service: ApplicationConfigService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ApplicationConfigService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + describe('without prefix', () => { + it('should return correctly', () => { + expect(service.getEndpointFor('api')).toEqual('api'); + }); + + it('should return correctly when passing microservice', () => { + expect(service.getEndpointFor('api', 'microservice')).toEqual('services/microservice/api'); + }); + }); + + describe('with prefix', () => { + beforeEach(() => { + service.setEndpointPrefix('prefix/'); + }); + + it('should return correctly', () => { + expect(service.getEndpointFor('api')).toEqual('prefix/api'); + }); + + it('should return correctly when passing microservice', () => { + expect(service.getEndpointFor('api', 'microservice')).toEqual('prefix/services/microservice/api'); + }); + }); +}); diff --git a/src/main/webapp/app/core/config/application-config.service.ts b/src/main/webapp/app/core/config/application-config.service.ts new file mode 100644 index 00000000..0102e5f0 --- /dev/null +++ b/src/main/webapp/app/core/config/application-config.service.ts @@ -0,0 +1,28 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root', +}) +export class ApplicationConfigService { + private endpointPrefix = ''; + private microfrontend = false; + + setEndpointPrefix(endpointPrefix: string): void { + this.endpointPrefix = endpointPrefix; + } + + setMicrofrontend(microfrontend = true): void { + this.microfrontend = microfrontend; + } + + isMicrofrontend(): boolean { + return this.microfrontend; + } + + getEndpointFor(api: string, microservice?: string): string { + if (microservice) { + return `${this.endpointPrefix}services/${microservice}/${api}`; + } + return `${this.endpointPrefix}${api}`; + } +} diff --git a/src/main/webapp/app/core/interceptor/auth-expired.interceptor.ts b/src/main/webapp/app/core/interceptor/auth-expired.interceptor.ts new file mode 100644 index 00000000..fdca3377 --- /dev/null +++ b/src/main/webapp/app/core/interceptor/auth-expired.interceptor.ts @@ -0,0 +1,33 @@ +import { Injectable } from '@angular/core'; +import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; +import { Router } from '@angular/router'; + +import { LoginService } from 'app/login/login.service'; +import { StateStorageService } from 'app/core/auth/state-storage.service'; +import { AccountService } from 'app/core/auth/account.service'; + +@Injectable() +export class AuthExpiredInterceptor implements HttpInterceptor { + constructor( + private loginService: LoginService, + private stateStorageService: StateStorageService, + private router: Router, + private accountService: AccountService, + ) {} + + intercept(request: HttpRequest, next: HttpHandler): Observable> { + return next.handle(request).pipe( + tap({ + error: (err: HttpErrorResponse) => { + if (err.status === 401 && err.url && !err.url.includes('api/account') && this.accountService.isAuthenticated()) { + this.stateStorageService.storeUrl(this.router.routerState.snapshot.url); + this.loginService.logout(); + this.router.navigate(['/login']); + } + }, + }), + ); + } +} diff --git a/src/main/webapp/app/core/interceptor/auth.interceptor.ts b/src/main/webapp/app/core/interceptor/auth.interceptor.ts new file mode 100644 index 00000000..4a700534 --- /dev/null +++ b/src/main/webapp/app/core/interceptor/auth.interceptor.ts @@ -0,0 +1,31 @@ +import { Injectable } from '@angular/core'; +import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { StateStorageService } from 'app/core/auth/state-storage.service'; +import { ApplicationConfigService } from '../config/application-config.service'; + +@Injectable() +export class AuthInterceptor implements HttpInterceptor { + constructor( + private stateStorageService: StateStorageService, + private applicationConfigService: ApplicationConfigService, + ) {} + + intercept(request: HttpRequest, next: HttpHandler): Observable> { + const serverApiUrl = this.applicationConfigService.getEndpointFor(''); + if (!request.url || (request.url.startsWith('http') && !(serverApiUrl && request.url.startsWith(serverApiUrl)))) { + return next.handle(request); + } + + const token: string | null = this.stateStorageService.getAuthenticationToken(); + if (token) { + request = request.clone({ + setHeaders: { + Authorization: `Bearer ${token}`, + }, + }); + } + return next.handle(request); + } +} diff --git a/src/main/webapp/app/core/interceptor/error-handler.interceptor.ts b/src/main/webapp/app/core/interceptor/error-handler.interceptor.ts new file mode 100644 index 00000000..d6f222bd --- /dev/null +++ b/src/main/webapp/app/core/interceptor/error-handler.interceptor.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@angular/core'; +import { HttpInterceptor, HttpRequest, HttpErrorResponse, HttpHandler, HttpEvent } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +import { EventManager, EventWithContent } from 'app/core/util/event-manager.service'; + +@Injectable() +export class ErrorHandlerInterceptor implements HttpInterceptor { + constructor(private eventManager: EventManager) {} + + intercept(request: HttpRequest, next: HttpHandler): Observable> { + return next.handle(request).pipe( + tap({ + error: (err: HttpErrorResponse) => { + if (!(err.status === 401 && (err.message === '' || err.url?.includes('api/account')))) { + this.eventManager.broadcast(new EventWithContent('artemisBenchmarkingApp.httpError', err)); + } + }, + }), + ); + } +} diff --git a/src/main/webapp/app/core/interceptor/index.ts b/src/main/webapp/app/core/interceptor/index.ts new file mode 100644 index 00000000..f7e72e3a --- /dev/null +++ b/src/main/webapp/app/core/interceptor/index.ts @@ -0,0 +1,29 @@ +import { HTTP_INTERCEPTORS } from '@angular/common/http'; + +import { AuthInterceptor } from 'app/core/interceptor/auth.interceptor'; +import { AuthExpiredInterceptor } from 'app/core/interceptor/auth-expired.interceptor'; +import { ErrorHandlerInterceptor } from 'app/core/interceptor/error-handler.interceptor'; +import { NotificationInterceptor } from 'app/core/interceptor/notification.interceptor'; + +export const httpInterceptorProviders = [ + { + provide: HTTP_INTERCEPTORS, + useClass: AuthInterceptor, + multi: true, + }, + { + provide: HTTP_INTERCEPTORS, + useClass: AuthExpiredInterceptor, + multi: true, + }, + { + provide: HTTP_INTERCEPTORS, + useClass: ErrorHandlerInterceptor, + multi: true, + }, + { + provide: HTTP_INTERCEPTORS, + useClass: NotificationInterceptor, + multi: true, + }, +]; diff --git a/src/main/webapp/app/core/interceptor/notification.interceptor.ts b/src/main/webapp/app/core/interceptor/notification.interceptor.ts new file mode 100644 index 00000000..d5eb56d7 --- /dev/null +++ b/src/main/webapp/app/core/interceptor/notification.interceptor.ts @@ -0,0 +1,34 @@ +import { HttpInterceptor, HttpRequest, HttpResponse, HttpHandler, HttpEvent } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +import { AlertService } from 'app/core/util/alert.service'; + +@Injectable() +export class NotificationInterceptor implements HttpInterceptor { + constructor(private alertService: AlertService) {} + + intercept(request: HttpRequest, next: HttpHandler): Observable> { + return next.handle(request).pipe( + tap((event: HttpEvent) => { + if (event instanceof HttpResponse) { + let alert: string | null = null; + + for (const headerKey of event.headers.keys()) { + if (headerKey.toLowerCase().endsWith('app-alert')) { + alert = event.headers.get(headerKey); + } + } + + if (alert) { + this.alertService.addAlert({ + type: 'success', + message: alert, + }); + } + } + }), + ); + } +} diff --git a/src/main/webapp/app/core/request/request-util.ts b/src/main/webapp/app/core/request/request-util.ts new file mode 100644 index 00000000..694a238a --- /dev/null +++ b/src/main/webapp/app/core/request/request-util.ts @@ -0,0 +1,23 @@ +import { HttpParams } from '@angular/common/http'; + +export const createRequestOption = (req?: any): HttpParams => { + let options: HttpParams = new HttpParams(); + + if (req) { + Object.keys(req).forEach(key => { + if (key !== 'sort' && req[key] !== undefined) { + for (const value of [].concat(req[key]).filter(v => v !== '')) { + options = options.append(key, value); + } + } + }); + + if (req.sort) { + req.sort.forEach((val: string) => { + options = options.append('sort', val); + }); + } + } + + return options; +}; diff --git a/src/main/webapp/app/core/request/request.model.ts b/src/main/webapp/app/core/request/request.model.ts new file mode 100644 index 00000000..5de2b69a --- /dev/null +++ b/src/main/webapp/app/core/request/request.model.ts @@ -0,0 +1,11 @@ +export interface Pagination { + page: number; + size: number; + sort: string[]; +} + +export interface Search { + query: string; +} + +export interface SearchWithPagination extends Search, Pagination {} diff --git a/src/main/webapp/app/core/tracker/tracker-activity.model.ts b/src/main/webapp/app/core/tracker/tracker-activity.model.ts new file mode 100644 index 00000000..ebdbc8b1 --- /dev/null +++ b/src/main/webapp/app/core/tracker/tracker-activity.model.ts @@ -0,0 +1,9 @@ +export class TrackerActivity { + constructor( + public sessionId: string, + public userLogin: string, + public ipAddress: string, + public page: string, + public time: string, + ) {} +} diff --git a/src/main/webapp/app/core/tracker/tracker.service.ts b/src/main/webapp/app/core/tracker/tracker.service.ts new file mode 100644 index 00000000..50655d75 --- /dev/null +++ b/src/main/webapp/app/core/tracker/tracker.service.ts @@ -0,0 +1,109 @@ +import { Injectable } from '@angular/core'; +import { Location } from '@angular/common'; +import { Router, NavigationEnd, Event } from '@angular/router'; +import { Subscription, Observer } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; + +import SockJS from 'sockjs-client'; +import { RxStomp } from '@stomp/rx-stomp'; + +import { AuthServerProvider } from 'app/core/auth/auth-jwt.service'; +import { AccountService } from '../auth/account.service'; +import { Account } from '../auth/account.model'; +import { TrackerActivity } from './tracker-activity.model'; + +const DESTINATION_TRACKER = '/topic/tracker'; +const DESTINATION_ACTIVITY = '/topic/activity'; + +@Injectable({ providedIn: 'root' }) +export class TrackerService { + private rxStomp?: RxStomp; + private routerSubscription: Subscription | null = null; + + constructor( + private router: Router, + private accountService: AccountService, + private authServerProvider: AuthServerProvider, + private location: Location, + ) {} + + setup(): void { + this.rxStomp = new RxStomp(); + this.rxStomp.configure({ + // eslint-disable-next-line no-console + debug: (msg: string): void => console.log(new Date(), msg), + }); + + this.accountService.getAuthenticationState().subscribe({ + next: (account: Account | null) => { + if (account) { + this.connect(); + } else { + this.disconnect(); + } + }, + }); + + this.rxStomp.connected$.subscribe(() => { + this.sendActivity(); + + this.routerSubscription = this.router.events + .pipe(filter((event: Event) => event instanceof NavigationEnd)) + .subscribe(() => this.sendActivity()); + }); + } + + get stomp(): RxStomp { + if (!this.rxStomp) { + throw new Error('Stomp connection not initialized'); + } + return this.rxStomp; + } + + public subscribe(observer: Partial>): Subscription { + return ( + this.stomp + .watch(DESTINATION_TRACKER) + // eslint-disable-next-line @typescript-eslint/no-unsafe-return + .pipe(map(imessage => JSON.parse(imessage.body))) + .subscribe(observer) + ); + } + + private connect(): void { + this.updateCredentials(); + return this.stomp.activate(); + } + + private disconnect(): Promise { + if (this.routerSubscription) { + this.routerSubscription.unsubscribe(); + this.routerSubscription = null; + } + return this.stomp.deactivate(); + } + + private buildUrl(): string { + // building absolute path so that websocket doesn't fail when deploying with a context path + let url = '/websocket/tracker'; + url = this.location.prepareExternalUrl(url); + const authToken = this.authServerProvider.getToken(); + if (authToken) { + return `${url}?access_token=${authToken}`; + } + return url; + } + + private updateCredentials(): void { + this.stomp.configure({ + webSocketFactory: () => SockJS(this.buildUrl()), + }); + } + + private sendActivity(): void { + this.stomp.publish({ + destination: DESTINATION_ACTIVITY, + body: JSON.stringify({ page: this.router.routerState.snapshot.url }), + }); + } +} diff --git a/src/main/webapp/app/core/util/alert.service.spec.ts b/src/main/webapp/app/core/util/alert.service.spec.ts new file mode 100644 index 00000000..38bbc789 --- /dev/null +++ b/src/main/webapp/app/core/util/alert.service.spec.ts @@ -0,0 +1,233 @@ +import { inject, TestBed } from '@angular/core/testing'; + +import { Alert, AlertService } from './alert.service'; + +describe('Alert service test', () => { + describe('Alert Service Test', () => { + let extAlerts: Alert[]; + + beforeEach(() => { + TestBed.configureTestingModule({}); + jest.useFakeTimers(); + extAlerts = []; + }); + + it('should produce a proper alert object and fetch it', inject([AlertService], (service: AlertService) => { + expect( + service.addAlert({ + type: 'success', + message: 'Hello Jhipster', + timeout: 3000, + toast: true, + position: 'top left', + }), + ).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster', + id: 0, + timeout: 3000, + toast: true, + position: 'top left', + } as Alert), + ); + + expect(service.get().length).toBe(1); + expect(service.get()[0]).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster', + id: 0, + timeout: 3000, + toast: true, + position: 'top left', + } as Alert), + ); + })); + + it('should produce a proper alert object and add it to external alert objects array', inject( + [AlertService], + (service: AlertService) => { + expect( + service.addAlert( + { + type: 'success', + message: 'Hello Jhipster', + timeout: 3000, + toast: true, + position: 'top left', + }, + extAlerts, + ), + ).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster', + id: 0, + timeout: 3000, + toast: true, + position: 'top left', + } as Alert), + ); + + expect(extAlerts.length).toBe(1); + expect(extAlerts[0]).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster', + id: 0, + timeout: 3000, + toast: true, + position: 'top left', + } as Alert), + ); + }, + )); + + it('should produce an alert object with correct id', inject([AlertService], (service: AlertService) => { + service.addAlert({ type: 'info', message: 'Hello Jhipster info' }); + expect(service.addAlert({ type: 'success', message: 'Hello Jhipster success' })).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster success', + id: 1, + } as Alert), + ); + + expect(service.get().length).toBe(2); + expect(service.get()[1]).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster success', + id: 1, + } as Alert), + ); + })); + + it('should close an alert correctly', inject([AlertService], (service: AlertService) => { + const alert0 = service.addAlert({ type: 'info', message: 'Hello Jhipster info' }); + const alert1 = service.addAlert({ type: 'info', message: 'Hello Jhipster info 2' }); + const alert2 = service.addAlert({ type: 'success', message: 'Hello Jhipster success' }); + expect(alert2).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster success', + id: 2, + } as Alert), + ); + + expect(service.get().length).toBe(3); + alert1.close?.(service.get()); + expect(service.get().length).toBe(2); + expect(service.get()[1]).not.toEqual( + expect.objectContaining({ + type: 'info', + message: 'Hello Jhipster info 2', + id: 1, + } as Alert), + ); + alert2.close?.(service.get()); + expect(service.get().length).toBe(1); + expect(service.get()[0]).not.toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster success', + id: 2, + } as Alert), + ); + alert0.close?.(service.get()); + expect(service.get().length).toBe(0); + })); + + it('should close an alert on timeout correctly', inject([AlertService], (service: AlertService) => { + service.addAlert({ type: 'info', message: 'Hello Jhipster info' }); + + expect(service.get().length).toBe(1); + + jest.advanceTimersByTime(6000); + + expect(service.get().length).toBe(0); + })); + + it('should clear alerts', inject([AlertService], (service: AlertService) => { + service.addAlert({ type: 'info', message: 'Hello Jhipster info' }); + service.addAlert({ type: 'danger', message: 'Hello Jhipster info' }); + service.addAlert({ type: 'success', message: 'Hello Jhipster info' }); + expect(service.get().length).toBe(3); + service.clear(); + expect(service.get().length).toBe(0); + })); + + it('should produce a scoped alert', inject([AlertService], (service: AlertService) => { + expect( + service.addAlert( + { + type: 'success', + message: 'Hello Jhipster', + timeout: 3000, + toast: true, + position: 'top left', + }, + [], + ), + ).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster', + id: 0, + timeout: 3000, + toast: true, + position: 'top left', + } as Alert), + ); + + expect(service.get().length).toBe(0); + })); + + it('should produce a success message', inject([AlertService], (service: AlertService) => { + expect(service.addAlert({ type: 'success', message: 'Hello Jhipster' })).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster', + } as Alert), + ); + })); + + it('should produce a success message with custom position', inject([AlertService], (service: AlertService) => { + expect(service.addAlert({ type: 'success', message: 'Hello Jhipster', position: 'bottom left' })).toEqual( + expect.objectContaining({ + type: 'success', + message: 'Hello Jhipster', + position: 'bottom left', + } as Alert), + ); + })); + + it('should produce a error message', inject([AlertService], (service: AlertService) => { + expect(service.addAlert({ type: 'danger', message: 'Hello Jhipster' })).toEqual( + expect.objectContaining({ + type: 'danger', + message: 'Hello Jhipster', + } as Alert), + ); + })); + + it('should produce a warning message', inject([AlertService], (service: AlertService) => { + expect(service.addAlert({ type: 'warning', message: 'Hello Jhipster' })).toEqual( + expect.objectContaining({ + type: 'warning', + message: 'Hello Jhipster', + } as Alert), + ); + })); + + it('should produce a info message', inject([AlertService], (service: AlertService) => { + expect(service.addAlert({ type: 'info', message: 'Hello Jhipster' })).toEqual( + expect.objectContaining({ + type: 'info', + message: 'Hello Jhipster', + } as Alert), + ); + })); + }); +}); diff --git a/src/main/webapp/app/core/util/alert.service.ts b/src/main/webapp/app/core/util/alert.service.ts new file mode 100644 index 00000000..645ae352 --- /dev/null +++ b/src/main/webapp/app/core/util/alert.service.ts @@ -0,0 +1,76 @@ +import { Injectable, SecurityContext, NgZone } from '@angular/core'; +import { DomSanitizer } from '@angular/platform-browser'; + +export type AlertType = 'success' | 'danger' | 'warning' | 'info'; + +export interface Alert { + id?: number; + type: AlertType; + message?: string; + timeout?: number; + toast?: boolean; + position?: string; + close?: (alerts: Alert[]) => void; +} + +@Injectable({ + providedIn: 'root', +}) +export class AlertService { + timeout = 5000; + toast = false; + position = 'top right'; + + // unique id for each alert. Starts from 0. + private alertId = 0; + private alerts: Alert[] = []; + + constructor( + private sanitizer: DomSanitizer, + private ngZone: NgZone, + ) {} + + clear(): void { + this.alerts = []; + } + + get(): Alert[] { + return this.alerts; + } + + /** + * Adds alert to alerts array and returns added alert. + * @param alert Alert to add. If `timeout`, `toast` or `position` is missing then applying default value. + * @param extAlerts If missing then adding `alert` to `AlertService` internal array and alerts can be retrieved by `get()`. + * Else adding `alert` to `extAlerts`. + * @returns Added alert + */ + addAlert(alert: Alert, extAlerts?: Alert[]): Alert { + alert.id = this.alertId++; + + alert.message = this.sanitizer.sanitize(SecurityContext.HTML, alert.message ?? '') ?? ''; + alert.timeout = alert.timeout ?? this.timeout; + alert.toast = alert.toast ?? this.toast; + alert.position = alert.position ?? this.position; + alert.close = (alertsArray: Alert[]) => this.closeAlert(alert.id!, alertsArray); + + (extAlerts ?? this.alerts).push(alert); + + if (alert.timeout > 0) { + setTimeout(() => { + this.closeAlert(alert.id!, extAlerts ?? this.alerts); + }, alert.timeout); + } + + return alert; + } + + private closeAlert(alertId: number, extAlerts?: Alert[]): void { + const alerts = extAlerts ?? this.alerts; + const alertIndex = alerts.map(alert => alert.id).indexOf(alertId); + // if found alert then remove + if (alertIndex >= 0) { + alerts.splice(alertIndex, 1); + } + } +} diff --git a/src/main/webapp/app/core/util/data-util.service.spec.ts b/src/main/webapp/app/core/util/data-util.service.spec.ts new file mode 100644 index 00000000..fccbcc64 --- /dev/null +++ b/src/main/webapp/app/core/util/data-util.service.spec.ts @@ -0,0 +1,34 @@ +import { TestBed } from '@angular/core/testing'; + +import { DataUtils } from './data-util.service'; + +describe('Data Utils Service Test', () => { + let service: DataUtils; + + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [DataUtils], + }); + service = TestBed.inject(DataUtils); + }); + + describe('byteSize', () => { + it('should return the bytesize of the text', () => { + expect(service.byteSize('Hello JHipster')).toBe(`10.5 bytes`); + }); + }); + + describe('openFile', () => { + it('should open the file in the new window', () => { + const newWindow = { ...window }; + newWindow.document.write = jest.fn(); + window.open = jest.fn(() => newWindow); + window.URL.createObjectURL = jest.fn(); + // 'JHipster' in base64 is 'SkhpcHN0ZXI=' + const data = 'SkhpcHN0ZXI='; + const contentType = 'text/plain'; + service.openFile(data, contentType); + expect(window.open).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/src/main/webapp/app/core/util/data-util.service.ts b/src/main/webapp/app/core/util/data-util.service.ts new file mode 100644 index 00000000..8ac137e0 --- /dev/null +++ b/src/main/webapp/app/core/util/data-util.service.ts @@ -0,0 +1,130 @@ +import { Buffer } from 'buffer'; +import { Injectable } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { Observable, Observer } from 'rxjs'; + +export type FileLoadErrorType = 'not.image' | 'could.not.extract'; + +export interface FileLoadError { + message: string; + key: FileLoadErrorType; + params?: any; +} + +/** + * An utility service for data. + */ +@Injectable({ + providedIn: 'root', +}) +export class DataUtils { + /** + * Method to find the byte size of the string provides + */ + byteSize(base64String: string): string { + return this.formatAsBytes(this.size(base64String)); + } + + /** + * Method to open file + */ + openFile(data: string, contentType: string | null | undefined): void { + contentType = contentType ?? ''; + + const byteCharacters = Buffer.from(data, 'base64').toString('binary'); + const byteNumbers = new Array(byteCharacters.length); + for (let i = 0; i < byteCharacters.length; i++) { + byteNumbers[i] = byteCharacters.charCodeAt(i); + } + const byteArray = new Uint8Array(byteNumbers); + const blob = new Blob([byteArray], { + type: contentType, + }); + const fileURL = window.URL.createObjectURL(blob); + const win = window.open(fileURL); + win!.onload = function () { + URL.revokeObjectURL(fileURL); + }; + } + + /** + * Sets the base 64 data & file type of the 1st file on the event (event.target.files[0]) in the passed entity object + * and returns an observable. + * + * @param event the object containing the file (at event.target.files[0]) + * @param editForm the form group where the input field is located + * @param field the field name to set the file's 'base 64 data' on + * @param isImage boolean representing if the file represented by the event is an image + * @returns an observable that loads file to form field and completes if sussessful + * or returns error as FileLoadError on failure + */ + loadFileToForm(event: Event, editForm: FormGroup, field: string, isImage: boolean): Observable { + return new Observable((observer: Observer) => { + const eventTarget: HTMLInputElement | null = event.target as HTMLInputElement | null; + if (eventTarget?.files?.[0]) { + const file: File = eventTarget.files[0]; + if (isImage && !file.type.startsWith('image/')) { + const error: FileLoadError = { + message: `File was expected to be an image but was found to be '${file.type}'`, + key: 'not.image', + params: { fileType: file.type }, + }; + observer.error(error); + } else { + const fieldContentType: string = field + 'ContentType'; + this.toBase64(file, (base64Data: string) => { + editForm.patchValue({ + [field]: base64Data, + [fieldContentType]: file.type, + }); + observer.next(); + observer.complete(); + }); + } + } else { + const error: FileLoadError = { + message: 'Could not extract file', + key: 'could.not.extract', + params: { event }, + }; + observer.error(error); + } + }); + } + + /** + * Method to convert the file to base64 + */ + private toBase64(file: File, callback: (base64Data: string) => void): void { + const fileReader: FileReader = new FileReader(); + fileReader.onload = (e: ProgressEvent) => { + if (typeof e.target?.result === 'string') { + const base64Data: string = e.target.result.substring(e.target.result.indexOf('base64,') + 'base64,'.length); + callback(base64Data); + } + }; + fileReader.readAsDataURL(file); + } + + private endsWith(suffix: string, str: string): boolean { + return str.includes(suffix, str.length - suffix.length); + } + + private paddingSize(value: string): number { + if (this.endsWith('==', value)) { + return 2; + } + if (this.endsWith('=', value)) { + return 1; + } + return 0; + } + + private size(value: string): number { + return (value.length / 4) * 3 - this.paddingSize(value); + } + + private formatAsBytes(size: number): string { + return size.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ' ') + ' bytes'; // NOSONAR + } +} diff --git a/src/main/webapp/app/core/util/event-manager.service.spec.ts b/src/main/webapp/app/core/util/event-manager.service.spec.ts new file mode 100644 index 00000000..48d4e193 --- /dev/null +++ b/src/main/webapp/app/core/util/event-manager.service.spec.ts @@ -0,0 +1,84 @@ +import { inject, TestBed } from '@angular/core/testing'; + +import { EventManager, EventWithContent } from './event-manager.service'; + +describe('Event Manager tests', () => { + describe('EventWithContent', () => { + it('should create correctly EventWithContent', () => { + // WHEN + const eventWithContent = new EventWithContent('name', 'content'); + + // THEN + expect(eventWithContent).toEqual({ name: 'name', content: 'content' }); + }); + }); + + describe('EventManager', () => { + let recievedEvent: EventWithContent | string | null; + + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [EventManager], + }); + recievedEvent = null; + }); + + it('should not fail when nosubscriber and broadcasting', inject([EventManager], (eventManager: EventManager) => { + expect(eventManager.observer).toBeUndefined(); + eventManager.broadcast({ name: 'modifier', content: 'modified something' }); + })); + + it('should create an observable and callback when broadcasted EventWithContent', inject( + [EventManager], + (eventManager: EventManager) => { + // GIVEN + eventManager.subscribe('modifier', (event: EventWithContent | string) => (recievedEvent = event)); + + // WHEN + eventManager.broadcast({ name: 'unrelatedModifier', content: 'unrelated modification' }); + // THEN + expect(recievedEvent).toBeNull(); + + // WHEN + eventManager.broadcast({ name: 'modifier', content: 'modified something' }); + // THEN + expect(recievedEvent).toEqual({ name: 'modifier', content: 'modified something' }); + }, + )); + + it('should create an observable and callback when broadcasted string', inject([EventManager], (eventManager: EventManager) => { + // GIVEN + eventManager.subscribe('modifier', (event: EventWithContent | string) => (recievedEvent = event)); + + // WHEN + eventManager.broadcast('unrelatedModifier'); + // THEN + expect(recievedEvent).toBeNull(); + + // WHEN + eventManager.broadcast('modifier'); + // THEN + expect(recievedEvent).toEqual('modifier'); + })); + + it('should subscribe to multiple events', inject([EventManager], (eventManager: EventManager) => { + // GIVEN + eventManager.subscribe(['modifier', 'modifier2'], (event: EventWithContent | string) => (recievedEvent = event)); + + // WHEN + eventManager.broadcast('unrelatedModifier'); + // THEN + expect(recievedEvent).toBeNull(); + + // WHEN + eventManager.broadcast({ name: 'modifier', content: 'modified something' }); + // THEN + expect(recievedEvent).toEqual({ name: 'modifier', content: 'modified something' }); + + // WHEN + eventManager.broadcast('modifier2'); + // THEN + expect(recievedEvent).toEqual('modifier2'); + })); + }); +}); diff --git a/src/main/webapp/app/core/util/event-manager.service.ts b/src/main/webapp/app/core/util/event-manager.service.ts new file mode 100644 index 00000000..a73d2129 --- /dev/null +++ b/src/main/webapp/app/core/util/event-manager.service.ts @@ -0,0 +1,66 @@ +import { Injectable } from '@angular/core'; +import { Observable, Observer, Subscription } from 'rxjs'; +import { filter, share } from 'rxjs/operators'; + +export class EventWithContent { + constructor( + public name: string, + public content: T, + ) {} +} + +/** + * An utility class to manage RX events + */ +@Injectable({ + providedIn: 'root', +}) +export class EventManager { + observable: Observable | string>; + observer?: Observer | string>; + + constructor() { + this.observable = new Observable((observer: Observer | string>) => { + this.observer = observer; + }).pipe(share()); + } + + /** + * Method to broadcast the event to observer + */ + broadcast(event: EventWithContent | string): void { + if (this.observer) { + this.observer.next(event); + } + } + + /** + * Method to subscribe to an event with callback + * @param eventNames Single event name or array of event names to what subscribe + * @param callback Callback to run when the event occurs + */ + subscribe(eventNames: string | string[], callback: (event: EventWithContent | string) => void): Subscription { + if (typeof eventNames === 'string') { + eventNames = [eventNames]; + } + return this.observable + .pipe( + filter((event: EventWithContent | string) => { + for (const eventName of eventNames) { + if ((typeof event === 'string' && event === eventName) || (typeof event !== 'string' && event.name === eventName)) { + return true; + } + } + return false; + }), + ) + .subscribe(callback); + } + + /** + * Method to unsubscribe the subscription + */ + destroy(subscriber: Subscription): void { + subscriber.unsubscribe(); + } +} diff --git a/src/main/webapp/app/core/util/operators.spec.ts b/src/main/webapp/app/core/util/operators.spec.ts new file mode 100644 index 00000000..429647c4 --- /dev/null +++ b/src/main/webapp/app/core/util/operators.spec.ts @@ -0,0 +1,18 @@ +import { filterNaN, isPresent } from './operators'; + +describe('Operators Test', () => { + describe('isPresent', () => { + it('should remove null and undefined values', () => { + expect([1, null, undefined].filter(isPresent)).toEqual([1]); + }); + }); + + describe('filterNaN', () => { + it('should return 0 for NaN', () => { + expect(filterNaN(NaN)).toBe(0); + }); + it('should return number for a number', () => { + expect(filterNaN(12345)).toBe(12345); + }); + }); +}); diff --git a/src/main/webapp/app/core/util/operators.ts b/src/main/webapp/app/core/util/operators.ts new file mode 100644 index 00000000..c2245929 --- /dev/null +++ b/src/main/webapp/app/core/util/operators.ts @@ -0,0 +1,9 @@ +/* + * Function used to workaround https://github.com/microsoft/TypeScript/issues/16069 + * es2019 alternative `const filteredArr = myArr.flatMap((x) => x ? x : []);` + */ +export function isPresent(t: T | undefined | null | void): t is T { + return t !== undefined && t !== null; +} + +export const filterNaN = (input: number): number => (isNaN(input) ? 0 : input); diff --git a/src/main/webapp/app/core/util/parse-links.service.spec.ts b/src/main/webapp/app/core/util/parse-links.service.spec.ts new file mode 100644 index 00000000..40b6c75c --- /dev/null +++ b/src/main/webapp/app/core/util/parse-links.service.spec.ts @@ -0,0 +1,36 @@ +import { inject, TestBed } from '@angular/core/testing'; + +import { ParseLinks } from './parse-links.service'; + +describe('Parse links service test', () => { + describe('Parse Links Service Test', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + providers: [ParseLinks], + }); + }); + + it('should throw an error when passed an empty string', inject([ParseLinks], (service: ParseLinks) => { + expect(function () { + service.parse(''); + }).toThrow(new Error('input must not be of zero length')); + })); + + it('should throw an error when passed without comma', inject([ParseLinks], (service: ParseLinks) => { + expect(function () { + service.parse('test'); + }).toThrow(new Error('section could not be split on ";"')); + })); + + it('should throw an error when passed without semicolon', inject([ParseLinks], (service: ParseLinks) => { + expect(function () { + service.parse('test,test2'); + }).toThrow(new Error('section could not be split on ";"')); + })); + + it('should return links when headers are passed', inject([ParseLinks], (service: ParseLinks) => { + const links = { last: 0, first: 0 }; + expect(service.parse(' ; rel="last",; rel="first"')).toEqual(links); + })); + }); +}); diff --git a/src/main/webapp/app/core/util/parse-links.service.ts b/src/main/webapp/app/core/util/parse-links.service.ts new file mode 100644 index 00000000..dc1eb0e9 --- /dev/null +++ b/src/main/webapp/app/core/util/parse-links.service.ts @@ -0,0 +1,47 @@ +import { Injectable } from '@angular/core'; + +/** + * An utility service for link parsing. + */ +@Injectable({ + providedIn: 'root', +}) +export class ParseLinks { + /** + * Method to parse the links + */ + parse(header: string): { [key: string]: number } { + if (header.length === 0) { + throw new Error('input must not be of zero length'); + } + + // Split parts by comma + const parts: string[] = header.split(','); + const links: { [key: string]: number } = {}; + + // Parse each part into a named link + parts.forEach(p => { + const section: string[] = p.split(';'); + + if (section.length !== 2) { + throw new Error('section could not be split on ";"'); + } + + const url: string = section[0].replace(/<(.*)>/, '$1').trim(); // NOSONAR + const queryString: { [key: string]: string | undefined } = {}; + + url.replace(/([^?=&]+)(=([^&]*))?/g, (_$0: string, $1: string | undefined, _$2: string | undefined, $3: string | undefined) => { + if ($1 !== undefined) { + queryString[$1] = $3; + } + return $3 ?? ''; + }); + + if (queryString.page !== undefined) { + const name: string = section[1].replace(/rel="(.*)"/, '$1').trim(); + links[name] = parseInt(queryString.page, 10); + } + }); + return links; + } +} diff --git a/src/main/webapp/app/entities/entity-navbar-items.ts b/src/main/webapp/app/entities/entity-navbar-items.ts new file mode 100644 index 00000000..9f96a68b --- /dev/null +++ b/src/main/webapp/app/entities/entity-navbar-items.ts @@ -0,0 +1,3 @@ +import NavbarItem from 'app/layouts/navbar/navbar-item.model'; + +export const EntityNavbarItems: NavbarItem[] = []; diff --git a/src/main/webapp/app/entities/entity-routing.module.ts b/src/main/webapp/app/entities/entity-routing.module.ts new file mode 100644 index 00000000..fe1354dd --- /dev/null +++ b/src/main/webapp/app/entities/entity-routing.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + /* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */ + ]), + ], +}) +export class EntityRoutingModule {} diff --git a/src/main/webapp/app/entities/user/user.model.ts b/src/main/webapp/app/entities/user/user.model.ts new file mode 100644 index 00000000..74137a9b --- /dev/null +++ b/src/main/webapp/app/entities/user/user.model.ts @@ -0,0 +1,15 @@ +export interface IUser { + id: number; + login?: string; +} + +export class User implements IUser { + constructor( + public id: number, + public login: string, + ) {} +} + +export function getUserIdentifier(user: IUser): number { + return user.id; +} diff --git a/src/main/webapp/app/entities/user/user.service.spec.ts b/src/main/webapp/app/entities/user/user.service.spec.ts new file mode 100644 index 00000000..3d82e08e --- /dev/null +++ b/src/main/webapp/app/entities/user/user.service.spec.ts @@ -0,0 +1,109 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpErrorResponse } from '@angular/common/http'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; + +import { User, IUser } from './user.model'; + +import { UserService } from './user.service'; + +describe('User Service', () => { + let service: UserService; + let httpMock: HttpTestingController; + let expectedResult: IUser | IUser[] | boolean | number | null; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + }); + expectedResult = null; + service = TestBed.inject(UserService); + httpMock = TestBed.inject(HttpTestingController); + }); + + afterEach(() => { + httpMock.verify(); + }); + + describe('Service methods', () => { + it('should return Users', () => { + service.query().subscribe(received => { + expectedResult = received.body; + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush([new User(123, 'user')]); + expect(expectedResult).toEqual([{ id: 123, login: 'user' }]); + }); + + it('should propagate not found response', () => { + service.query().subscribe({ + error: (error: HttpErrorResponse) => (expectedResult = error.status), + }); + + const req = httpMock.expectOne({ method: 'GET' }); + req.flush('Internal Server Error', { + status: 500, + statusText: 'Internal Server Error', + }); + expect(expectedResult).toEqual(500); + }); + + describe('addUserToCollectionIfMissing', () => { + it('should add a User to an empty array', () => { + const user: IUser = { id: 123 }; + expectedResult = service.addUserToCollectionIfMissing([], user); + expect(expectedResult).toHaveLength(1); + expect(expectedResult).toContain(user); + }); + + it('should not add a User to an array that contains it', () => { + const user: IUser = { id: 123 }; + const userCollection: IUser[] = [ + { + ...user, + }, + { id: 456 }, + ]; + expectedResult = service.addUserToCollectionIfMissing(userCollection, user); + expect(expectedResult).toHaveLength(2); + }); + + it("should add a User to an array that doesn't contain it", () => { + const user: IUser = { id: 123 }; + const userCollection: IUser[] = [{ id: 456 }]; + expectedResult = service.addUserToCollectionIfMissing(userCollection, user); + expect(expectedResult).toHaveLength(2); + expect(expectedResult).toContain(user); + }); + + it('should add only unique User to an array', () => { + const userArray: IUser[] = [{ id: 123 }, { id: 456 }, { id: 24622 }]; + const userCollection: IUser[] = [{ id: 456 }]; + expectedResult = service.addUserToCollectionIfMissing(userCollection, ...userArray); + expect(expectedResult).toHaveLength(3); + }); + + it('should accept varargs', () => { + const user: IUser = { id: 123 }; + const user2: IUser = { id: 456 }; + expectedResult = service.addUserToCollectionIfMissing([], user, user2); + expect(expectedResult).toHaveLength(2); + expect(expectedResult).toContain(user); + expect(expectedResult).toContain(user2); + }); + + it('should accept null and undefined values', () => { + const user: IUser = { id: 123 }; + expectedResult = service.addUserToCollectionIfMissing([], null, user, undefined); + expect(expectedResult).toHaveLength(1); + expect(expectedResult).toContain(user); + }); + + it('should return initial array if no users is added', () => { + const userCollection: IUser[] = [{ id: 456 }]; + expectedResult = service.addUserToCollectionIfMissing(userCollection, null, undefined); + expect(expectedResult).toEqual(userCollection); + }); + }); + }); +}); diff --git a/src/main/webapp/app/entities/user/user.service.ts b/src/main/webapp/app/entities/user/user.service.ts new file mode 100644 index 00000000..02f2c659 --- /dev/null +++ b/src/main/webapp/app/entities/user/user.service.ts @@ -0,0 +1,48 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { createRequestOption } from 'app/core/request/request-util'; +import { isPresent } from 'app/core/util/operators'; +import { Pagination } from 'app/core/request/request.model'; +import { IUser, getUserIdentifier } from './user.model'; + +@Injectable({ providedIn: 'root' }) +export class UserService { + private resourceUrl = this.applicationConfigService.getEndpointFor('api/users'); + + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + query(req?: Pagination): Observable> { + const options = createRequestOption(req); + return this.http.get(this.resourceUrl, { params: options, observe: 'response' }); + } + + compareUser(o1: Pick | null, o2: Pick | null): boolean { + return o1 && o2 ? o1.id === o2.id : o1 === o2; + } + + addUserToCollectionIfMissing & Pick>( + userCollection: Type[], + ...usersToCheck: (Type | null | undefined)[] + ): IUser[] { + const users: Type[] = usersToCheck.filter(isPresent); + if (users.length > 0) { + const userCollectionIdentifiers = userCollection.map(userItem => getUserIdentifier(userItem)!); + const usersToAdd = users.filter(userItem => { + const userIdentifier = getUserIdentifier(userItem); + if (userCollectionIdentifiers.includes(userIdentifier)) { + return false; + } + userCollectionIdentifiers.push(userIdentifier); + return true; + }); + return [...usersToAdd, ...userCollection]; + } + return userCollection; + } +} diff --git a/src/main/webapp/app/home/home.component.html b/src/main/webapp/app/home/home.component.html new file mode 100644 index 00000000..799849a7 --- /dev/null +++ b/src/main/webapp/app/home/home.component.html @@ -0,0 +1,54 @@ +
+
+ +
+ +
+

Welcome, Java Hipster! (Artemis Benchmarking)

+ +

This is your homepage

+ +
+
+ You are logged in as user "{{ account.login }}". +
+ +
+ If you want to + sign in, you can try the default accounts:
- Administrator (login="admin" and password="admin")
- User (login="user" and + password="user").
+
+ +
+ You don't have an account yet?  + Register a new account +
+
+ +

If you have any question on JHipster:

+ + + +

+ If you like JHipster, don't forget to give us a star on + GitHub! +

+
+
diff --git a/src/main/webapp/app/home/home.component.scss b/src/main/webapp/app/home/home.component.scss new file mode 100644 index 00000000..e61f621f --- /dev/null +++ b/src/main/webapp/app/home/home.component.scss @@ -0,0 +1,23 @@ +/* ========================================================================== +Main page styles +========================================================================== */ + +.hipster { + display: inline-block; + width: 347px; + height: 497px; + background: url('../../content/images/jhipster_family_member_3.svg') no-repeat center top; + background-size: contain; +} + +/* wait autoprefixer update to allow simple generation of high pixel density media query */ +@media only screen and (-webkit-min-device-pixel-ratio: 2), + only screen and (-moz-min-device-pixel-ratio: 2), + only screen and (-o-min-device-pixel-ratio: 2/1), + only screen and (min-resolution: 192dpi), + only screen and (min-resolution: 2dppx) { + .hipster { + background: url('../../content/images/jhipster_family_member_3.svg') no-repeat center top; + background-size: contain; + } +} diff --git a/src/main/webapp/app/home/home.component.spec.ts b/src/main/webapp/app/home/home.component.spec.ts new file mode 100644 index 00000000..c5122231 --- /dev/null +++ b/src/main/webapp/app/home/home.component.spec.ts @@ -0,0 +1,111 @@ +jest.mock('app/core/auth/account.service'); + +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { Router } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; +import { of, Subject } from 'rxjs'; + +import { AccountService } from 'app/core/auth/account.service'; +import { Account } from 'app/core/auth/account.model'; + +import HomeComponent from './home.component'; + +describe('Home Component', () => { + let comp: HomeComponent; + let fixture: ComponentFixture; + let mockAccountService: AccountService; + let mockRouter: Router; + const account: Account = { + activated: true, + authorities: [], + email: '', + firstName: null, + langKey: '', + lastName: null, + login: 'login', + imageUrl: null, + }; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HomeComponent, RouterTestingModule.withRoutes([])], + providers: [AccountService], + }) + .overrideTemplate(HomeComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(HomeComponent); + comp = fixture.componentInstance; + mockAccountService = TestBed.inject(AccountService); + mockAccountService.identity = jest.fn(() => of(null)); + mockAccountService.getAuthenticationState = jest.fn(() => of(null)); + + mockRouter = TestBed.inject(Router); + jest.spyOn(mockRouter, 'navigate').mockImplementation(() => Promise.resolve(true)); + }); + + describe('ngOnInit', () => { + it('Should synchronize account variable with current account', () => { + // GIVEN + const authenticationState = new Subject(); + mockAccountService.getAuthenticationState = jest.fn(() => authenticationState.asObservable()); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.account).toBeNull(); + + // WHEN + authenticationState.next(account); + + // THEN + expect(comp.account).toEqual(account); + + // WHEN + authenticationState.next(null); + + // THEN + expect(comp.account).toBeNull(); + }); + }); + + describe('login', () => { + it('Should navigate to /login on login', () => { + // WHEN + comp.login(); + + // THEN + expect(mockRouter.navigate).toHaveBeenCalledWith(['/login']); + }); + }); + + describe('ngOnDestroy', () => { + it('Should destroy authentication state subscription on component destroy', () => { + // GIVEN + const authenticationState = new Subject(); + mockAccountService.getAuthenticationState = jest.fn(() => authenticationState.asObservable()); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.account).toBeNull(); + + // WHEN + authenticationState.next(account); + + // THEN + expect(comp.account).toEqual(account); + + // WHEN + comp.ngOnDestroy(); + authenticationState.next(null); + + // THEN + expect(comp.account).toEqual(account); + }); + }); +}); diff --git a/src/main/webapp/app/home/home.component.ts b/src/main/webapp/app/home/home.component.ts new file mode 100644 index 00000000..99c64b22 --- /dev/null +++ b/src/main/webapp/app/home/home.component.ts @@ -0,0 +1,42 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Router, RouterModule } from '@angular/router'; +import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; + +import SharedModule from 'app/shared/shared.module'; +import { AccountService } from 'app/core/auth/account.service'; +import { Account } from 'app/core/auth/account.model'; + +@Component({ + standalone: true, + selector: 'jhi-home', + templateUrl: './home.component.html', + styleUrls: ['./home.component.scss'], + imports: [SharedModule, RouterModule], +}) +export default class HomeComponent implements OnInit, OnDestroy { + account: Account | null = null; + + private readonly destroy$ = new Subject(); + + constructor( + private accountService: AccountService, + private router: Router, + ) {} + + ngOnInit(): void { + this.accountService + .getAuthenticationState() + .pipe(takeUntil(this.destroy$)) + .subscribe(account => (this.account = account)); + } + + login(): void { + this.router.navigate(['/login']); + } + + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); + } +} diff --git a/src/main/webapp/app/layouts/error/error.component.html b/src/main/webapp/app/layouts/error/error.component.html new file mode 100644 index 00000000..b5356cdc --- /dev/null +++ b/src/main/webapp/app/layouts/error/error.component.html @@ -0,0 +1,15 @@ +
+
+
+ +
+ +
+

Error page!

+ +
+
{{ errorMessage }}
+
+
+
+
diff --git a/src/main/webapp/app/layouts/error/error.component.ts b/src/main/webapp/app/layouts/error/error.component.ts new file mode 100644 index 00000000..802a4585 --- /dev/null +++ b/src/main/webapp/app/layouts/error/error.component.ts @@ -0,0 +1,23 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import SharedModule from 'app/shared/shared.module'; + +@Component({ + standalone: true, + selector: 'jhi-error', + templateUrl: './error.component.html', + imports: [SharedModule], +}) +export default class ErrorComponent implements OnInit { + errorMessage?: string; + + constructor(private route: ActivatedRoute) {} + + ngOnInit(): void { + this.route.data.subscribe(routeData => { + if (routeData.errorMessage) { + this.errorMessage = routeData.errorMessage; + } + }); + } +} diff --git a/src/main/webapp/app/layouts/error/error.route.ts b/src/main/webapp/app/layouts/error/error.route.ts new file mode 100644 index 00000000..fff1cd25 --- /dev/null +++ b/src/main/webapp/app/layouts/error/error.route.ts @@ -0,0 +1,31 @@ +import { Routes } from '@angular/router'; + +import ErrorComponent from './error.component'; + +export const errorRoute: Routes = [ + { + path: 'error', + component: ErrorComponent, + title: 'Error page!', + }, + { + path: 'accessdenied', + component: ErrorComponent, + data: { + errorMessage: 'You are not authorized to access this page.', + }, + title: 'Error page!', + }, + { + path: '404', + component: ErrorComponent, + data: { + errorMessage: 'The page does not exist.', + }, + title: 'Error page!', + }, + { + path: '**', + redirectTo: '/404', + }, +]; diff --git a/src/main/webapp/app/layouts/footer/footer.component.html b/src/main/webapp/app/layouts/footer/footer.component.html new file mode 100644 index 00000000..47a5100a --- /dev/null +++ b/src/main/webapp/app/layouts/footer/footer.component.html @@ -0,0 +1,3 @@ + diff --git a/src/main/webapp/app/layouts/footer/footer.component.ts b/src/main/webapp/app/layouts/footer/footer.component.ts new file mode 100644 index 00000000..7ab09384 --- /dev/null +++ b/src/main/webapp/app/layouts/footer/footer.component.ts @@ -0,0 +1,8 @@ +import { Component } from '@angular/core'; + +@Component({ + standalone: true, + selector: 'jhi-footer', + templateUrl: './footer.component.html', +}) +export default class FooterComponent {} diff --git a/src/main/webapp/app/layouts/main/main.component.html b/src/main/webapp/app/layouts/main/main.component.html new file mode 100644 index 00000000..3ac9be94 --- /dev/null +++ b/src/main/webapp/app/layouts/main/main.component.html @@ -0,0 +1,13 @@ + + +
+ +
+ +
+
+ +
+ + +
diff --git a/src/main/webapp/app/layouts/main/main.component.spec.ts b/src/main/webapp/app/layouts/main/main.component.spec.ts new file mode 100644 index 00000000..2d7883b2 --- /dev/null +++ b/src/main/webapp/app/layouts/main/main.component.spec.ts @@ -0,0 +1,117 @@ +jest.mock('app/core/auth/account.service'); + +import { waitForAsync, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; +import { Router, TitleStrategy } from '@angular/router'; +import { Title } from '@angular/platform-browser'; +import { DOCUMENT } from '@angular/common'; +import { Component } from '@angular/core'; +import { of } from 'rxjs'; + +import { AccountService } from 'app/core/auth/account.service'; + +import { AppPageTitleStrategy } from 'app/app-page-title-strategy'; +import MainComponent from './main.component'; + +describe('MainComponent', () => { + let comp: MainComponent; + let fixture: ComponentFixture; + let titleService: Title; + let mockAccountService: AccountService; + const routerState: any = { snapshot: { root: { data: {} } } }; + let router: Router; + let document: Document; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [MainComponent], + providers: [Title, AccountService, { provide: TitleStrategy, useClass: AppPageTitleStrategy }], + }) + .overrideTemplate(MainComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MainComponent); + comp = fixture.componentInstance; + titleService = TestBed.inject(Title); + mockAccountService = TestBed.inject(AccountService); + mockAccountService.identity = jest.fn(() => of(null)); + mockAccountService.getAuthenticationState = jest.fn(() => of(null)); + router = TestBed.inject(Router); + document = TestBed.inject(DOCUMENT); + }); + + describe('page title', () => { + const defaultPageTitle = 'Artemis Benchmarking'; + const parentRoutePageTitle = 'parentTitle'; + const childRoutePageTitle = 'childTitle'; + + beforeEach(() => { + routerState.snapshot.root = { data: {} }; + jest.spyOn(titleService, 'setTitle'); + comp.ngOnInit(); + }); + + describe('navigation end', () => { + it('should set page title to default title if pageTitle is missing on routes', fakeAsync(() => { + // WHEN + router.navigateByUrl(''); + tick(); + + // THEN + expect(document.title).toBe(defaultPageTitle); + })); + + it('should set page title to root route pageTitle if there is no child routes', fakeAsync(() => { + // GIVEN + router.resetConfig([{ path: '', title: parentRoutePageTitle, component: BlankComponent }]); + + // WHEN + router.navigateByUrl(''); + tick(); + + // THEN + expect(document.title).toBe(parentRoutePageTitle); + })); + + it('should set page title to child route pageTitle if child routes exist and pageTitle is set for child route', fakeAsync(() => { + // GIVEN + router.resetConfig([ + { + path: 'home', + title: parentRoutePageTitle, + children: [{ path: '', title: childRoutePageTitle, component: BlankComponent }], + }, + ]); + + // WHEN + router.navigateByUrl('home'); + tick(); + + // THEN + expect(document.title).toBe(childRoutePageTitle); + })); + + it('should set page title to parent route pageTitle if child routes exists but pageTitle is not set for child route data', fakeAsync(() => { + // GIVEN + router.resetConfig([ + { + path: 'home', + title: parentRoutePageTitle, + children: [{ path: '', component: BlankComponent }], + }, + ]); + + // WHEN + router.navigateByUrl('home'); + tick(); + + // THEN + expect(document.title).toBe(parentRoutePageTitle); + })); + }); + }); +}); + +@Component({ template: '' }) +export class BlankComponent {} diff --git a/src/main/webapp/app/layouts/main/main.component.ts b/src/main/webapp/app/layouts/main/main.component.ts new file mode 100644 index 00000000..89a52354 --- /dev/null +++ b/src/main/webapp/app/layouts/main/main.component.ts @@ -0,0 +1,23 @@ +import { Component, OnInit } from '@angular/core'; + +import { AccountService } from 'app/core/auth/account.service'; +import { AppPageTitleStrategy } from 'app/app-page-title-strategy'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'jhi-main', + templateUrl: './main.component.html', + providers: [AppPageTitleStrategy], +}) +export default class MainComponent implements OnInit { + constructor( + private router: Router, + private appPageTitleStrategy: AppPageTitleStrategy, + private accountService: AccountService, + ) {} + + ngOnInit(): void { + // try to log in automatically + this.accountService.identity().subscribe(); + } +} diff --git a/src/main/webapp/app/layouts/main/main.module.ts b/src/main/webapp/app/layouts/main/main.module.ts new file mode 100644 index 00000000..f0335493 --- /dev/null +++ b/src/main/webapp/app/layouts/main/main.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import SharedModule from 'app/shared/shared.module'; +import FooterComponent from '../footer/footer.component'; +import PageRibbonComponent from '../profiles/page-ribbon.component'; +import MainComponent from './main.component'; + +@NgModule({ + imports: [SharedModule, RouterModule, FooterComponent, PageRibbonComponent], + declarations: [MainComponent], +}) +export default class MainModule {} diff --git a/src/main/webapp/app/layouts/navbar/navbar-item.model.d.ts b/src/main/webapp/app/layouts/navbar/navbar-item.model.d.ts new file mode 100644 index 00000000..0c4b4932 --- /dev/null +++ b/src/main/webapp/app/layouts/navbar/navbar-item.model.d.ts @@ -0,0 +1,6 @@ +type NavbarItem = { + name: string; + route: string; +}; + +export default NavbarItem; diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.html b/src/main/webapp/app/layouts/navbar/navbar.component.html new file mode 100644 index 00000000..bf198095 --- /dev/null +++ b/src/main/webapp/app/layouts/navbar/navbar.component.html @@ -0,0 +1,179 @@ + diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.scss b/src/main/webapp/app/layouts/navbar/navbar.component.scss new file mode 100644 index 00000000..4c038a26 --- /dev/null +++ b/src/main/webapp/app/layouts/navbar/navbar.component.scss @@ -0,0 +1,36 @@ +@import 'bootstrap/scss/functions'; +@import 'bootstrap/scss/variables'; + +/* ========================================================================== +Navbar +========================================================================== */ + +.navbar-version { + font-size: 0.65em; + color: $navbar-dark-color; +} + +.profile-image { + height: 1.75em; + width: 1.75em; +} + +.navbar { + padding: 0.2rem 1rem; + + a.nav-link { + font-weight: 400; + } +} + +/* ========================================================================== +Logo styles +========================================================================== */ +.logo-img { + height: 45px; + width: 45px; + display: inline-block; + vertical-align: middle; + background: url('/content/images/logo-jhipster.png') no-repeat center center; + background-size: contain; +} diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.spec.ts b/src/main/webapp/app/layouts/navbar/navbar.component.spec.ts new file mode 100644 index 00000000..e3f84b50 --- /dev/null +++ b/src/main/webapp/app/layouts/navbar/navbar.component.spec.ts @@ -0,0 +1,95 @@ +jest.mock('app/login/login.service'); + +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { RouterTestingModule } from '@angular/router/testing'; +import { of } from 'rxjs'; + +import { ProfileInfo } from 'app/layouts/profiles/profile-info.model'; +import { Account } from 'app/core/auth/account.model'; +import { AccountService } from 'app/core/auth/account.service'; +import { ProfileService } from 'app/layouts/profiles/profile.service'; +import { LoginService } from 'app/login/login.service'; + +import NavbarComponent from './navbar.component'; + +describe('Navbar Component', () => { + let comp: NavbarComponent; + let fixture: ComponentFixture; + let accountService: AccountService; + let profileService: ProfileService; + const account: Account = { + activated: true, + authorities: [], + email: '', + firstName: 'John', + langKey: '', + lastName: 'Doe', + login: 'john.doe', + imageUrl: '', + }; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [NavbarComponent, HttpClientTestingModule, RouterTestingModule.withRoutes([])], + providers: [LoginService], + }) + .overrideTemplate(NavbarComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NavbarComponent); + comp = fixture.componentInstance; + accountService = TestBed.inject(AccountService); + profileService = TestBed.inject(ProfileService); + }); + + it('Should call profileService.getProfileInfo on init', () => { + // GIVEN + jest.spyOn(profileService, 'getProfileInfo').mockReturnValue(of(new ProfileInfo())); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(profileService.getProfileInfo).toHaveBeenCalled(); + }); + + it('Should hold current authenticated user in variable account', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.account).toBeNull(); + + // WHEN + accountService.authenticate(account); + + // THEN + expect(comp.account).toEqual(account); + + // WHEN + accountService.authenticate(null); + + // THEN + expect(comp.account).toBeNull(); + }); + + it('Should hold current authenticated user in variable account if user is authenticated before page load', () => { + // GIVEN + accountService.authenticate(account); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.account).toEqual(account); + + // WHEN + accountService.authenticate(null); + + // THEN + expect(comp.account).toBeNull(); + }); +}); diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.ts b/src/main/webapp/app/layouts/navbar/navbar.component.ts new file mode 100644 index 00000000..5826e1ca --- /dev/null +++ b/src/main/webapp/app/layouts/navbar/navbar.component.ts @@ -0,0 +1,69 @@ +import { Component, OnInit } from '@angular/core'; +import { Router, RouterModule } from '@angular/router'; + +import SharedModule from 'app/shared/shared.module'; +import HasAnyAuthorityDirective from 'app/shared/auth/has-any-authority.directive'; +import { VERSION } from 'app/app.constants'; +import { Account } from 'app/core/auth/account.model'; +import { AccountService } from 'app/core/auth/account.service'; +import { LoginService } from 'app/login/login.service'; +import { ProfileService } from 'app/layouts/profiles/profile.service'; +import { EntityNavbarItems } from 'app/entities/entity-navbar-items'; +import NavbarItem from './navbar-item.model'; + +@Component({ + standalone: true, + selector: 'jhi-navbar', + templateUrl: './navbar.component.html', + styleUrls: ['./navbar.component.scss'], + imports: [RouterModule, SharedModule, HasAnyAuthorityDirective], +}) +export default class NavbarComponent implements OnInit { + inProduction?: boolean; + isNavbarCollapsed = true; + openAPIEnabled?: boolean; + version = ''; + account: Account | null = null; + entitiesNavbarItems: NavbarItem[] = []; + + constructor( + private loginService: LoginService, + private accountService: AccountService, + private profileService: ProfileService, + private router: Router, + ) { + if (VERSION) { + this.version = VERSION.toLowerCase().startsWith('v') ? VERSION : `v${VERSION}`; + } + } + + ngOnInit(): void { + this.entitiesNavbarItems = EntityNavbarItems; + this.profileService.getProfileInfo().subscribe(profileInfo => { + this.inProduction = profileInfo.inProduction; + this.openAPIEnabled = profileInfo.openAPIEnabled; + }); + + this.accountService.getAuthenticationState().subscribe(account => { + this.account = account; + }); + } + + collapseNavbar(): void { + this.isNavbarCollapsed = true; + } + + login(): void { + this.router.navigate(['/login']); + } + + logout(): void { + this.collapseNavbar(); + this.loginService.logout(); + this.router.navigate(['']); + } + + toggleNavbar(): void { + this.isNavbarCollapsed = !this.isNavbarCollapsed; + } +} diff --git a/src/main/webapp/app/layouts/profiles/page-ribbon.component.scss b/src/main/webapp/app/layouts/profiles/page-ribbon.component.scss new file mode 100644 index 00000000..88b06022 --- /dev/null +++ b/src/main/webapp/app/layouts/profiles/page-ribbon.component.scss @@ -0,0 +1,25 @@ +/* ========================================================================== +Developement Ribbon +========================================================================== */ +.ribbon { + background-color: rgba(170, 0, 0, 0.5); + overflow: hidden; + position: absolute; + top: 40px; + white-space: nowrap; + width: 15em; + z-index: 9999; + pointer-events: none; + opacity: 0.75; + a { + color: #fff; + display: block; + font-weight: 400; + margin: 1px 0; + padding: 10px 50px; + text-align: center; + text-decoration: none; + text-shadow: 0 0 5px #444; + pointer-events: none; + } +} diff --git a/src/main/webapp/app/layouts/profiles/page-ribbon.component.spec.ts b/src/main/webapp/app/layouts/profiles/page-ribbon.component.spec.ts new file mode 100644 index 00000000..4d5176cd --- /dev/null +++ b/src/main/webapp/app/layouts/profiles/page-ribbon.component.spec.ts @@ -0,0 +1,39 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { of } from 'rxjs'; + +import { ProfileInfo } from 'app/layouts/profiles/profile-info.model'; +import { ProfileService } from 'app/layouts/profiles/profile.service'; + +import PageRibbonComponent from './page-ribbon.component'; + +describe('Page Ribbon Component', () => { + let comp: PageRibbonComponent; + let fixture: ComponentFixture; + let profileService: ProfileService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule, PageRibbonComponent], + }) + .overrideTemplate(PageRibbonComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PageRibbonComponent); + comp = fixture.componentInstance; + profileService = TestBed.inject(ProfileService); + }); + + it('Should call profileService.getProfileInfo on init', () => { + // GIVEN + jest.spyOn(profileService, 'getProfileInfo').mockReturnValue(of(new ProfileInfo())); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(profileService.getProfileInfo).toHaveBeenCalled(); + }); +}); diff --git a/src/main/webapp/app/layouts/profiles/page-ribbon.component.ts b/src/main/webapp/app/layouts/profiles/page-ribbon.component.ts new file mode 100644 index 00000000..c8a00d3a --- /dev/null +++ b/src/main/webapp/app/layouts/profiles/page-ribbon.component.ts @@ -0,0 +1,27 @@ +import { Component, OnInit } from '@angular/core'; +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +import SharedModule from 'app/shared/shared.module'; +import { ProfileService } from './profile.service'; + +@Component({ + standalone: true, + selector: 'jhi-page-ribbon', + template: ` + + `, + styleUrls: ['./page-ribbon.component.scss'], + imports: [SharedModule], +}) +export default class PageRibbonComponent implements OnInit { + ribbonEnv$?: Observable; + + constructor(private profileService: ProfileService) {} + + ngOnInit(): void { + this.ribbonEnv$ = this.profileService.getProfileInfo().pipe(map(profileInfo => profileInfo.ribbonEnv)); + } +} diff --git a/src/main/webapp/app/layouts/profiles/profile-info.model.ts b/src/main/webapp/app/layouts/profiles/profile-info.model.ts new file mode 100644 index 00000000..14e920f1 --- /dev/null +++ b/src/main/webapp/app/layouts/profiles/profile-info.model.ts @@ -0,0 +1,15 @@ +export interface InfoResponse { + 'display-ribbon-on-profiles'?: string; + git?: any; + build?: any; + activeProfiles?: string[]; +} + +export class ProfileInfo { + constructor( + public activeProfiles?: string[], + public ribbonEnv?: string, + public inProduction?: boolean, + public openAPIEnabled?: boolean, + ) {} +} diff --git a/src/main/webapp/app/layouts/profiles/profile.service.ts b/src/main/webapp/app/layouts/profiles/profile.service.ts new file mode 100644 index 00000000..ec11dd34 --- /dev/null +++ b/src/main/webapp/app/layouts/profiles/profile.service.ts @@ -0,0 +1,44 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { map, shareReplay } from 'rxjs/operators'; +import { Observable } from 'rxjs'; + +import { ApplicationConfigService } from 'app/core/config/application-config.service'; +import { ProfileInfo, InfoResponse } from './profile-info.model'; + +@Injectable({ providedIn: 'root' }) +export class ProfileService { + private infoUrl = this.applicationConfigService.getEndpointFor('management/info'); + private profileInfo$?: Observable; + + constructor( + private http: HttpClient, + private applicationConfigService: ApplicationConfigService, + ) {} + + getProfileInfo(): Observable { + if (this.profileInfo$) { + return this.profileInfo$; + } + + this.profileInfo$ = this.http.get(this.infoUrl).pipe( + map((response: InfoResponse) => { + const profileInfo: ProfileInfo = { + activeProfiles: response.activeProfiles, + inProduction: response.activeProfiles?.includes('prod'), + openAPIEnabled: response.activeProfiles?.includes('api-docs'), + }; + if (response.activeProfiles && response['display-ribbon-on-profiles']) { + const displayRibbonOnProfiles = response['display-ribbon-on-profiles'].split(','); + const ribbonProfiles = displayRibbonOnProfiles.filter(profile => response.activeProfiles?.includes(profile)); + if (ribbonProfiles.length > 0) { + profileInfo.ribbonEnv = ribbonProfiles[0]; + } + } + return profileInfo; + }), + shareReplay(), + ); + return this.profileInfo$; + } +} diff --git a/src/main/webapp/app/login/login.component.html b/src/main/webapp/app/login/login.component.html new file mode 100644 index 00000000..91df3857 --- /dev/null +++ b/src/main/webapp/app/login/login.component.html @@ -0,0 +1,55 @@ +
+
+
+

Sign in

+
+ Failed to sign in! Please check your credentials and try again. +
+
+
+ + +
+ +
+ + +
+ +
+ +
+ + +
+ + +
+ You don't have an account yet? + Register a new account +
+
+
+
diff --git a/src/main/webapp/app/login/login.component.spec.ts b/src/main/webapp/app/login/login.component.spec.ts new file mode 100644 index 00000000..da3b79c5 --- /dev/null +++ b/src/main/webapp/app/login/login.component.spec.ts @@ -0,0 +1,152 @@ +jest.mock('app/core/auth/account.service'); +jest.mock('app/login/login.service'); + +import { ElementRef } from '@angular/core'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { FormBuilder } from '@angular/forms'; +import { Router, Navigation } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; +import { of, throwError } from 'rxjs'; + +import { AccountService } from 'app/core/auth/account.service'; + +import { LoginService } from './login.service'; +import LoginComponent from './login.component'; + +describe('LoginComponent', () => { + let comp: LoginComponent; + let fixture: ComponentFixture; + let mockRouter: Router; + let mockAccountService: AccountService; + let mockLoginService: LoginService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [RouterTestingModule.withRoutes([]), LoginComponent], + providers: [ + FormBuilder, + AccountService, + { + provide: LoginService, + useValue: { + login: jest.fn(() => of({})), + }, + }, + ], + }) + .overrideTemplate(LoginComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(LoginComponent); + comp = fixture.componentInstance; + mockRouter = TestBed.inject(Router); + jest.spyOn(mockRouter, 'navigate').mockImplementation(() => Promise.resolve(true)); + mockLoginService = TestBed.inject(LoginService); + mockAccountService = TestBed.inject(AccountService); + }); + + describe('ngOnInit', () => { + it('Should call accountService.identity on Init', () => { + // GIVEN + mockAccountService.identity = jest.fn(() => of(null)); + mockAccountService.getAuthenticationState = jest.fn(() => of(null)); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(mockAccountService.identity).toHaveBeenCalled(); + }); + + it('Should call accountService.isAuthenticated on Init', () => { + // GIVEN + mockAccountService.identity = jest.fn(() => of(null)); + + // WHEN + comp.ngOnInit(); + + // THEN + expect(mockAccountService.isAuthenticated).toHaveBeenCalled(); + }); + + it('should navigate to home page on Init if authenticated=true', () => { + // GIVEN + mockAccountService.identity = jest.fn(() => of(null)); + mockAccountService.getAuthenticationState = jest.fn(() => of(null)); + mockAccountService.isAuthenticated = () => true; + + // WHEN + comp.ngOnInit(); + + // THEN + expect(mockRouter.navigate).toHaveBeenCalledWith(['']); + }); + }); + + describe('ngAfterViewInit', () => { + it('should set focus to username input after the view has been initialized', () => { + // GIVEN + const node = { + focus: jest.fn(), + }; + comp.username = new ElementRef(node); + + // WHEN + comp.ngAfterViewInit(); + + // THEN + expect(node.focus).toHaveBeenCalled(); + }); + }); + + describe('login', () => { + it('should authenticate the user and navigate to home page', () => { + // GIVEN + const credentials = { + username: 'admin', + password: 'admin', + rememberMe: true, + }; + + comp.loginForm.patchValue({ + username: 'admin', + password: 'admin', + rememberMe: true, + }); + + // WHEN + comp.login(); + + // THEN + expect(comp.authenticationError).toEqual(false); + expect(mockLoginService.login).toHaveBeenCalledWith(credentials); + expect(mockRouter.navigate).toHaveBeenCalledWith(['']); + }); + + it('should authenticate the user but not navigate to home page if authentication process is already routing to cached url from localstorage', () => { + // GIVEN + jest.spyOn(mockRouter, 'getCurrentNavigation').mockReturnValue({} as Navigation); + + // WHEN + comp.login(); + + // THEN + expect(comp.authenticationError).toEqual(false); + expect(mockRouter.navigate).not.toHaveBeenCalled(); + }); + + it('should stay on login form and show error message on login error', () => { + // GIVEN + mockLoginService.login = jest.fn(() => throwError({})); + + // WHEN + comp.login(); + + // THEN + expect(comp.authenticationError).toEqual(true); + expect(mockRouter.navigate).not.toHaveBeenCalled(); + }); + }); +}); diff --git a/src/main/webapp/app/login/login.component.ts b/src/main/webapp/app/login/login.component.ts new file mode 100644 index 00000000..73b19a96 --- /dev/null +++ b/src/main/webapp/app/login/login.component.ts @@ -0,0 +1,58 @@ +import { Component, ViewChild, OnInit, AfterViewInit, ElementRef } from '@angular/core'; +import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { Router, RouterModule } from '@angular/router'; + +import SharedModule from 'app/shared/shared.module'; +import { LoginService } from 'app/login/login.service'; +import { AccountService } from 'app/core/auth/account.service'; + +@Component({ + selector: 'jhi-login', + standalone: true, + imports: [SharedModule, FormsModule, ReactiveFormsModule, RouterModule], + templateUrl: './login.component.html', +}) +export default class LoginComponent implements OnInit, AfterViewInit { + @ViewChild('username', { static: false }) + username!: ElementRef; + + authenticationError = false; + + loginForm = new FormGroup({ + username: new FormControl('', { nonNullable: true, validators: [Validators.required] }), + password: new FormControl('', { nonNullable: true, validators: [Validators.required] }), + rememberMe: new FormControl(false, { nonNullable: true, validators: [Validators.required] }), + }); + + constructor( + private accountService: AccountService, + private loginService: LoginService, + private router: Router, + ) {} + + ngOnInit(): void { + // if already authenticated then navigate to home page + this.accountService.identity().subscribe(() => { + if (this.accountService.isAuthenticated()) { + this.router.navigate(['']); + } + }); + } + + ngAfterViewInit(): void { + this.username.nativeElement.focus(); + } + + login(): void { + this.loginService.login(this.loginForm.getRawValue()).subscribe({ + next: () => { + this.authenticationError = false; + if (!this.router.getCurrentNavigation()) { + // There were no routing during login (eg from navigationToStoredUrl) + this.router.navigate(['']); + } + }, + error: () => (this.authenticationError = true), + }); + } +} diff --git a/src/main/webapp/app/login/login.model.ts b/src/main/webapp/app/login/login.model.ts new file mode 100644 index 00000000..10faab79 --- /dev/null +++ b/src/main/webapp/app/login/login.model.ts @@ -0,0 +1,7 @@ +export class Login { + constructor( + public username: string, + public password: string, + public rememberMe: boolean, + ) {} +} diff --git a/src/main/webapp/app/login/login.service.ts b/src/main/webapp/app/login/login.service.ts new file mode 100644 index 00000000..7b79a17b --- /dev/null +++ b/src/main/webapp/app/login/login.service.ts @@ -0,0 +1,24 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; +import { mergeMap } from 'rxjs/operators'; + +import { Account } from 'app/core/auth/account.model'; +import { AccountService } from 'app/core/auth/account.service'; +import { AuthServerProvider } from 'app/core/auth/auth-jwt.service'; +import { Login } from './login.model'; + +@Injectable({ providedIn: 'root' }) +export class LoginService { + constructor( + private accountService: AccountService, + private authServerProvider: AuthServerProvider, + ) {} + + login(credentials: Login): Observable { + return this.authServerProvider.login(credentials).pipe(mergeMap(() => this.accountService.identity(true))); + } + + logout(): void { + this.authServerProvider.logout().subscribe({ complete: () => this.accountService.authenticate(null) }); + } +} diff --git a/src/main/webapp/app/shared/alert/alert-error.component.html b/src/main/webapp/app/shared/alert/alert-error.component.html new file mode 100644 index 00000000..76ff881d --- /dev/null +++ b/src/main/webapp/app/shared/alert/alert-error.component.html @@ -0,0 +1,7 @@ + diff --git a/src/main/webapp/app/shared/alert/alert-error.component.spec.ts b/src/main/webapp/app/shared/alert/alert-error.component.spec.ts new file mode 100644 index 00000000..88286324 --- /dev/null +++ b/src/main/webapp/app/shared/alert/alert-error.component.spec.ts @@ -0,0 +1,158 @@ +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { HttpErrorResponse, HttpHeaders } from '@angular/common/http'; + +import { EventManager } from 'app/core/util/event-manager.service'; +import { Alert, AlertService } from 'app/core/util/alert.service'; + +import { AlertErrorComponent } from './alert-error.component'; + +describe('Alert Error Component', () => { + let comp: AlertErrorComponent; + let fixture: ComponentFixture; + let eventManager: EventManager; + let alertService: AlertService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [AlertErrorComponent], + providers: [EventManager, AlertService], + }) + .overrideTemplate(AlertErrorComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AlertErrorComponent); + comp = fixture.componentInstance; + eventManager = TestBed.inject(EventManager); + alertService = TestBed.inject(AlertService); + alertService.addAlert = (alert: Alert, alerts?: Alert[]) => { + if (alerts) { + alerts.push(alert); + } + return alert; + }; + }); + + describe('Error Handling', () => { + it('Should display an alert on status 0', () => { + // GIVEN + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: { status: 0 } }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].message).toBe('Server not reachable'); + }); + + it('Should display an alert on status 404', () => { + // GIVEN + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: { status: 404 } }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].message).toBe('Not found'); + }); + + it('Should display an alert on generic error', () => { + // GIVEN + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: { error: { message: 'Error Message' } } }); + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: { error: 'Second Error Message' } }); + // THEN + expect(comp.alerts.length).toBe(2); + expect(comp.alerts[0].message).toBe('Error Message'); + expect(comp.alerts[1].message).toBe('Second Error Message'); + }); + + it('Should display an alert on status 400 for generic error', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders(), + status: 400, + statusText: 'Bad Request', + error: { + type: 'https://www.jhipster.tech/problem/constraint-violation', + title: 'Bad Request', + status: 400, + path: '/api/foos', + message: 'error.validation', + }, + }); + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].message).toBe('error.validation'); + }); + + it('Should display an alert on status 400 for generic error without message', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders(), + status: 400, + error: 'Bad Request', + }); + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].message).toBe('Bad Request'); + }); + + it('Should display an alert on status 400 for invalid parameters', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders(), + status: 400, + statusText: 'Bad Request', + error: { + type: 'https://www.jhipster.tech/problem/constraint-violation', + title: 'Method argument not valid', + status: 400, + path: '/api/foos', + message: 'error.validation', + fieldErrors: [{ objectName: 'foo', field: 'minField', message: 'Min' }], + }, + }); + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].message).toBe('Error on field "MinField"'); + }); + + it('Should display an alert on status 400 for error headers', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders().append('app-error', 'Error Message').append('app-params', 'foo'), + status: 400, + statusText: 'Bad Request', + error: { + status: 400, + message: 'error.validation', + }, + }); + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].message).toBe('Error Message'); + }); + + it('Should display an alert on status 500 with detail', () => { + // GIVEN + const response = new HttpErrorResponse({ + url: 'http://localhost:8080/api/foos', + headers: new HttpHeaders(), + status: 500, + statusText: 'Internal server error', + error: { + status: 500, + message: 'error.http.500', + detail: 'Detailed error message', + }, + }); + eventManager.broadcast({ name: 'artemisBenchmarkingApp.httpError', content: response }); + // THEN + expect(comp.alerts.length).toBe(1); + expect(comp.alerts[0].message).toBe('Detailed error message'); + }); + }); +}); diff --git a/src/main/webapp/app/shared/alert/alert-error.component.ts b/src/main/webapp/app/shared/alert/alert-error.component.ts new file mode 100644 index 00000000..f1d04351 --- /dev/null +++ b/src/main/webapp/app/shared/alert/alert-error.component.ts @@ -0,0 +1,102 @@ +import { Component, OnDestroy } from '@angular/core'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Subscription } from 'rxjs'; +import { CommonModule } from '@angular/common'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; + +import { Alert, AlertService } from 'app/core/util/alert.service'; +import { EventManager, EventWithContent } from 'app/core/util/event-manager.service'; +import { AlertError } from './alert-error.model'; + +@Component({ + standalone: true, + selector: 'jhi-alert-error', + templateUrl: './alert-error.component.html', + imports: [CommonModule, NgbModule], +}) +export class AlertErrorComponent implements OnDestroy { + alerts: Alert[] = []; + errorListener: Subscription; + httpErrorListener: Subscription; + + constructor( + private alertService: AlertService, + private eventManager: EventManager, + ) { + this.errorListener = eventManager.subscribe('artemisBenchmarkingApp.error', (response: EventWithContent | string) => { + const errorResponse = (response as EventWithContent).content; + this.addErrorAlert(errorResponse.message); + }); + + this.httpErrorListener = eventManager.subscribe('artemisBenchmarkingApp.httpError', (response: EventWithContent | string) => { + const httpErrorResponse = (response as EventWithContent).content; + switch (httpErrorResponse.status) { + // connection refused, server not reachable + case 0: + this.addErrorAlert('Server not reachable'); + break; + + case 400: { + const arr = httpErrorResponse.headers.keys(); + let errorHeader: string | null = null; + for (const entry of arr) { + if (entry.toLowerCase().endsWith('app-error')) { + errorHeader = httpErrorResponse.headers.get(entry); + } + } + if (errorHeader) { + this.addErrorAlert(errorHeader); + } else if (httpErrorResponse.error !== '' && httpErrorResponse.error.fieldErrors) { + const fieldErrors = httpErrorResponse.error.fieldErrors; + for (const fieldError of fieldErrors) { + if (['Min', 'Max', 'DecimalMin', 'DecimalMax'].includes(fieldError.message)) { + fieldError.message = 'Size'; + } + // convert 'something[14].other[4].id' to 'something[].other[].id' so translations can be written to it + const convertedField: string = fieldError.field.replace(/\[\d*\]/g, '[]'); + const fieldName: string = convertedField.charAt(0).toUpperCase() + convertedField.slice(1); + this.addErrorAlert(`Error on field "${fieldName}"`); + } + } else if (httpErrorResponse.error !== '' && httpErrorResponse.error.message) { + this.addErrorAlert(httpErrorResponse.error.detail ?? httpErrorResponse.error.message); + } else { + this.addErrorAlert(httpErrorResponse.error); + } + break; + } + + case 404: + this.addErrorAlert('Not found'); + break; + + default: + if (httpErrorResponse.error !== '' && httpErrorResponse.error.message) { + this.addErrorAlert(httpErrorResponse.error.detail ?? httpErrorResponse.error.message); + } else { + this.addErrorAlert(httpErrorResponse.error); + } + } + }); + } + + setClasses(alert: Alert): { [key: string]: boolean } { + const classes = { 'jhi-toast': Boolean(alert.toast) }; + if (alert.position) { + return { ...classes, [alert.position]: true }; + } + return classes; + } + + ngOnDestroy(): void { + this.eventManager.destroy(this.errorListener); + this.eventManager.destroy(this.httpErrorListener); + } + + close(alert: Alert): void { + alert.close?.(this.alerts); + } + + private addErrorAlert(message?: string): void { + this.alertService.addAlert({ type: 'danger', message }, this.alerts); + } +} diff --git a/src/main/webapp/app/shared/alert/alert-error.model.ts b/src/main/webapp/app/shared/alert/alert-error.model.ts new file mode 100644 index 00000000..2b8cb8f5 --- /dev/null +++ b/src/main/webapp/app/shared/alert/alert-error.model.ts @@ -0,0 +1,3 @@ +export class AlertError { + constructor(public message: string) {} +} diff --git a/src/main/webapp/app/shared/alert/alert.component.html b/src/main/webapp/app/shared/alert/alert.component.html new file mode 100644 index 00000000..76ff881d --- /dev/null +++ b/src/main/webapp/app/shared/alert/alert.component.html @@ -0,0 +1,7 @@ + diff --git a/src/main/webapp/app/shared/alert/alert.component.spec.ts b/src/main/webapp/app/shared/alert/alert.component.spec.ts new file mode 100644 index 00000000..79fe41fa --- /dev/null +++ b/src/main/webapp/app/shared/alert/alert.component.spec.ts @@ -0,0 +1,44 @@ +jest.mock('app/core/util/alert.service'); + +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; + +import { AlertService } from 'app/core/util/alert.service'; + +import { AlertComponent } from './alert.component'; + +describe('Alert Component', () => { + let comp: AlertComponent; + let fixture: ComponentFixture; + let mockAlertService: AlertService; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [AlertComponent], + providers: [AlertService], + }) + .overrideTemplate(AlertComponent, '') + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AlertComponent); + comp = fixture.componentInstance; + mockAlertService = TestBed.inject(AlertService); + }); + + it('Should call alertService.get on init', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(mockAlertService.get).toHaveBeenCalled(); + }); + + it('Should call alertService.clear on destroy', () => { + // WHEN + comp.ngOnDestroy(); + + // THEN + expect(mockAlertService.clear).toHaveBeenCalled(); + }); +}); diff --git a/src/main/webapp/app/shared/alert/alert.component.ts b/src/main/webapp/app/shared/alert/alert.component.ts new file mode 100644 index 00000000..098a90f5 --- /dev/null +++ b/src/main/webapp/app/shared/alert/alert.component.ts @@ -0,0 +1,37 @@ +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; + +import { AlertService, Alert } from 'app/core/util/alert.service'; + +@Component({ + standalone: true, + selector: 'jhi-alert', + templateUrl: './alert.component.html', + imports: [CommonModule, NgbModule], +}) +export class AlertComponent implements OnInit, OnDestroy { + alerts: Alert[] = []; + + constructor(private alertService: AlertService) {} + + ngOnInit(): void { + this.alerts = this.alertService.get(); + } + + setClasses(alert: Alert): { [key: string]: boolean } { + const classes = { 'jhi-toast': Boolean(alert.toast) }; + if (alert.position) { + return { ...classes, [alert.position]: true }; + } + return classes; + } + + ngOnDestroy(): void { + this.alertService.clear(); + } + + close(alert: Alert): void { + alert.close?.(this.alerts); + } +} diff --git a/src/main/webapp/app/shared/auth/has-any-authority.directive.spec.ts b/src/main/webapp/app/shared/auth/has-any-authority.directive.spec.ts new file mode 100644 index 00000000..3b8c21a2 --- /dev/null +++ b/src/main/webapp/app/shared/auth/has-any-authority.directive.spec.ts @@ -0,0 +1,131 @@ +jest.mock('app/core/auth/account.service'); + +import { Component, ElementRef, ViewChild } from '@angular/core'; +import { TestBed, waitForAsync } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { Subject } from 'rxjs'; + +import { AccountService } from 'app/core/auth/account.service'; +import { Account } from 'app/core/auth/account.model'; + +import HasAnyAuthorityDirective from './has-any-authority.directive'; + +@Component({ + template: `
`, +}) +class TestHasAnyAuthorityDirectiveComponent { + @ViewChild('content', { static: false }) + content?: ElementRef; +} + +describe('HasAnyAuthorityDirective tests', () => { + let mockAccountService: AccountService; + const authenticationState = new Subject(); + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [HasAnyAuthorityDirective], + declarations: [TestHasAnyAuthorityDirectiveComponent], + providers: [AccountService], + }); + })); + + beforeEach(() => { + mockAccountService = TestBed.inject(AccountService); + mockAccountService.getAuthenticationState = jest.fn(() => authenticationState.asObservable()); + }); + + describe('set jhiHasAnyAuthority', () => { + it('should show restricted content to user if user has required role', () => { + // GIVEN + mockAccountService.hasAnyAuthority = jest.fn(() => true); + const fixture = TestBed.createComponent(TestHasAnyAuthorityDirectiveComponent); + const comp = fixture.componentInstance; + + // WHEN + fixture.detectChanges(); + + // THEN + expect(comp.content).toBeDefined(); + }); + + it('should not show restricted content to user if user has not required role', () => { + // GIVEN + mockAccountService.hasAnyAuthority = jest.fn(() => false); + const fixture = TestBed.createComponent(TestHasAnyAuthorityDirectiveComponent); + const comp = fixture.componentInstance; + + // WHEN + fixture.detectChanges(); + + // THEN + expect(comp.content).toBeUndefined(); + }); + }); + + describe('change authorities', () => { + it('should show or not show restricted content correctly if user authorities are changing', () => { + // GIVEN + mockAccountService.hasAnyAuthority = jest.fn(() => true); + const fixture = TestBed.createComponent(TestHasAnyAuthorityDirectiveComponent); + const comp = fixture.componentInstance; + + // WHEN + fixture.detectChanges(); + + // THEN + expect(comp.content).toBeDefined(); + + // GIVEN + mockAccountService.hasAnyAuthority = jest.fn(() => false); + + // WHEN + authenticationState.next(null); + fixture.detectChanges(); + + // THEN + expect(comp.content).toBeUndefined(); + + // GIVEN + mockAccountService.hasAnyAuthority = jest.fn(() => true); + + // WHEN + authenticationState.next(null); + fixture.detectChanges(); + + // THEN + expect(comp.content).toBeDefined(); + }); + }); + + describe('ngOnDestroy', () => { + it('should destroy authentication state subscription on component destroy', () => { + // GIVEN + mockAccountService.hasAnyAuthority = jest.fn(() => true); + const fixture = TestBed.createComponent(TestHasAnyAuthorityDirectiveComponent); + const div = fixture.debugElement.queryAllNodes(By.directive(HasAnyAuthorityDirective))[0]; + const hasAnyAuthorityDirective = div.injector.get(HasAnyAuthorityDirective); + + // WHEN + fixture.detectChanges(); + + // THEN + expect(mockAccountService.hasAnyAuthority).toHaveBeenCalled(); + + // WHEN + jest.clearAllMocks(); + authenticationState.next(null); + + // THEN + expect(mockAccountService.hasAnyAuthority).toHaveBeenCalled(); + + // WHEN + jest.clearAllMocks(); + hasAnyAuthorityDirective.ngOnDestroy(); + authenticationState.next(null); + + // THEN + expect(mockAccountService.hasAnyAuthority).not.toHaveBeenCalled(); + }); + }); +}); diff --git a/src/main/webapp/app/shared/auth/has-any-authority.directive.ts b/src/main/webapp/app/shared/auth/has-any-authority.directive.ts new file mode 100644 index 00000000..2cec009e --- /dev/null +++ b/src/main/webapp/app/shared/auth/has-any-authority.directive.ts @@ -0,0 +1,58 @@ +import { Directive, Input, TemplateRef, ViewContainerRef, OnDestroy } from '@angular/core'; +import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; + +import { AccountService } from 'app/core/auth/account.service'; + +/** + * @whatItDoes Conditionally includes an HTML element if current user has any + * of the authorities passed as the `expression`. + * + * @howToUse + * ``` + * ... + * + * ... + * ``` + */ +@Directive({ + standalone: true, + selector: '[jhiHasAnyAuthority]', +}) +export default class HasAnyAuthorityDirective implements OnDestroy { + private authorities!: string | string[]; + + private readonly destroy$ = new Subject(); + + constructor( + private accountService: AccountService, + private templateRef: TemplateRef, + private viewContainerRef: ViewContainerRef, + ) {} + + @Input() + set jhiHasAnyAuthority(value: string | string[]) { + this.authorities = value; + this.updateView(); + // Get notified each time authentication state changes. + this.accountService + .getAuthenticationState() + .pipe(takeUntil(this.destroy$)) + .subscribe(() => { + this.updateView(); + }); + } + + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); + } + + private updateView(): void { + const hasAnyAuthority = this.accountService.hasAnyAuthority(this.authorities); + this.viewContainerRef.clear(); + if (hasAnyAuthority) { + this.viewContainerRef.createEmbeddedView(this.templateRef); + } + } +} diff --git a/src/main/webapp/app/shared/date/duration.pipe.ts b/src/main/webapp/app/shared/date/duration.pipe.ts new file mode 100644 index 00000000..fda99e3a --- /dev/null +++ b/src/main/webapp/app/shared/date/duration.pipe.ts @@ -0,0 +1,16 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import dayjs from 'dayjs/esm'; + +@Pipe({ + standalone: true, + name: 'duration', +}) +export default class DurationPipe implements PipeTransform { + transform(value: any): string { + if (value) { + return dayjs.duration(value).humanize(); + } + return ''; + } +} diff --git a/src/main/webapp/app/shared/date/format-medium-date.pipe.spec.ts b/src/main/webapp/app/shared/date/format-medium-date.pipe.spec.ts new file mode 100644 index 00000000..bdb618e4 --- /dev/null +++ b/src/main/webapp/app/shared/date/format-medium-date.pipe.spec.ts @@ -0,0 +1,19 @@ +import dayjs from 'dayjs/esm'; + +import FormatMediumDatePipe from './format-medium-date.pipe'; + +describe('FormatMediumDatePipe', () => { + const formatMediumDatePipe = new FormatMediumDatePipe(); + + it('should return an empty string when receive undefined', () => { + expect(formatMediumDatePipe.transform(undefined)).toBe(''); + }); + + it('should return an empty string when receive null', () => { + expect(formatMediumDatePipe.transform(null)).toBe(''); + }); + + it('should format date like this D MMM YYYY', () => { + expect(formatMediumDatePipe.transform(dayjs('2020-11-16').locale('fr'))).toBe('16 Nov 2020'); + }); +}); diff --git a/src/main/webapp/app/shared/date/format-medium-date.pipe.ts b/src/main/webapp/app/shared/date/format-medium-date.pipe.ts new file mode 100644 index 00000000..96b679b2 --- /dev/null +++ b/src/main/webapp/app/shared/date/format-medium-date.pipe.ts @@ -0,0 +1,13 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import dayjs from 'dayjs/esm'; + +@Pipe({ + standalone: true, + name: 'formatMediumDate', +}) +export default class FormatMediumDatePipe implements PipeTransform { + transform(day: dayjs.Dayjs | null | undefined): string { + return day ? day.format('D MMM YYYY') : ''; + } +} diff --git a/src/main/webapp/app/shared/date/format-medium-datetime.pipe.spec.ts b/src/main/webapp/app/shared/date/format-medium-datetime.pipe.spec.ts new file mode 100644 index 00000000..c08aa47a --- /dev/null +++ b/src/main/webapp/app/shared/date/format-medium-datetime.pipe.spec.ts @@ -0,0 +1,19 @@ +import dayjs from 'dayjs/esm'; + +import FormatMediumDatetimePipe from './format-medium-datetime.pipe'; + +describe('FormatMediumDatePipe', () => { + const formatMediumDatetimePipe = new FormatMediumDatetimePipe(); + + it('should return an empty string when receive undefined', () => { + expect(formatMediumDatetimePipe.transform(undefined)).toBe(''); + }); + + it('should return an empty string when receive null', () => { + expect(formatMediumDatetimePipe.transform(null)).toBe(''); + }); + + it('should format date like this D MMM YYYY', () => { + expect(formatMediumDatetimePipe.transform(dayjs('2020-11-16').locale('fr'))).toBe('16 Nov 2020 00:00:00'); + }); +}); diff --git a/src/main/webapp/app/shared/date/format-medium-datetime.pipe.ts b/src/main/webapp/app/shared/date/format-medium-datetime.pipe.ts new file mode 100644 index 00000000..bd09cfbf --- /dev/null +++ b/src/main/webapp/app/shared/date/format-medium-datetime.pipe.ts @@ -0,0 +1,13 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import dayjs from 'dayjs/esm'; + +@Pipe({ + standalone: true, + name: 'formatMediumDatetime', +}) +export default class FormatMediumDatetimePipe implements PipeTransform { + transform(day: dayjs.Dayjs | null | undefined): string { + return day ? day.format('D MMM YYYY HH:mm:ss') : ''; + } +} diff --git a/src/main/webapp/app/shared/date/index.ts b/src/main/webapp/app/shared/date/index.ts new file mode 100644 index 00000000..5372ce8a --- /dev/null +++ b/src/main/webapp/app/shared/date/index.ts @@ -0,0 +1,3 @@ +export { default as DurationPipe } from './duration.pipe'; +export { default as FormatMediumDatePipe } from './format-medium-date.pipe'; +export { default as FormatMediumDatetimePipe } from './format-medium-datetime.pipe'; diff --git a/src/main/webapp/app/shared/filter/filter.component.html b/src/main/webapp/app/shared/filter/filter.component.html new file mode 100644 index 00000000..8862d00e --- /dev/null +++ b/src/main/webapp/app/shared/filter/filter.component.html @@ -0,0 +1,12 @@ +
+ Following filters are set + +
    + +
  • + {{ filterOption.name }}: {{ value }} + +
  • +
    +
+
diff --git a/src/main/webapp/app/shared/filter/filter.component.ts b/src/main/webapp/app/shared/filter/filter.component.ts new file mode 100644 index 00000000..8117666d --- /dev/null +++ b/src/main/webapp/app/shared/filter/filter.component.ts @@ -0,0 +1,21 @@ +import { Component, Input } from '@angular/core'; +import SharedModule from '../shared.module'; +import { IFilterOptions } from './filter.model'; + +@Component({ + selector: 'jhi-filter', + standalone: true, + imports: [SharedModule], + templateUrl: './filter.component.html', +}) +export default class FilterComponent { + @Input() filters!: IFilterOptions; + + clearAllFilters(): void { + this.filters.clear(); + } + + clearFilter(filterName: string, value: string): void { + this.filters.removeFilter(filterName, value); + } +} diff --git a/src/main/webapp/app/shared/filter/filter.model.spec.ts b/src/main/webapp/app/shared/filter/filter.model.spec.ts new file mode 100644 index 00000000..92bb207b --- /dev/null +++ b/src/main/webapp/app/shared/filter/filter.model.spec.ts @@ -0,0 +1,242 @@ +import { convertToParamMap, ParamMap, Params } from '@angular/router'; +import { FilterOptions, FilterOption } from './filter.model'; + +describe('FilterModel Tests', () => { + describe('FilterOption', () => { + let filterOption: FilterOption; + + beforeEach(() => { + filterOption = new FilterOption('foo', ['bar', 'bar2']); + }); + + it('nameAsQueryParam returns query key', () => { + expect(filterOption.nameAsQueryParam()).toEqual('filter[foo]'); + }); + + describe('addValue', () => { + it('adds multiples unique values and returns true', () => { + const ret = filterOption.addValue('bar2', 'bar3', 'bar4'); + expect(filterOption.values).toMatchObject(['bar', 'bar2', 'bar3', 'bar4']); + expect(ret).toBe(true); + }); + it("doesn't adds duplicated values and return false", () => { + const ret = filterOption.addValue('bar', 'bar2'); + expect(filterOption.values).toMatchObject(['bar', 'bar2']); + expect(ret).toBe(false); + }); + }); + + describe('removeValue', () => { + it('removes the exiting value and return true', () => { + const ret = filterOption.removeValue('bar'); + expect(filterOption.values).toMatchObject(['bar2']); + expect(ret).toBe(true); + }); + it("doesn't removes the value and return false", () => { + const ret = filterOption.removeValue('foo'); + expect(filterOption.values).toMatchObject(['bar', 'bar2']); + expect(ret).toBe(false); + }); + }); + + describe('equals', () => { + it('returns true to matching options', () => { + const otherFilterOption = new FilterOption(filterOption.name, filterOption.values.concat()); + expect(filterOption.equals(otherFilterOption)).toBe(true); + expect(otherFilterOption.equals(filterOption)).toBe(true); + }); + it('returns false to different name', () => { + const otherFilterOption = new FilterOption('bar', filterOption.values.concat()); + expect(filterOption.equals(otherFilterOption)).toBe(false); + expect(otherFilterOption.equals(filterOption)).toBe(false); + }); + it('returns false to different values', () => { + const otherFilterOption = new FilterOption('bar', []); + expect(filterOption.equals(otherFilterOption)).toBe(false); + expect(otherFilterOption.equals(filterOption)).toBe(false); + }); + }); + }); + + describe('FilterOptions', () => { + describe('hasAnyFilterSet', () => { + it('with empty options returns false', () => { + const filters = new FilterOptions(); + expect(filters.hasAnyFilterSet()).toBe(false); + }); + it('with options and empty values returns false', () => { + const filters = new FilterOptions([new FilterOption('foo'), new FilterOption('bar')]); + expect(filters.hasAnyFilterSet()).toBe(false); + }); + it('with option and value returns true', () => { + const filters = new FilterOptions([new FilterOption('foo', ['bar'])]); + expect(filters.hasAnyFilterSet()).toBe(true); + }); + }); + + describe('clear', () => { + it("removes empty filters and dosn't emit next element", () => { + const filters = new FilterOptions([new FilterOption('foo'), new FilterOption('bar')]); + jest.spyOn(filters.filterChanges, 'next'); + + filters.clear(); + + expect(filters.filterChanges.next).not.toBeCalled(); + expect(filters.filterOptions).toMatchObject([]); + }); + it('removes empty filters and emits next element', () => { + const filters = new FilterOptions([new FilterOption('foo', ['existingFoo1']), new FilterOption('bar')]); + jest.spyOn(filters.filterChanges, 'next'); + + filters.clear(); + + expect(filters.filterChanges.next).toHaveBeenCalledTimes(1); + expect(filters.filterOptions).toMatchObject([]); + }); + }); + + describe('addFilter', () => { + it('adds a non existing FilterOption, returns true and emit next element', () => { + const filters = new FilterOptions([new FilterOption('foo', ['existingFoo1', 'existingFoo2']), new FilterOption('bar')]); + jest.spyOn(filters.filterChanges, 'next'); + + const result = filters.addFilter('addedFilter', 'addedValue'); + + expect(result).toBe(true); + expect(filters.filterChanges.next).toHaveBeenCalledTimes(1); + expect(filters.filterOptions).toMatchObject([ + { name: 'foo', values: ['existingFoo1', 'existingFoo2'] }, + { name: 'addedFilter', values: ['addedValue'] }, + ]); + }); + it('adds a non existing value to FilterOption, returns true and emit next element', () => { + const filters = new FilterOptions([new FilterOption('foo', ['existingFoo1', 'existingFoo2']), new FilterOption('bar')]); + jest.spyOn(filters.filterChanges, 'next'); + + const result = filters.addFilter('foo', 'addedValue1', 'addedValue2'); + + expect(result).toBe(true); + expect(filters.filterChanges.next).toHaveBeenCalledTimes(1); + expect(filters.filterOptions).toMatchObject([ + { name: 'foo', values: ['existingFoo1', 'existingFoo2', 'addedValue1', 'addedValue2'] }, + ]); + }); + it("doesn't add FilterOption values already added, returns false and doesn't emit next element", () => { + const filters = new FilterOptions([new FilterOption('foo', ['existingFoo1', 'existingFoo2']), new FilterOption('bar')]); + jest.spyOn(filters.filterChanges, 'next'); + + const result = filters.addFilter('foo', 'existingFoo1', 'existingFoo2'); + + expect(result).toBe(false); + expect(filters.filterChanges.next).not.toBeCalled(); + expect(filters.filterOptions).toMatchObject([{ name: 'foo', values: ['existingFoo1', 'existingFoo2'] }]); + }); + }); + + describe('removeFilter', () => { + it('removes an existing FilterOptions and returns true', () => { + const filters = new FilterOptions([new FilterOption('foo', ['existingFoo1', 'existingFoo2']), new FilterOption('bar')]); + jest.spyOn(filters.filterChanges, 'next'); + + const result = filters.removeFilter('foo', 'existingFoo1'); + + expect(result).toBe(true); + expect(filters.filterChanges.next).toHaveBeenCalledTimes(1); + expect(filters.filterOptions).toMatchObject([{ name: 'foo', values: ['existingFoo2'] }]); + }); + it("doesn't remove a non existing FilterOptions values returns false", () => { + const filters = new FilterOptions([new FilterOption('foo', ['existingFoo1', 'existingFoo2']), new FilterOption('bar')]); + jest.spyOn(filters.filterChanges, 'next'); + + const result = filters.removeFilter('foo', 'nonExisting1'); + + expect(result).toBe(false); + expect(filters.filterChanges.next).not.toBeCalled(); + expect(filters.filterOptions).toMatchObject([{ name: 'foo', values: ['existingFoo1', 'existingFoo2'] }]); + }); + it("doesn't remove a non existing FilterOptions returns false", () => { + const filters = new FilterOptions([new FilterOption('foo', ['existingFoo1', 'existingFoo2']), new FilterOption('bar')]); + jest.spyOn(filters.filterChanges, 'next'); + + const result = filters.removeFilter('nonExisting', 'nonExisting1'); + + expect(result).toBe(false); + expect(filters.filterChanges.next).not.toBeCalled(); + expect(filters.filterOptions).toMatchObject([{ name: 'foo', values: ['existingFoo1', 'existingFoo2'] }]); + }); + }); + + describe('initializeFromParams', () => { + const oneValidParam: Params = { + test: 'blub', + 'filter[hello.in]': 'world', + 'filter[invalid': 'invalid', + filter_invalid2: 'invalid', + }; + + const noValidParam: Params = { + test: 'blub', + 'filter[invalid': 'invalid', + filter_invalid2: 'invalid', + }; + + const paramWithTwoValues: Params = { + 'filter[hello.in]': ['world', 'world2'], + }; + + const paramWithTwoKeys: Params = { + 'filter[hello.in]': ['world', 'world2'], + 'filter[hello.notIn]': ['world3', 'world4'], + }; + + it('should parse from Params if there are any and not emit next element', () => { + const filters: FilterOptions = new FilterOptions([new FilterOption('foo', ['bar'])]); + jest.spyOn(filters.filterChanges, 'next'); + const paramMap: ParamMap = convertToParamMap(oneValidParam); + + filters.initializeFromParams(paramMap); + + expect(filters.filterChanges.next).not.toHaveBeenCalled(); + expect(filters.filterOptions).toMatchObject([{ name: 'hello.in', values: ['world'] }]); + }); + + it('should parse from Params and have none if there are none', () => { + const filters: FilterOptions = new FilterOptions(); + const paramMap: ParamMap = convertToParamMap(noValidParam); + jest.spyOn(filters.filterChanges, 'next'); + + filters.initializeFromParams(paramMap); + + expect(filters.filterChanges.next).not.toHaveBeenCalled(); + expect(filters.filterOptions).toMatchObject([]); + }); + + it('should parse from Params and have a parameter with 2 values and one additional value', () => { + const filters: FilterOptions = new FilterOptions([new FilterOption('hello.in', ['world'])]); + jest.spyOn(filters.filterChanges, 'next'); + + const paramMap: ParamMap = convertToParamMap(paramWithTwoValues); + + filters.initializeFromParams(paramMap); + + expect(filters.filterChanges.next).not.toHaveBeenCalled(); + expect(filters.filterOptions).toMatchObject([{ name: 'hello.in', values: ['world', 'world2'] }]); + }); + + it('should parse from Params and have a parameter with 2 keys', () => { + const filters: FilterOptions = new FilterOptions(); + jest.spyOn(filters.filterChanges, 'next'); + + const paramMap: ParamMap = convertToParamMap(paramWithTwoKeys); + + filters.initializeFromParams(paramMap); + + expect(filters.filterChanges.next).not.toHaveBeenCalled(); + expect(filters.filterOptions).toMatchObject([ + { name: 'hello.in', values: ['world', 'world2'] }, + { name: 'hello.notIn', values: ['world3', 'world4'] }, + ]); + }); + }); + }); +}); diff --git a/src/main/webapp/app/shared/filter/filter.model.ts b/src/main/webapp/app/shared/filter/filter.model.ts new file mode 100644 index 00000000..794a0c09 --- /dev/null +++ b/src/main/webapp/app/shared/filter/filter.model.ts @@ -0,0 +1,159 @@ +import { ParamMap } from '@angular/router'; +import { Subject } from 'rxjs'; + +export interface IFilterOptions { + readonly filterChanges: Subject; + get filterOptions(): IFilterOption[]; + hasAnyFilterSet(): boolean; + clear(): boolean; + initializeFromParams(params: ParamMap): boolean; + addFilter(name: string, ...values: string[]): boolean; + removeFilter(name: string, value: string): boolean; +} + +export interface IFilterOption { + name: string; + values: string[]; + nameAsQueryParam(): string; +} + +export class FilterOption implements IFilterOption { + constructor( + public name: string, + public values: string[] = [], + ) { + this.values = [...new Set(values)]; + } + + nameAsQueryParam(): string { + return 'filter[' + this.name + ']'; + } + + isSet(): boolean { + return this.values.length > 0; + } + + addValue(...values: string[]): boolean { + const missingValues = values.filter(value => value && !this.values.includes(value)); + if (missingValues.length > 0) { + this.values.push(...missingValues); + return true; + } + return false; + } + + removeValue(value: string): boolean { + const indexOf = this.values.indexOf(value); + if (indexOf === -1) { + return false; + } + + this.values.splice(indexOf, 1); + return true; + } + + clone(): FilterOption { + return new FilterOption(this.name, this.values.concat()); + } + + equals(other: IFilterOption): boolean { + return ( + this.name === other.name && + this.values.length === other.values.length && + this.values.every(thisValue => other.values.includes(thisValue)) && + other.values.every(otherValue => this.values.includes(otherValue)) + ); + } +} + +export class FilterOptions implements IFilterOptions { + readonly filterChanges: Subject = new Subject(); + private _filterOptions: FilterOption[]; + + constructor(filterOptions: FilterOption[] = []) { + this._filterOptions = filterOptions; + } + + get filterOptions(): FilterOption[] { + return this._filterOptions.filter(option => option.isSet()); + } + + hasAnyFilterSet(): boolean { + return this._filterOptions.some(e => e.isSet()); + } + + clear(): boolean { + const hasFields = this.hasAnyFilterSet(); + this._filterOptions = []; + if (hasFields) { + this.changed(); + } + return hasFields; + } + + initializeFromParams(params: ParamMap): boolean { + const oldFilters: FilterOptions = this.clone(); + + this._filterOptions = []; + + const filterRegex = /filter\[(.+)\]/; + params.keys + .filter(paramKey => filterRegex.test(paramKey)) + .forEach(matchingParam => { + const matches = filterRegex.exec(matchingParam); + if (matches && matches.length > 1) { + this.getFilterOptionByName(matches[1], true).addValue(...params.getAll(matchingParam)); + } + }); + + if (oldFilters.equals(this)) { + return false; + } + return true; + } + + addFilter(name: string, ...values: string[]): boolean { + if (this.getFilterOptionByName(name, true).addValue(...values)) { + this.changed(); + return true; + } + return false; + } + + removeFilter(name: string, value: string): boolean { + if (this.getFilterOptionByName(name)?.removeValue(value)) { + this.changed(); + return true; + } + return false; + } + + protected changed(): void { + this.filterChanges.next(this.filterOptions.map(option => option.clone())); + } + + protected equals(other: FilterOptions): boolean { + const thisFilters = this.filterOptions; + const otherFilters = other.filterOptions; + if (thisFilters.length !== otherFilters.length) { + return false; + } + return thisFilters.every(option => other.getFilterOptionByName(option.name)?.equals(option)); + } + + protected clone(): FilterOptions { + return new FilterOptions(this.filterOptions.map(option => new FilterOption(option.name, option.values.concat()))); + } + + protected getFilterOptionByName(name: string, add: true): FilterOption; + protected getFilterOptionByName(name: string, add: false): FilterOption | null; + protected getFilterOptionByName(name: string): FilterOption | null; + protected getFilterOptionByName(name: string, add = false): FilterOption | null { + const addOption = (option: FilterOption): FilterOption => { + this._filterOptions.push(option); + return option; + }; + + return this._filterOptions.find(thisOption => thisOption.name === name) ?? (add ? addOption(new FilterOption(name)) : null); + } +} diff --git a/src/main/webapp/app/shared/filter/index.ts b/src/main/webapp/app/shared/filter/index.ts new file mode 100644 index 00000000..ae0af5a7 --- /dev/null +++ b/src/main/webapp/app/shared/filter/index.ts @@ -0,0 +1,2 @@ +export { default as FilterComponent } from './filter.component'; +export * from './filter.model'; diff --git a/src/main/webapp/app/shared/pagination/index.ts b/src/main/webapp/app/shared/pagination/index.ts new file mode 100644 index 00000000..395ed882 --- /dev/null +++ b/src/main/webapp/app/shared/pagination/index.ts @@ -0,0 +1 @@ +export { default as ItemCountComponent } from './item-count.component'; diff --git a/src/main/webapp/app/shared/pagination/item-count.component.spec.ts b/src/main/webapp/app/shared/pagination/item-count.component.spec.ts new file mode 100644 index 00000000..7a24ba8b --- /dev/null +++ b/src/main/webapp/app/shared/pagination/item-count.component.spec.ts @@ -0,0 +1,64 @@ +import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing'; + +import ItemCountComponent from './item-count.component'; + +describe('ItemCountComponent test', () => { + let comp: ItemCountComponent; + let fixture: ComponentFixture; + + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + imports: [ItemCountComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ItemCountComponent); + comp = fixture.componentInstance; + }); + + describe('UI logic tests', () => { + it('should initialize with undefined', () => { + expect(comp.first).toBeUndefined(); + expect(comp.second).toBeUndefined(); + expect(comp.total).toBeUndefined(); + }); + + it('should set calculated numbers to undefined if the page value is not yet defined', () => { + // GIVEN + comp.params = { page: undefined, totalItems: 0, itemsPerPage: 10 }; + + // THEN + expect(comp.first).toBeUndefined(); + expect(comp.second).toBeUndefined(); + }); + + it('should change the content on page change', () => { + // GIVEN + comp.params = { page: 1, totalItems: 100, itemsPerPage: 10 }; + + // THEN + expect(comp.first).toBe(1); + expect(comp.second).toBe(10); + expect(comp.total).toBe(100); + + // GIVEN + comp.params = { page: 2, totalItems: 100, itemsPerPage: 10 }; + + // THEN + expect(comp.first).toBe(11); + expect(comp.second).toBe(20); + expect(comp.total).toBe(100); + }); + + it('should set the second number to totalItems if this is the last page which contains less than itemsPerPage items', () => { + // GIVEN + comp.params = { page: 2, totalItems: 16, itemsPerPage: 10 }; + + // THEN + expect(comp.first).toBe(11); + expect(comp.second).toBe(16); + expect(comp.total).toBe(16); + }); + }); +}); diff --git a/src/main/webapp/app/shared/pagination/item-count.component.ts b/src/main/webapp/app/shared/pagination/item-count.component.ts new file mode 100644 index 00000000..cab49040 --- /dev/null +++ b/src/main/webapp/app/shared/pagination/item-count.component.ts @@ -0,0 +1,32 @@ +import { Component, Input } from '@angular/core'; + +/** + * A component that will take care of item count statistics of a pagination. + */ +@Component({ + standalone: true, + selector: 'jhi-item-count', + template: `
Showing {{ first }} - {{ second }} of {{ total }} items.
`, +}) +export default class ItemCountComponent { + /** + * @param params Contains parameters for component: + * page Current page number + * totalItems Total number of items + * itemsPerPage Number of items per page + */ + @Input() set params(params: { page?: number; totalItems?: number; itemsPerPage?: number }) { + if (params.page && params.totalItems !== undefined && params.itemsPerPage) { + this.first = (params.page - 1) * params.itemsPerPage + 1; + this.second = params.page * params.itemsPerPage < params.totalItems ? params.page * params.itemsPerPage : params.totalItems; + } else { + this.first = undefined; + this.second = undefined; + } + this.total = params.totalItems; + } + + first?: number; + second?: number; + total?: number; +} diff --git a/src/main/webapp/app/shared/shared.module.ts b/src/main/webapp/app/shared/shared.module.ts new file mode 100644 index 00000000..25590b2d --- /dev/null +++ b/src/main/webapp/app/shared/shared.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { AlertComponent } from './alert/alert.component'; +import { AlertErrorComponent } from './alert/alert-error.component'; + +/** + * Application wide Module + */ +@NgModule({ + imports: [AlertComponent, AlertErrorComponent], + exports: [CommonModule, NgbModule, FontAwesomeModule, AlertComponent, AlertErrorComponent], +}) +export default class SharedModule {} diff --git a/src/main/webapp/app/shared/sort/index.ts b/src/main/webapp/app/shared/sort/index.ts new file mode 100644 index 00000000..1a04bec6 --- /dev/null +++ b/src/main/webapp/app/shared/sort/index.ts @@ -0,0 +1,2 @@ +export { default as SortDirective } from './sort.directive'; +export { default as SortByDirective } from './sort-by.directive'; diff --git a/src/main/webapp/app/shared/sort/sort-by.directive.spec.ts b/src/main/webapp/app/shared/sort/sort-by.directive.spec.ts new file mode 100644 index 00000000..51fef72d --- /dev/null +++ b/src/main/webapp/app/shared/sort/sort-by.directive.spec.ts @@ -0,0 +1,140 @@ +import { Component, DebugElement } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { FaIconComponent, FaIconLibrary } from '@fortawesome/angular-fontawesome'; +import { fas, faSort, faSortDown, faSortUp } from '@fortawesome/free-solid-svg-icons'; + +import SortByDirective from './sort-by.directive'; +import SortDirective from './sort.directive'; + +@Component({ + template: ` + + + + + + +
ID
+ `, +}) +class TestSortByDirectiveComponent { + predicate?: string; + ascending?: boolean; + sortAllowed = true; + transition = jest.fn(); + + constructor(library: FaIconLibrary) { + library.addIconPacks(fas); + library.addIcons(faSort, faSortDown, faSortUp); + } +} + +describe('Directive: SortByDirective', () => { + let component: TestSortByDirectiveComponent; + let fixture: ComponentFixture; + let tableHead: DebugElement; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [SortDirective, SortByDirective], + declarations: [TestSortByDirectiveComponent, FaIconComponent], + }); + fixture = TestBed.createComponent(TestSortByDirectiveComponent); + component = fixture.componentInstance; + tableHead = fixture.debugElement.query(By.directive(SortByDirective)); + }); + + it('should initialize predicate, order, icon when initial component predicate differs from column predicate', () => { + // GIVEN + component.predicate = 'id'; + const sortByDirective = tableHead.injector.get(SortByDirective); + + // WHEN + fixture.detectChanges(); + + // THEN + expect(sortByDirective.jhiSortBy).toEqual('name'); + expect(component.predicate).toEqual('id'); + expect(sortByDirective.iconComponent?.icon).toEqual('sort'); + expect(component.transition).toHaveBeenCalledTimes(0); + }); + + it('should initialize predicate, order, icon when initial component predicate is same as column predicate', () => { + // GIVEN + component.predicate = 'name'; + component.ascending = true; + const sortByDirective = tableHead.injector.get(SortByDirective); + + // WHEN + fixture.detectChanges(); + + // THEN + expect(sortByDirective.jhiSortBy).toEqual('name'); + expect(component.predicate).toEqual('name'); + expect(component.ascending).toEqual(true); + expect(sortByDirective.iconComponent?.icon).toEqual(faSortUp.iconName); + expect(component.transition).toHaveBeenCalledTimes(0); + }); + + it('should update component predicate, order, icon when user clicks on column header', () => { + // GIVEN + component.predicate = 'name'; + component.ascending = true; + const sortByDirective = tableHead.injector.get(SortByDirective); + + // WHEN + fixture.detectChanges(); + tableHead.triggerEventHandler('click', null); + fixture.detectChanges(); + + // THEN + expect(component.predicate).toEqual('name'); + expect(component.ascending).toEqual(false); + expect(sortByDirective.iconComponent?.icon).toEqual(faSortDown.iconName); + expect(component.transition).toHaveBeenCalledTimes(1); + expect(component.transition).toHaveBeenCalledWith({ predicate: 'name', ascending: false }); + }); + + it('should update component predicate, order, icon when user double clicks on column header', () => { + // GIVEN + component.predicate = 'name'; + component.ascending = true; + const sortByDirective = tableHead.injector.get(SortByDirective); + + // WHEN + fixture.detectChanges(); + + tableHead.triggerEventHandler('click', null); + fixture.detectChanges(); + + tableHead.triggerEventHandler('click', null); + fixture.detectChanges(); + + // THEN + expect(component.predicate).toEqual('name'); + expect(component.ascending).toEqual(true); + expect(sortByDirective.iconComponent?.icon).toEqual(faSortUp.iconName); + expect(component.transition).toHaveBeenCalledTimes(2); + expect(component.transition).toHaveBeenNthCalledWith(1, { predicate: 'name', ascending: false }); + expect(component.transition).toHaveBeenNthCalledWith(2, { predicate: 'name', ascending: true }); + }); + + it('should not run sorting on click if sorting icon is hidden', () => { + // GIVEN + component.predicate = 'id'; + component.ascending = false; + component.sortAllowed = false; + + // WHEN + fixture.detectChanges(); + + tableHead.triggerEventHandler('click', null); + fixture.detectChanges(); + + // THEN + expect(component.predicate).toEqual('id'); + expect(component.ascending).toEqual(false); + expect(component.transition).not.toHaveBeenCalled(); + }); +}); diff --git a/src/main/webapp/app/shared/sort/sort-by.directive.ts b/src/main/webapp/app/shared/sort/sort-by.directive.ts new file mode 100644 index 00000000..1e8eda6e --- /dev/null +++ b/src/main/webapp/app/shared/sort/sort-by.directive.ts @@ -0,0 +1,56 @@ +import { AfterContentInit, ContentChild, Directive, Host, HostListener, Input, OnDestroy } from '@angular/core'; +import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; +import { FaIconComponent } from '@fortawesome/angular-fontawesome'; +import { faSort, faSortDown, faSortUp, IconDefinition } from '@fortawesome/free-solid-svg-icons'; + +import SortDirective from './sort.directive'; + +@Directive({ + standalone: true, + selector: '[jhiSortBy]', +}) +export default class SortByDirective implements AfterContentInit, OnDestroy { + @Input() jhiSortBy!: T; + + @ContentChild(FaIconComponent, { static: false }) + iconComponent?: FaIconComponent; + + sortIcon = faSort; + sortAscIcon = faSortUp; + sortDescIcon = faSortDown; + + private readonly destroy$ = new Subject(); + + constructor(@Host() private sort: SortDirective) { + sort.predicateChange.pipe(takeUntil(this.destroy$)).subscribe(() => this.updateIconDefinition()); + sort.ascendingChange.pipe(takeUntil(this.destroy$)).subscribe(() => this.updateIconDefinition()); + } + + @HostListener('click') + onClick(): void { + if (this.iconComponent) { + this.sort.sort(this.jhiSortBy); + } + } + + ngAfterContentInit(): void { + this.updateIconDefinition(); + } + + ngOnDestroy(): void { + this.destroy$.next(); + this.destroy$.complete(); + } + + private updateIconDefinition(): void { + if (this.iconComponent) { + let icon: IconDefinition = this.sortIcon; + if (this.sort.predicate === this.jhiSortBy) { + icon = this.sort.ascending ? this.sortAscIcon : this.sortDescIcon; + } + this.iconComponent.icon = icon.iconName; + this.iconComponent.render(); + } + } +} diff --git a/src/main/webapp/app/shared/sort/sort.directive.spec.ts b/src/main/webapp/app/shared/sort/sort.directive.spec.ts new file mode 100644 index 00000000..5dc7b875 --- /dev/null +++ b/src/main/webapp/app/shared/sort/sort.directive.spec.ts @@ -0,0 +1,87 @@ +import { Component, DebugElement } from '@angular/core'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; + +import SortDirective from './sort.directive'; + +@Component({ + template: ` + + + + +
+ `, +}) +class TestSortDirectiveComponent { + predicate?: string; + ascending?: boolean; + transition = jest.fn(); +} + +describe('Directive: SortDirective', () => { + let component: TestSortDirectiveComponent; + let fixture: ComponentFixture; + let tableRow: DebugElement; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [SortDirective], + declarations: [TestSortDirectiveComponent], + }); + fixture = TestBed.createComponent(TestSortDirectiveComponent); + component = fixture.componentInstance; + tableRow = fixture.debugElement.query(By.directive(SortDirective)); + }); + + it('should update predicate, order and invoke sortChange function', () => { + // GIVEN + const sortDirective = tableRow.injector.get(SortDirective); + + // WHEN + fixture.detectChanges(); + sortDirective.sort('ID'); + + // THEN + expect(component.predicate).toEqual('ID'); + expect(component.ascending).toEqual(true); + expect(component.transition).toHaveBeenCalledTimes(1); + expect(component.transition).toHaveBeenCalledWith({ predicate: 'ID', ascending: true }); + }); + + it('should change sort order to descending when same field is sorted again', () => { + // GIVEN + const sortDirective = tableRow.injector.get(SortDirective); + + // WHEN + fixture.detectChanges(); + sortDirective.sort('ID'); + // sort again + sortDirective.sort('ID'); + + // THEN + expect(component.predicate).toEqual('ID'); + expect(component.ascending).toEqual(false); + expect(component.transition).toHaveBeenCalledTimes(2); + expect(component.transition).toHaveBeenNthCalledWith(1, { predicate: 'ID', ascending: true }); + expect(component.transition).toHaveBeenNthCalledWith(2, { predicate: 'ID', ascending: false }); + }); + + it('should change sort order to ascending when different field is sorted', () => { + // GIVEN + const sortDirective = tableRow.injector.get(SortDirective); + + // WHEN + fixture.detectChanges(); + sortDirective.sort('ID'); + // sort again + sortDirective.sort('NAME'); + + // THEN + expect(component.predicate).toEqual('NAME'); + expect(component.ascending).toEqual(true); + expect(component.transition).toHaveBeenCalledTimes(2); + expect(component.transition).toHaveBeenNthCalledWith(1, { predicate: 'ID', ascending: true }); + expect(component.transition).toHaveBeenNthCalledWith(2, { predicate: 'NAME', ascending: true }); + }); +}); diff --git a/src/main/webapp/app/shared/sort/sort.directive.ts b/src/main/webapp/app/shared/sort/sort.directive.ts new file mode 100644 index 00000000..9bc4117e --- /dev/null +++ b/src/main/webapp/app/shared/sort/sort.directive.ts @@ -0,0 +1,40 @@ +import { Directive, EventEmitter, Input, Output } from '@angular/core'; + +@Directive({ + standalone: true, + selector: '[jhiSort]', +}) +export default class SortDirective { + @Input() + get predicate(): T | undefined { + return this._predicate; + } + set predicate(predicate: T | undefined) { + this._predicate = predicate; + this.predicateChange.emit(predicate); + } + + @Input() + get ascending(): boolean | undefined { + return this._ascending; + } + set ascending(ascending: boolean | undefined) { + this._ascending = ascending; + this.ascendingChange.emit(ascending); + } + + @Output() predicateChange = new EventEmitter(); + @Output() ascendingChange = new EventEmitter(); + @Output() sortChange = new EventEmitter<{ predicate: T; ascending: boolean }>(); + + private _predicate?: T; + private _ascending?: boolean; + + sort(field: T): void { + this.ascending = field !== this.predicate ? true : !this.ascending; + this.predicate = field; + this.predicateChange.emit(field); + this.ascendingChange.emit(this.ascending); + this.sortChange.emit({ predicate: this.predicate, ascending: this.ascending }); + } +} diff --git a/src/main/webapp/app/shared/sort/sort.service.ts b/src/main/webapp/app/shared/sort/sort.service.ts new file mode 100644 index 00000000..d2760599 --- /dev/null +++ b/src/main/webapp/app/shared/sort/sort.service.ts @@ -0,0 +1,13 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ providedIn: 'root' }) +export class SortService { + private collator = new Intl.Collator(undefined, { + numeric: true, + sensitivity: 'base', + }); + + public startSort(property: string, order: number): (a: any, b: any) => number { + return (a: any, b: any) => this.collator.compare(a[property], b[property]) * order; + } +} diff --git a/src/main/webapp/bootstrap.ts b/src/main/webapp/bootstrap.ts new file mode 100644 index 00000000..e5038d52 --- /dev/null +++ b/src/main/webapp/bootstrap.ts @@ -0,0 +1,16 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { DEBUG_INFO_ENABLED } from './app/app.constants'; +import { AppModule } from './app/app.module'; + +// disable debug data on prod profile to improve performance +if (!DEBUG_INFO_ENABLED) { + enableProdMode(); +} + +platformBrowserDynamic() + .bootstrapModule(AppModule, { preserveWhitespaces: true }) + // eslint-disable-next-line no-console + .then(() => console.log('Application started')) + .catch(err => console.error(err)); diff --git a/src/main/webapp/content/css/loading.css b/src/main/webapp/content/css/loading.css new file mode 100644 index 00000000..678e7b63 --- /dev/null +++ b/src/main/webapp/content/css/loading.css @@ -0,0 +1,152 @@ +@keyframes lds-pacman-1 { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + } + 100% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@-webkit-keyframes lds-pacman-1 { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + 50% { + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + } + 100% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } +} +@keyframes lds-pacman-2 { + 0% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 50% { + -webkit-transform: rotate(225deg); + transform: rotate(225deg); + } + 100% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } +} +@-webkit-keyframes lds-pacman-2 { + 0% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } + 50% { + -webkit-transform: rotate(225deg); + transform: rotate(225deg); + } + 100% { + -webkit-transform: rotate(180deg); + transform: rotate(180deg); + } +} +@keyframes lds-pacman-3 { + 0% { + -webkit-transform: translate(190px, 0); + transform: translate(190px, 0); + opacity: 0; + } + 20% { + opacity: 1; + } + 100% { + -webkit-transform: translate(70px, 0); + transform: translate(70px, 0); + opacity: 1; + } +} +@-webkit-keyframes lds-pacman-3 { + 0% { + -webkit-transform: translate(190px, 0); + transform: translate(190px, 0); + opacity: 0; + } + 20% { + opacity: 1; + } + 100% { + -webkit-transform: translate(70px, 0); + transform: translate(70px, 0); + opacity: 1; + } +} + +.app-loading { + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + position: relative; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + top: 10em; +} +.app-loading p { + display: block; + font-size: 1.17em; + margin-inline-start: 0px; + margin-inline-end: 0px; + font-weight: normal; +} + +.app-loading .lds-pacman { + position: relative; + margin: auto; + width: 200px !important; + height: 200px !important; + -webkit-transform: translate(-100px, -100px) scale(1) translate(100px, 100px); + transform: translate(-100px, -100px) scale(1) translate(100px, 100px); +} +.app-loading .lds-pacman > div:nth-child(2) div { + position: absolute; + top: 40px; + left: 40px; + width: 120px; + height: 60px; + border-radius: 120px 120px 0 0; + background: #bbcedd; + -webkit-animation: lds-pacman-1 1s linear infinite; + animation: lds-pacman-1 1s linear infinite; + -webkit-transform-origin: 60px 60px; + transform-origin: 60px 60px; +} +.app-loading .lds-pacman > div:nth-child(2) div:nth-child(2) { + -webkit-animation: lds-pacman-2 1s linear infinite; + animation: lds-pacman-2 1s linear infinite; +} +.app-loading .lds-pacman > div:nth-child(1) div { + position: absolute; + top: 97px; + left: -8px; + width: 24px; + height: 10px; + background-image: url('/content/images/logo-jhipster.png'); + background-size: contain; + -webkit-animation: lds-pacman-3 1s linear infinite; + animation: lds-pacman-3 1.5s linear infinite; +} +.app-loading .lds-pacman > div:nth-child(1) div:nth-child(1) { + -webkit-animation-delay: -0.67s; + animation-delay: -1s; +} +.app-loading .lds-pacman > div:nth-child(1) div:nth-child(2) { + -webkit-animation-delay: -0.33s; + animation-delay: -0.5s; +} +.app-loading .lds-pacman > div:nth-child(1) div:nth-child(3) { + -webkit-animation-delay: 0s; + animation-delay: 0s; +} diff --git a/src/main/webapp/content/images/jhipster_family_member_0.svg b/src/main/webapp/content/images/jhipster_family_member_0.svg new file mode 100644 index 00000000..d6df83ce --- /dev/null +++ b/src/main/webapp/content/images/jhipster_family_member_0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/content/images/jhipster_family_member_0_head-192.png b/src/main/webapp/content/images/jhipster_family_member_0_head-192.png new file mode 100644 index 0000000000000000000000000000000000000000..6d90ab36d37914257d5f3d0356e7895ccc0596f2 GIT binary patch literal 13439 zcmV-_G=R&AP)S)Xu>3qwpPk>)6^Ij;VFv^&VkMTL%;=aePQ4 z5`uaK1hoq1!G|E?@HWhL3~fzd#~BAoY!V-&^spH$fY;%B5U!A^im;t4x*G~&b%b}} z3{b`b*#V^0VNb`>Ly>~It3F>0w3dmX_6p(HY>Uf>uoWm$Dms8P4*my|;{5(bj;+qY z^UEN}Ys4Sws1ysP)r#)M0=Dt9MEnx6^%FpmB3s4-CFJW32(oUt6P|`w;01UT7Q^Mp z=L6T++G@ua&zR6e_`dSeDGb{vubu!QUIqW}Zs^dVB{ubj4QmCVR97g+cj_@G-!jZqfrBp1M zX(RY+{kqOcph$8K5GQ?4JU<1$fEXQJgdt+^x0WIJE#&-lnE2-U)d7Boc~R#ovI9sx zbvffgmR^vYz;~-Tc@gvZu7-TEV7h_S#}GYDEOn}&`KjA6w3R{0b{>sV$kr}NYI`Y5Jnp(yBz%oS?V;^q^4CkKmGSEAmE8EOJ4_+Y{my5DQM)Zjlg&e1SNCy zpVwLAS<38fDqNcP*CcV|S8=TzF}Jf46{X^6-+d8QmnjfQ8^N=FOl}$6z0E}<1Kd=R z_L#%E8}gHKJ&g9~R7Fgu_>AiZVjXi2Ci$z#y+BzEfp{4c88q={z3Q zq4Q-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x||50xnUCNdV5C5M-P8EONy)1Ux~{w*-?OA5aw{;a9xsQd1J^tkgbxZ(tb#y+p0ggmd2Dq8ID zoU+#KJ8iSk;@d8fn|6}vlAZY_?1__j+P}`_{k&Z@XO6iq#96Hva z<(D*a#4@ALXz|}@cb)vC)p^ppCR?CIXY}-`^{x@Q$~G=ln5TJS-3*JXoI#?Qt)~cQ zD{DDK%f#{;W~i`~8Y-=1AezJrUwL{zPUAQQxbU0^5Jj#85?HDvx4vpu-BxPrbA0x*vw(98>-a?T02-gft~ hEv+4g0}=rH_#8+*>4<@Isi6P>002ovPDHLkV1kewk>daW literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_0_head-256.png b/src/main/webapp/content/images/jhipster_family_member_0_head-256.png new file mode 100644 index 0000000000000000000000000000000000000000..8e99bfe66d5a0e4831fcdc4031c1a57ba9b9cb1a GIT binary patch literal 7037 zcmZ{pWl&ttvcS(S?oO}}+-)HwI151&+$Fd}kgyOO77f7(A!u+7ZUGWxaSsrj;O_3W zkN>@OU)>Myb#>4Dx_hRp=hW2saLy++6?r^tDr^7%@DvqfGynkfh#&wH<#BQ-)zbn1 z@PV3=mh7V&Wn~;|s+D7*{C}&ta=NL~f2VT)wKCi6O`)A;zK!~0D$i22%-N{eK_}Nr zrPN8U3TEzar1uz4Hs;a!s9UCDXXZYjSE<6CDM^KLr7iG_6++N$RkRz_t0fCTsXr8n3mHhswH z@hKigcBkL$uix%0JY1bU+}|US$cwR`)s@xl5l#ywkw;BQ*J~4&2`!JET+Q|EH>W+q z*+BW;?C|Z~{m#zr%#Hjs9-hIW zk>0+cM>jYu>a@F%o}Rv~y}RM(W92MQpU~u#jH{zv0|SGTwyfj!tUqIu$H&Ll?WxD@ z{}eoF%k)TTd^{R7yj$X9cTiF}68TUY==|7i>zB~m+nep#iP7r9%ZrQ0$fMle-u`WG z{5S6{&K_^AUtL@@e)77yx_S&=UteEdUJe$2ySg|RmsWpNNf}KsDYZwClG9!q=zMs1 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RaqN`GVDu0|Tx=GQ=WN!N+jDa}erF8}${n1Vby zmjV%3x;K~LSjJ~4*AnB8T_Fp^zRuo#k|t5ZaH~xB_UePnaKOR3?Qdk7Yuz8smKRNC z)aidN^C^L(fhr9K4CS0WKL!)q*G8RxRaOs{t2$f03|5yYe#}P#XXRFuL;fQ!?f23z zJAYnyIZCYVVvG$zsyBOF=ukzZpR28!ad1OeVr&zuuOGODM5RGly|cj4)3*AE%iwqt zT1E#}&dEfBb4Pr;-H*X7{OAXM5eqW)p|+*n4qex|hD#2cQxhi>WoBafSB9u1%DN$= zx^gC?;OPi)sk#Je3HSC*lU}K%vF&jeik>QwWVs+4L#Xc}E9%9a4Llp5)Z2}MPLa=T zS$_=|m#k8&fg7XI(RVN*LX#0 jMG_Z}cyl+Lc}tcs2-}uPdLV!Ns{kmqZ}n+E+4U^Css literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_0_head-384.png b/src/main/webapp/content/images/jhipster_family_member_0_head-384.png new file mode 100644 index 0000000000000000000000000000000000000000..c7ca46022548477085d9c10966c94131e7290df6 GIT binary patch literal 10350 zcma*N1yEhF7B;$ZcP~z%xJz*kZbc4Gai>6W*Hhfx-Mz(&7S{sB3KXY6ao2;MpL_3{ zd2i;;ym^`A+uvGQSy{;>lSyVrsjJFkp}#=~002u-K}G`r;2{4gs0go`6f)U30D%9e z{y|IjRV;TkjyF^-worM^CI7|$@&9iuvQmFFC^G+0YNb~BNweBPr@_sv*3qEc23+f? zTjyfb;BN6h4<(i=1tyAJ!M4M3uG858E9DXE)iFKc_HBVylW9I%bqSaKg*U?`*Mr3^ zzGnSVj=%H2T=eE$^c5VmWgK^AH+UG0C3*ZQ3EOQ>Is1`w)?0AcQ?&b|c&n?pysF+M zvr{v^Pd%>RHog0%KYy^PGAOszIJqaTsAZw8OfqsvJYq;GW-z_9Y4&^NWJ|^UV19SF zeS2MvaQKL9^pHl%PnFpI^Pc?6k;>cOKkol6-XHHg-<-cZKp!8Uw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{zvs>I z&$gj+oev#D1`#ErfNea1&k6b84>MNoMB6s9@&N>)vN?9|kVhb}nNU8)29Hhd0{yO_Q__bG)1d8neJw0)7A91#;wk$sFP}ycLL~s7b$eI*c2>9@E*4?6A+TOwS z6$psFJ;HEYlKAR_ebabES}F6(a3biy?yDmV&zBtG7D3gF7t*G1zMI)Wg zS)$Me_|dZossovIt2_61lGT-!>&xiIUPRF1qy(wmEgtS~Bi-(IZRbTiXBc#4hwo_3 ztD^*GeHts?amqjh$nR+fbcufG#f?jlG8Hp}`Vm#9ei^Cu;bH|YxIsJGo{!F$wu+Q9 zS1V~7yPuo(-tDb);o|T9-mKYmSh@T2u-{Y)+e(+JCcknwzL3G{LyYFBywFGYrf+3!+L4Dr6y5HDpYYSkkKqt5S6mCNFYEmF%drtX&QC&_REsFgMqO zeD9b;LK<@?kA<1yN;c!Eo*6lpeev4J%~VPG7~OglZS?4|pmZM_y{XTWc7>yc&BiC4 h{Lz0_X%cSmKYhY^<%_+&y8Y)8&{Wk^sZ+9z{D087eAoa0 literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_1.svg b/src/main/webapp/content/images/jhipster_family_member_1.svg new file mode 100644 index 00000000..e3a0f3db --- /dev/null +++ b/src/main/webapp/content/images/jhipster_family_member_1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/content/images/jhipster_family_member_1_head-192.png b/src/main/webapp/content/images/jhipster_family_member_1_head-192.png new file mode 100644 index 0000000000000000000000000000000000000000..ac5f2a00ac809809f7e48628d79e04849ebad98b GIT binary patch literal 7046 zcma)hbxa(2TuSR38PG)x6jcqC)C~R2wG~tiWEJ%! z<#bgw44=_bOWR#vGr&+yLrFW{RH?v9p~_aS(N4D6PNvmCPEf%(SF2C^gtC)Z5Ezu;BbBv%NgbLAmaudcEb_w$DZ#fi^u6 zj!hqw+uXIsOCg6_8~^@Z{{4NpF)>tY@@6DE`fy=#tG5M-L{8Kd4JLXmwpMK}FCv=i z`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(H(ltArtNn&$*9^c#)ISy0%vionNq}I1 zIWT2O;u1IbVnjhIg;&*7W;4(JqMmo~7?-F*oYd>mYyJo=a&sQ)x1w?bbWupHhZ6^d zUlmFK;0wY@fMIGS8dL$@3VJ6PR|fIW4f^?JYa*xVM4dieeSy)*eNGG2u$vaLy4J+R zBGCQ~uZ{bFtSDCYH#TuO=`wC|wnJ;t5^*uhskpUGMW@IC_1t+f!nQ#9D$H_REyD$e@D(k0a*X!PqNhUq#pT zUhMr-$mb9FB+7*S9+oBKHOfb)u2rX}{*0Dqi`nY}8wwLDt8r1IW5t<|YEmwVL-j5m zQ7nfpCm8+-`N$OSyM%w)BG47EM!+|LMSnV20uqDIn!%|t3xl#(Wg&KlP9mYTM;ljE zu|SQ^P1N-6J27Jm?a5op&*qS(D1nO^L0bbs}DE^w|oyNKgX%O!QnKbpHn3~ z1lex%`mq(G3UNTRrApT{R@ISW@|f)BFEB~qCvVq1E-(EWv;*#}W2tL<1M?ML^e`OB znBp;K7yxmjF}!LKL=lw$G_z*=0OUzie0~5YY5Lb}t)<-I^--Vs(at^N74bAz>vs8W z;0q@d$oqFR?@n4!9|lFEgL1X{N5?qomm#&m$Vor zid_FFj?%^WorJ>>3MvTKP*!dN%D~^gL>w~6N0G7>Qsi1dnvW!S_2rE9+jvUybJCl| zuFKF2q!G+CY$oLl39&6XlZvtjIlHES>x8z`XeTlBkXKhYZ%%ofZploWe@FhwT(_J-)F;s5$HBp5 zb(+x$AAi`%9lw(LD^CHy_-6;5$MGH(#*k_+Qx7mk0Z{-Nxm(+OKHQ=xoYKRI#*vS2FT^+eeizxrj>C&SKswF=m&VWENkB`-zMM>FS2mKpH}fJLUUX0&qU S!t<8`Kvhvo0VZc1_WuB}nB+SE literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_1_head-256.png b/src/main/webapp/content/images/jhipster_family_member_1_head-256.png new file mode 100644 index 0000000000000000000000000000000000000000..443822e8ea1f8db01adc11f33e8685fb14b997dc G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Z^#j3i1=b0=d$(QTMkh61qw(32H*uKORbNd^pp9qvLOZzR-2v9#f!DQ)zXf(jN() zsimov#=LGSWzT_J#5#5D;|}p^yM6+9JEpm8oL1z!t(UqVu~l_#JNpU4T9~5gOHlk_ zD(>x1a_pd2@=gZ6E$KB0V{1Q|f-cNNU8*O}g`z?1+C*n7jn3OK5Dstn+zV!-m+m3f z%4mU9*C;>+NsYV>x>~29qu?-d%n-dAeiZ;iwJ7d9<&o7I<>TzzYCh4)T~FV-S+Dez zk!kB&#_E5{#x}27wNn!VLg_!zniKP?E)b$Mi7{3Bq6H>p6_lQ}=l$M`zSR=;!duQ! zHAvk?lP!igB67hH$f0vJN9+Ce_LX>NlqN|{6pXr2SOw@A!*Ty2Fj5?SY@a@|D83;S z%jzsciS=cv%xv+L`F%`-uuZ*y!D8e;kp9JT@k(VIt82K^ur)nrRT)?fjBfB##7=1LiPtKON zjRjP9962!8?PM{jHSl79JQRfYu}~k54)shFgomDlPCqt{dQyy#k~|5d3O-RtV2~6j zfzw!@RP{$OKtnD7R$^=Vj8{WX# z2mq&9{2)2^TA#Gnqg_Hbh(#rfEC=L4@MU9E^oqI^M2qjubgu2yRM^XqI>urT~{p3ID(d@9n+EEEB?+w`&LVhmuoQ*YH>Jf-|P*J zZR29;58g@DmJAd%*);hSn$h!)(H?B*E%crtZtBI45!Zy#54Ma%i^6x62XimL<+=~T zx_uVj0kZk3*mA^vAW6{9yqg}|jmqzJf{5u(llF!A)^2_)DV!2g;;~jSYWk6F4NbGg zhmyJTR-&`KNJWdbN%F7cvb}u!Fix+j>bNAvQ5Pi=C7BPR9i0^SN-wrg?(X6k1qB5& zy%3JOihdGwS!@|XZF42vWaG;D_4Yz5yEkXTPoG(%qLJH2Z{|8dGz_I`U literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_1_head-384.png b/src/main/webapp/content/images/jhipster_family_member_1_head-384.png new file mode 100644 index 0000000000000000000000000000000000000000..4a5e9fe4775b79347fcf33c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_*1o33yQvm%^aYI3iuO* zz?b^*6Ny(K9R9f+)Gqc2zo?B zWg~bK{)CtN7Q>}`mb-=?vTeFp8b#($k_;IENqjGWR<7F$cWFMt=<@b#_=tmU@0gMa zNS45Z@AO-o#vREaUle0=(eRr(AaKWQza%(zN@3XjD%t?h#?e7#hu;r}W@ICKx3qpF zVmg{SBu-<(irDm~0%-!5&i<`|QhC~g;f$KxnN1k2Fr2F~t;zp6G`SNJ7EFLE7wx(1Za1ggKuT>DBHMSZ+{LU1Mjncz%8^ zHgT2dxY=|eX|g7^(4amd|CW0C#Dt{>HosHIY%Eje$Y#?jKWJ#+w?BQ$_v54fZ5l>M zf9*^X`L5RQlP^%q;JM%3 z(C>LXg-(xFiAeTkxgf8rS;N5RY;z!&D%_NuLJHKsBF99-Z=0Ew>;J&A^YI=N$7sMW zC}{Dq{qgbfw@_-NSD?q^AIqh?)c0<$ha{BTUt)yjn~0FZ#&(z=C~-tsZ$n$F;9vjc O0c0c;#cM>30{;*Cash(? literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_1_head-512.png b/src/main/webapp/content/images/jhipster_family_member_1_head-512.png new file mode 100644 index 0000000000000000000000000000000000000000..66c625c10626011b5e142ce32ca009cbaea5f0bb GIT binary patch literal 16456 zcmZ{LbyQVB*Y~*rTsj14xO7Oj{PwuO_k(Q3JvYL^KhVebVe`+YJ zy)xBNQZ+;<>&qzU>8tBm>gzZe>G~RLB$%n@SSgpnu)(N63NsPNY>(sR^<#;V)K(@s<4vsmSS)erLy2BGvy_9draHlplBmV zQSYGC7G#T#aQ>R;)8eVy`pR^)AbAa4|7UjtgTY*!9{-*jo329*Wkoc(Xl@UqhtX|$ z@yPg>?xD|Z)4~HADoWOuma6jJz7Bd({`U3!_()?xj+Pj$96RpL_RiAmjJJ)6y{^Q! zj+Tjm-kBfYJE}|alOmgo^SbLQP-zLHyBE%REchRUD6&2kBsb$Fy;u9c)r5z%Gs*{@7}^!*U;bQwbA4m+=i=hep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=H&hrh>`eB!zciQEK$p5Jvdx_TPU2r4C8%Dpk#r2dK@1f;h5Hm*%q(y+5E4$N9RSxycMY}TVUr!JSWN(x@8>coKw5bV9CyTQwlKIf zpUAXx9n~f=6?`OLB_*lL12NL{niQh?qYkuXrvR}W>sc(CSUXY_mbn6(^Q zLb^URJd^$H@;XV5BHaBcwDQUh;&rzbs1I3`9bEb6PkKywz*)%@$axH7bHh~=Z4(lb z{gfOov9U5Z02U-x5<)alV|=Z_cjdBNEs`_i{RGiBW-kO}IHWLUgsG)?@@pswESewqVZC)ZqV z9Les=?-*|Ovrf#E?;?tHQ&KWdjqr{h(AtWck|pGFb3=0)qb+q@k+z#U^vN+=d(Ict z3*TS0H1WYex-*t|zh9WydU)7xPb=uXrO=t=4m@W3!2G@51v|2HQ$o9enn1LKA2)2u z&a3H2BC%<8bk|p4?yAl0Y~hF7S^jMO{K2R-lq2nCFOCk_3OQ3iR1Woo;UC{ zdMxY0th>C6Lln)jmdNjM`+JWz9CTL}jWld1l0OsZXy*OdboC%`()Qj4hcwV}%ew)U zeat**>aYDjJ0`{^&7FRSi%-ZP1Tcc*pR359d1zoJ>!qdhuh=8ZG0w{6Ve{EZFQrY59C xrFGP>?a3AXFD%5NS@3oKzDr^wyc&8-Dfrf%MrHo~XOjD(rmU^>QNbqSe*iW|Ij#Tz literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_2.svg b/src/main/webapp/content/images/jhipster_family_member_2.svg new file mode 100644 index 00000000..51c6a5a9 --- /dev/null +++ b/src/main/webapp/content/images/jhipster_family_member_2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/content/images/jhipster_family_member_2_head-192.png b/src/main/webapp/content/images/jhipster_family_member_2_head-192.png new file mode 100644 index 0000000000000000000000000000000000000000..24baf78ce8326c3c2756f10ebed90829d0bddf30 GIT binary patch literal 5423 zcmZ{oby(Bg+rYmYJ!;fw8AvHLLU829=n)&GAP)@b?hpk=Dvbz8OGz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S>xr&gns0=&oP&pD X%hVz6s@WHxK!C2Mp+=25A@Y9!nF9~R literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_2_head-256.png b/src/main/webapp/content/images/jhipster_family_member_2_head-256.png new file mode 100644 index 0000000000000000000000000000000000000000..7b25f52f93d109da2df18f8442ef2104a6e14b8f GIT binary patch literal 6687 zcmbVQ2QZw`xBqroc2|k8?CQPux>#j(qL+vgtP+GM5k1PMi(VojL<=brB}zynETRO7 z9ug%>5CoA#5N)4-n|W{M&AgfS&6#`7ch2vgd+u+(d*{3NmW7!C9g+R8}#hU(gu|6R27tkg72G<7YNuv)5W zy82pXn%WlXc+)csUe`)n&q`a@QbWfIi!;J$npmr8=^0pS>s#v@+UQ-lXkcvnFEKRv zhk@6>q@sR7Nm)x;PDMgYTtt9hfSVnMH&ezL$SbIEq3K!AQLr;ovoRq!P)Hs&l#;4} zl$0Dl3yq}$yEq3OJq@hfTS^nCzK+nOMZo$&?SoRQVt4uNLeo#_2D`-;j;frePcAR#8UHG_h_?~b(=iFR5PN=I z<%}44dHJyv{j;IZuznOx}N!zFXmNdboGG`+dJTlH;Fs`e!}f&Bq_jynL9S(0j*k_o3Ta{l`o1 z&xY>n>(f%faj>(7hK8Qa=*;u!)2E+5e;y83>E3$lmR#i=TA>qg|M;OJHs)3NO^3}Z zsvC9+zaL%P3Dx=)Z?M76wn5Ldfx&DEaBk^}?dF(m%JGw%-9kAq^GbpfEG*L~rZ22) z%`7M@Cc1nU#xZ)vBQ)lPsN6IU*OH;sM?v8q%&019HLSL^rTT?_c8(Bv^>k@v7o0wc z4slOSxm5FFqKR*~eN5`5aCe+;C{F9TSDs=(mHdqwnb3NVOVRe>wE{O=dxfRVVq0as z3Q~2PpQ&33;*8Hek7IhoS)1S#f7WjBb2=;I4Kz)@s)}Ay)B4H7{#jLGgM)2@6|*VC z^+Q8!TTWo}Yzi{`TcSK0oNNPH@=aP;Zq65{XA6KFY-MH*FslVMtsRno%{?K=aMBC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=sO+lck9 zm*mspIryz_yp1$?jCH8?BXEwtgetN5)8V%VHO=?_+=B-)x4j~G!C67kY(0NB9!k45 zYr5iVSEV00Dd%%ZcD*p{3{=H6Jm~kQFqaP)E9D#A%Gak%x@G8wfG#|1^J)R0&#ArVs#Q?9D0G4fapzA76}9~5?c$0HVPZcr zcRM#x>b3`2Kq2Hn%2ayJwLjuo2z^py{`#-geLv_>N_y9Z=f}I}D9@J3#q6~g4vRu? zPheHmn=45s`3A@|$8+hU^;Ofvu8yQBN2`;^t&{I@;^N}P{YWV0rDw}m0rqhm4 zmE~t*kc!O#yuajg#OT=dV?QU=t)yz`*SL`QQhm7rJ< zfSc2Us8x!<%}%?$(k3ZyBa&U46+i!?(OYK3Ps524WibsYq5`~LKb2eCh|bDCNOpIk zFXrCsrj>(T8l77DW-K*dW_ZmY{(axd^NQoFt0sxnp5Yy5P6&FJIf?@@+W>Ua;-iV4++HkNAiB1kUB9+%bD|gSEGp%u30`~4PVRJM%+YC;1mXrrS;HM!qYli5a|YGZ0sjOpn7B3Kg@1w)(;3x y!w`2PZFekY^= literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_2_head-384.png b/src/main/webapp/content/images/jhipster_family_member_2_head-384.png new file mode 100644 index 0000000000000000000000000000000000000000..e89e120c2f015ccb140678ffff8ccbacb1ae1f20 GIT binary patch literal 9682 zcma)iXH*nH)9!47Wl77Dk+9^PbKE5d$&v-h3W!LOEDRYWBS;V>BO;PSM1m{`ihx8F zMZ$_mmW+U;i|>2yckYk-5Rx zVHeDOX6-ZpfF76{T4-M^W#!b=@h0lp<`=4}VXCTO_CKnod4WxFT4qLgLlp%)PSaFL z%}7J%imJM)GT!(C;5ALu)Qz>Y&2Se$(_BrGFDm?3l(HL&)~F3 z|ES22m6q%hEt!N(h(lbZcY2LpNQta>f#U6l5gElTxgqlfcDdOZE`BBaDuyDa-kKSs zxRe3)~dF{26s;j5f_INsqc@|b5Mw)49?lD^W2?mCDtk^^bj0G*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 z&n?aZ6d6!W`+)&FrCL8`*k6)2dN$(ulaQytelWa8V&rr>Li#vKBLeKP`#aKLEOiIM* z(_1^6U1`&9_Ed3pm^W20R_S%zOj*`-wJ#E1 z1e_SSHLB%e+22Av{78fpq<+yA4hGuEj7KNR4q-}D0x{fDSMSyn4~>cu3sQ;irpdC& zg^1*rwzFq)W4 z{TESU3hKQcynBACy?#Nzz#YCO35@JowA)bVRYcRXwUJ zmGZ>a?s=tx=##)N>l#I=W|wbnbg2ft{m87vtYLi?a^9ICCBpn(fljG_N^E=`p7Yy{ zjzx8Nn4aRQ_12x!yJ}N=;&=zp*pUJ6P@V4djOj+fXn&uG@Hp+O|_J>Jg8In=2eR;$v_p%Dkq1?zBiX*6v7sqdc!}*sewOMRm{ld{48CL-WmKaP z7SLqfEl2iJ`GUdU$ip(Fy&ae#K9T|75MY?>3@ zn|QpdHMd^p48y$-^F?Z)^JAfQxnwUsOQTG<5J>eV8lUDM$P7;w;@9grbi}Ae&qfne zg&`|dvtDEfgvhc$ldO8PxJSP!^^5 zASZ{#q}-VM)#tcC4J^Kh5cGAJD^4eP->!{_>672p=NlU8b~&qF3+s%48Sqw!=fdBz V^p!DYUi_f~=xZBm)oD1z{4Y|2cgz3) literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_2_head-512.png b/src/main/webapp/content/images/jhipster_family_member_2_head-512.png new file mode 100644 index 0000000000000000000000000000000000000000..3c0e6cb9af31e2e46d9e9b6c8cec99c0d4c5e5c6 GIT binary patch literal 10514 zcma)icQjnl_wT(^jBb?ZWr*m#ccXVk?+givUV|jU=pqs|f&@blJwy^E#1Ji_1yLdx z(nLh>!93sJTfbM)rdDz1CT0-E$9PZa_oHP6+@2jgg_Q6#zgkAOs+X zUJUOm`3EnUKNwRRy$e=OUQI&>qp5?@F|bxen_rN+w&ew>X<^j0EHrg2(YlrwS_>r| zw4SAgj+M5)^#xFrQ$y=n>FHwBv@BFL|I0;1M_o<-La3#0tz&3oU}C3l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;U`0`Tv$TF)_s5w!zbpT3U6#M{+?KLpzEZJ zerk71=@N=mkviDUB4lOzzGl1c6hE?bc|fzLhAOw*mOJUVWI1*AHlG-u?fdHOz8aBR zW+j2+976@lO6W$v(hMupNimFROumppx}$zSa-Xg3=Cv_t6d`ck=| zf#3+hfr_Tcxg_GmY=ThNu|UC$);9-#@xr%8+wm=guq%uR1lq5(bobaqGcXhO-JVYj zm-rPrE7bKGS1;t{!t(MZv`U*F|G}IBWpsJ6#xSN)R5B$1a_&!4d18cS?9Kcf+H?%|R@2@>2~Ia=j!ynYTcHd; zZWUYwSC@+U+?^DVXi&m&0xb~L!TOY?-)Iy=>%1)(EKE7#s4&Q#{f~W)vL8vEe?Cf3dqbXaK49TuA%FZ-DslD55 z7|2RlhHs{n6=b30ls%F}dT(nCQ+vO8{7K04=P%Pom1A4JPJt$fv`hCdb_6SweY{-! z&a7QWBS0pU3GsrpuO!`*11iw&<8CM9c9$gIWRc;SRymS+-dnhu^^G&hhL?jv@RKyR zNLY>;d{u@?mN||L-vYU7D8+vKmNif~Fnxs@9Rxqg%{rgmw17WJ<3K1uF_e3ig} z(SVX^{hG*#FZ{j`l<5fVFl$mNGw0J6XIltZLh7tdka$9siX{ zNHzZ_4}_8fZH3)et!ieW&IS45c3J~&FWnFxZ=Ik-YrG5WJHs0+87dj7{lFX|4u&v> z<3Y4AW<7K0xnIO3g)B1QIeHr!z-zt0%A7@($>gB8-kBk9`rewD0_Inuw_$(d$h7VY zsZmg2fryI|7L1~vZ0To>-frGXE(K`_ns7?412-ww= sR75AY@?DpsgV*T?8yX4Is*)e$TS~PkGnSXVxa|cP>6z;`Xk+952Y^KLq5uE@ literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_3.svg b/src/main/webapp/content/images/jhipster_family_member_3.svg new file mode 100644 index 00000000..cc0d01f1 --- /dev/null +++ b/src/main/webapp/content/images/jhipster_family_member_3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/content/images/jhipster_family_member_3_head-192.png b/src/main/webapp/content/images/jhipster_family_member_3_head-192.png new file mode 100644 index 0000000000000000000000000000000000000000..b1e4fb3c8654570012950a3c888f11cb92c23bdd GIT binary patch literal 6148 zcmX9?byyT#7vEiKfu&PA1Q9_{DGBLrMClFz0i}^#xGtI{Ae>CR4$78EFu+6l0FtIR&y4#K=GJKPfaC2Az;5Iy*i7$J$w0QlZAg7#)oMIR^0Gzyuhh(_{1` z28rHZ*P_R;&Q6Xo`j~Nie6oR2LmyytHvU%gRC)-ricUNau7pE8Jr#q<{_ji}$VtAML_d>zlN5{wfF2(0Jcjs4E zh^>94xIUSvo`Zb5qlNKtVc-D@y|s^;d;5@1i6pmsSu?SJKgwp#?Ahtg+6i*WA$OG9 zr(^HC;n~sQ?Aq?w()LMr)>M|qlrmN07!q1B{E8Q!y6+%T`zM@GAZ21n%Qqn z<3YuJ`-QRDh8m(4{IeQ#tnczD&9b&jlLFp*yMO*@6>O~GA`jpOOv8#ZVd?QdV)spz zYBgUVHR&+b+0bQP)p&4J9lR5$x-LhAP^0-*Q&lQVrM6x(p|YJ1GwiqQ1$V=Aj%q_^ zBC0R$lZA`(+ljB3*ndG^2SZclRxmb+ZogR{4xSI0vvO!OD zGz3FE3|{4f@V{1Es%QESscxt>3qIy?!3{~z8ZZw;j}lTTZ^k1qbSu%&}QE~eAaG| z+Ag0KJ4biML$tsGA_o&S}pHmUHTt)pGk9}2LqJFR3w@?SKN}#@%2vm z&=gj;vN{-Gl;(wK&kU(2QhkE3^E{!F^Jexll{wBbh)&rMFO8s`sD{K9o6_$|m!>O- z2UMt=jocC~fLe~WC)NN%)gBkr^l-;Q*a>JT!`ufnrT3q-697v2Vinox2qSjhY=iv8 zf#2fuw_G?JWZSHRM6;q_2|*YM?cZ32Mdhyb6A)gu{Ka)2zQM17vpK)FAuwL~q$b-& z{;~p}9*}3KFA^)tv2j6%169O+;~Oh~@}xSnt_|;!)yrrvUt{-kHLa85R}|b0mz221RTip1I?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0z%U_{@E|zS8E640ucOQS6(T!_qEcRJ*NAct(M>B-7G2zjC38>(ug+ zx@nnIRqdv_udf~odN#LejI;o}GnZ0{&62jeC*+M}8%B_*ErqbT)$+3aiUtz_e|Yu6 z&$!ca36plwMt0{$hlrUe(}k&t`B7^@=ly#;P0so5KKu_hn8Qtgvb=^|g^YRd{{U3N B<5&Oy literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_3_head-256.png b/src/main/webapp/content/images/jhipster_family_member_3_head-256.png new file mode 100644 index 0000000000000000000000000000000000000000..aa058c7a0aba654a4991c8bbd5d3e2d32517acd1 GIT binary patch literal 8028 zcmXwebyQT}_x8*%zyL!x12Qxs(gKo058bJB3Wzi#APglT-KBK5QX)u+fP#Q@58d4% z{P=v|^{%zoy?Z}r-{;w9pS{jMH&RPOi4dO-9{>OlDkJ4}007{F3j{#09$rqBMtT4M z=u}HhPvIfl+E`yup`2HvzBt-CKRY=;JH7b-cD%l@yR)PCp?6W0>f~^L4oR`5O~0lM zJ3l$PI6HZ;hwveP6hSyDL-@ZBPnOha&QFie54In29>D)c^*qe-6yQsP`f5f&BPeQhxWsaV`3MedeLm2k@vN>TGT1fp%T%KQ_PeQM-==DzSY> z6>lxF24|Hij_S}4gfbC5f*xh}_xIarnp@P==jZ2F7iSV-KOUqnuC8t_&+o1;?(Z(o zcGpLx@OCowVag=C2S-=;_s@d5u8ww>H+Om8b@IBEo_1z$>>j!o{XLodr5@iuZNfge zygM|%)%a&wFZtKOV8^_Z^kJ#TUvZrK`0Go^o7J80dcUVZE}&*3l~~the-M2*LT)S)tf*QNMb)eg3YNRPSJS`L|+I z-+WAnrEQ35f}61+N>f5qnBRn>OPP5Qfx}>v=j;5gDav8bL}7UP&)43@u#bT?VYYFF zk&(HfK8bD*{a<}JM-AGCgFC84AAb%${u;TT>F_W%Yr2ecNb+?fmI*oHaaqER7aXff zq$AP<8#)YI0m>^Hv`6J{XOzg+R46yhpB&`69yf$7s!<=+1UyXdUY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YxtlDnU)-{Hm({Ta&E zl|=UG(GQJ?__hS{va?3~wDx__RD#MSjqkw1Mzw0)eI=S;9$ilSo{bbcKBT5|QS*wX zC6tT+8AaQQ0u&;}QK*^W1*TedK3Y8fCV;sBm!yo2bEE{ijpZFHn8=0#t*`JK+lstt zt9%c8EY5`o>+$jIP)m8Hz5HjU-@#mB85S9{VTavu7xCoG@=_9I<>dxcyu_V_!0xM+ z$3b6XLc8w$Tk1ozN$_;?T6E{RFl9I9qrzAGiMEujXq3Fg+ur zcuM@p5atHA{pb1*@!g$O3gqw0)g|DAEzEG?fe7aOWf+z=)H}!Tzw~1c8lUu$nBON| z?eBHFVfNA`LO4}}&*u>%EF)9xdg%?Rnms#M_=msds!knhY{-MmpD=Re-w29Zvd6#X za;i2yy>DQ!B(VWji2y_@qZPw8`P&cOgJoK|{V; I)*|@-0J^?0w*UYD literal 0 HcmV?d00001 diff --git a/src/main/webapp/content/images/jhipster_family_member_3_head-384.png b/src/main/webapp/content/images/jhipster_family_member_3_head-384.png new file mode 100644 index 0000000000000000000000000000000000000000..1d10bd5da3d4d417aedfd3bf2e8515eff092c506 GIT binary patch literal 11998 zcmaL7WmFtZv@Sd|FgU?og1ZI{?(PsQxCAG-%is<{f;++8AxLlw?(XhR(D``JxqrSN z_x7sp+V%9VZB@0aSFMgvQIbYQB18fJ0I0Gu5^4Yd5c1!R0P~I{5=h1X0HAXf1r5pf z=9((;x*X1$EcScZQzia?lqG4*4F$YqX{>!!qCHijT@|8D1-$+DE-Hj;a@aGXsPAP- z3S&o^a8VLtPW;3FB3p|1E7F)VA}H_8+5dRn36xn8)CCFjcfJ3^gYqtCNeXjS=6{8t z?0q3S{Kj!$%zU0~v8RN87O8vP6nb43xT}D78lrwx1G#PpKD7C~|CR2t*!?2k=>(#1 z=q0tUMR{55a$Os6Rpoo+EOL=$cNS-OS>}0F;r*`hrZw)iEB$_X==JIl`uqTeLf;d@xrgdhfa4OG#!ohHakAH-LbxcWiBJ}A@Q~U@QZ(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+// Typography: +// Font, line-height, and color for body text, headings, and more. + +$font-size-base: 1rem; + +$dropdown-link-hover-color: white; +$dropdown-link-hover-bg: #343a40; diff --git a/src/main/webapp/content/scss/global.scss b/src/main/webapp/content/scss/global.scss new file mode 100644 index 00000000..f9391746 --- /dev/null +++ b/src/main/webapp/content/scss/global.scss @@ -0,0 +1,239 @@ +@import 'bootstrap-variables'; +@import 'bootstrap/scss/functions'; +@import 'bootstrap/scss/variables'; + +/* ============================================================== +Bootstrap tweaks +===============================================================*/ + +body, +h1, +h2, +h3, +h4 { + font-weight: 300; +} + +/* Increase contrast of links to get 100% on Lighthouse Accessability Audit. Override this color if you want to change the link color, or use a Bootswatch theme */ +a { + color: #533f03; + font-weight: bold; +} + +a:hover { + color: #533f03; +} + +/* override hover color for dropdown-item forced by bootstrap to all a:not([href]):not([tabindex]) elements in _reboot.scss */ +a:not([href]):not([tabindex]):hover.dropdown-item { + color: $dropdown-link-hover-color; +} + +/* override .dropdown-item.active background-color on hover */ +.dropdown-item.active:hover { + background-color: mix($dropdown-link-hover-bg, $dropdown-link-active-bg, 50%); +} + +a:hover { + /* make sure browsers use the pointer cursor for anchors, even with no href */ + cursor: pointer; +} + +.dropdown-item:hover { + color: $dropdown-link-hover-color; +} + +/* ========================================================================== +Browser Upgrade Prompt +========================================================================== */ +.browserupgrade { + margin: 0.2em 0; + background: #ccc; + color: #000; + padding: 0.2em 0; +} + +/* ========================================================================== +Generic styles +========================================================================== */ + +/* Error highlight on input fields */ +.ng-valid[required], +.ng-valid.required { + border-left: 5px solid green; +} + +.ng-invalid:not(form) { + border-left: 5px solid red; +} + +/* other generic styles */ + +.jh-card { + padding: 1.5%; + margin-top: 20px; + border: none; +} + +.error { + color: white; + background-color: red; +} + +.pad { + padding: 10px; +} + +.w-40 { + width: 40% !important; +} + +.w-60 { + width: 60% !important; +} + +.break { + white-space: normal; + word-break: break-all; +} + +.form-control { + background-color: #fff; +} + +.readonly { + background-color: #eee; + opacity: 1; +} + +.footer { + border-top: 1px solid rgba(0, 0, 0, 0.125); +} + +.hand, +[jhisortby] { + cursor: pointer; +} + +/* ========================================================================== +Custom alerts for notification +========================================================================== */ +.alerts { + .alert { + text-overflow: ellipsis; + pre { + background: none; + border: none; + font: inherit; + color: inherit; + padding: 0; + margin: 0; + } + .popover pre { + font-size: 10px; + } + } + .jhi-toast { + position: fixed; + width: 100%; + &.left { + left: 5px; + } + &.right { + right: 5px; + } + &.top { + top: 55px; + } + &.bottom { + bottom: 55px; + } + } +} + +@media screen and (min-width: 480px) { + .alerts .jhi-toast { + width: 50%; + } +} + +/* ========================================================================== +entity list page css +========================================================================== */ + +.table-entities thead th .d-flex > * { + margin: auto 0; +} + +/* ========================================================================== +entity detail page css +========================================================================== */ +.row-md.jh-entity-details { + display: grid; + grid-template-columns: auto 1fr; + column-gap: 10px; + line-height: 1.5; +} + +@media screen and (min-width: 768px) { + .row-md.jh-entity-details > { + dt { + float: left; + overflow: hidden; + clear: left; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; + padding: 0.5em 0; + } + dd { + border-bottom: 1px solid #eee; + padding: 0.5em 0; + margin-left: 0; + } + } +} + +/* ========================================================================== +ui bootstrap tweaks +========================================================================== */ +.nav, +.pagination, +.carousel, +.panel-title a { + cursor: pointer; +} + +.thread-dump-modal-lock { + max-width: 450px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.dropdown-menu { + padding-left: 0px; +} + +/* ========================================================================== +angular-cli removes postcss-rtl processed inline css, processed rules must be added here instead +========================================================================== */ +/* page-ribbon.component.scss */ +.ribbon { + left: -3.5em; + -moz-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); +} + +/* navbar.component.scss */ +.navbar { + ul.navbar-nav { + .nav-item { + margin-left: 0.5em; + } + } +} +/* jhipster-needle-scss-add-main JHipster will add new css style */ diff --git a/src/main/webapp/content/scss/vendor.scss b/src/main/webapp/content/scss/vendor.scss new file mode 100644 index 00000000..acf2df29 --- /dev/null +++ b/src/main/webapp/content/scss/vendor.scss @@ -0,0 +1,12 @@ +/* after changing this file run 'npm run webapp:build' */ + +/*************************** +put Sass variables here: +eg $input-color: red; +****************************/ +// Override Bootstrap variables +@import 'bootstrap-variables'; +// Import Bootstrap source files from node_modules +@import 'bootstrap/scss/bootstrap'; + +/* jhipster-needle-scss-add-vendor JHipster will add new css style */ diff --git a/src/main/webapp/declarations.d.ts b/src/main/webapp/declarations.d.ts new file mode 100644 index 00000000..dfaf5b53 --- /dev/null +++ b/src/main/webapp/declarations.d.ts @@ -0,0 +1 @@ +declare const SERVER_API_URL: string; diff --git a/src/main/webapp/favicon.ico b/src/main/webapp/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..4179874f53b3c3b0ba9e2a401412f814ab6296bd GIT binary patch literal 1574 zcmV+>2HE+EP)000H;Nkl9r4a2J+cS@yzSX6E!^*k!$-D-4;C?DsI4Z2te8^PT@c z=RfD)VMK(b3{GnU7K#)Bt&t+2HBtn$Mv8#eNDUS>&~)z8>N1c(q8rNd{sPjn1MM2QHDA^sG2W;HKsEVpi{%G+8~m}54A zpq~8zXet!#9Gbj-*V8>RHQ@_Oa=ck5fDynmyijTRbXS$xsGFssxLtW3`my8G-!>%7 zn;n<%&U37xG-qc+$&NL}Ic8(r8P8{L>@pz`5wF~FxA(hl3{Q#@0mJ|T!>orWW&$y= zwZ)lV?q9=mOj&=001@Fo=j2<5|CsUovve~87<4?ht)^g4)54xHIM_fH6g9vTH~{$6e3n@@!>>0A((rb8tLK5s#V0 zMm+wn&))p*T>q|hCGR#@SL9}ZK#Tw|V#*5$4}y`?UCz_p4!1wNkO1l#@e&9G#+VYs zEG&vW!|wTsW3iPFM8p#vgQq%eFRm{7prxk1*aAS&G~ti@^w-GQ9%mpd0W^=8Nrc@q z?FmG(O?n~{0D#CgKIQg@lG#5`2LTaLZtu09`*&npbwOKeU4B;jv8(n!ddI?|{BT~F zzml*h^*el9D=mnp(SK|%RkC6{JP5dS>;C22j@;ZLQI=y-twP>a1a%F2w^mvhW1N!C zItRzq%;^AP-WFw5y#6R|j(8Qh9Dt}K_u4&+p(d6Y7r5u2fMIuVYB~yqz^KPR<_)T> zVUZCQ2K>q>IWj4>kGx1p%HD(9OEwu=KUlGU-EF%U2| z6%r-`VTl%YwkK@x(j4)7%q9E||Yz*Vu z-KgXDY^wP1l~c9KAAp;kIku<%ZR4V3H)gcci^L zxuYQ7iwPXJy}sz+_S%}ltQn(|jw6aU+5iCCMBw-}`=x=2s3a#J7eur?P5(n%lfW3; zzojxs0t_(d_}%ME4>VV=%*&kl@mY?4RLIPDrr1%QWBTmX>U-{zUphzI`^LkPoTQkY z^?7=MW3nvEM4$hB{Zyw7M3hi@DgLIIc}3Z#J)0`_Hm$Unjj=qofc>keP`dJ1mj{ks?4R(3kPwGF$MQ4Nw$&8u zY$#b@Zsp>+MfD;l;gbiMsB74J{+6r5=JEI=N`S;Tl0o2i)aJImRADmkV6kfzMM5Yl zb`4GR+C9Ed)T9?ySkhM)WtCdZJg310p5oRacks5uH}YWG9~KQdzS3&iP?nXGu8&`< zB@h73l>ryEsGJ*5{SM`E0!tK2{&F`(Kx?E3XpIyBt&t+2HBtn$Mv8#eND + + + + + artemis-benchmarking + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ + + + + diff --git a/src/main/webapp/main.ts b/src/main/webapp/main.ts new file mode 100644 index 00000000..73c3a0e8 --- /dev/null +++ b/src/main/webapp/main.ts @@ -0,0 +1 @@ +import('./bootstrap').catch(err => console.error(err)); diff --git a/src/main/webapp/manifest.webapp b/src/main/webapp/manifest.webapp new file mode 100644 index 00000000..18f25768 --- /dev/null +++ b/src/main/webapp/manifest.webapp @@ -0,0 +1,31 @@ +{ + "name": "ArtemisBenchmarking", + "short_name": "ArtemisBenchmarking", + "icons": [ + { + "src": "./content/images/jhipster_family_member_3_head-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "./content/images/jhipster_family_member_3_head-256.png", + "sizes": "256x256", + "type": "image/png" + }, + { + "src": "./content/images/jhipster_family_member_3_head-384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "./content/images/jhipster_family_member_3_head-512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#000000", + "background_color": "#e0e0e0", + "start_url": ".", + "display": "standalone", + "orientation": "portrait" +} diff --git a/src/main/webapp/robots.txt b/src/main/webapp/robots.txt new file mode 100644 index 00000000..361ff600 --- /dev/null +++ b/src/main/webapp/robots.txt @@ -0,0 +1,10 @@ +# robotstxt.org/ + +User-agent: * +Disallow: /api/account +Disallow: /api/account/change-password +Disallow: /api/account/sessions +Disallow: /api/logs/ +Disallow: /api/users/ +Disallow: /management/ +Disallow: /v3/api-docs/ diff --git a/src/main/webapp/sockjs-client.polyfill.ts b/src/main/webapp/sockjs-client.polyfill.ts new file mode 100644 index 00000000..6776c0b7 --- /dev/null +++ b/src/main/webapp/sockjs-client.polyfill.ts @@ -0,0 +1 @@ +(window as any).global = window; diff --git a/src/main/webapp/swagger-ui/dist/images/throbber.gif b/src/main/webapp/swagger-ui/dist/images/throbber.gif new file mode 100644 index 0000000000000000000000000000000000000000..06393889242fb3ea9e0205fa84369ec7bb66d15a GIT binary patch literal 9257 zcmd^^X;@R|x`tQg5wbE8AV3mAn1TjmQ&en2CK8~ENEH<+P_)pZ24y2E+7O0>K^a6u zQ3;5MiU^7p6*M3qDk!2=YEcHMQ>nzEYP;R`e2C@r+U+?#XaC*&gKPcB#k$`o&;7mu zYNhYYXe|Uo84#4ZIko#rcU5K8*yFL{qT47O&^5fZH$ zVZ@%(l~vVHjnm;H@KL8@r%yUHoo;rbHI_4lIH(_nsTT>S2`DFOD~uCb9_dF4`#QgI zy7ldMcLs+A_s%|e1pRPrbX-tpeNP!9(IpMFTce`t_5U%lP99z%&i6`1d~ zWeM!Rxc50<+d$e^9LT`?B+aMK~apR zHm?q;p<7{wN2g|I^a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KB_8V)G@H)UZFF8$tXT z@^raW#Hq4OJGFL2Aye|HU&_NL%dYans6?ltqEBz`Q|m=@Zh4=-p2r;}q(Nbsk$fUI zP|(Ns2>MDvZi1H7<55frlQn#%?`WY3g`+fRuC#UJx%#d!zxEu3=}zF514S=6f@?~$ zeuSB=6E7r3ya|; z@K7M3VBrls6c{M*M_{AB_fVjgQ|F(FuK(@=1eWeVMSpLglllqV6Rg-L_46;?^IskS z)x6|SR1^gGl6amWjkb1dX}^8DumNXNmhsfxKA#;bBBIZE@0gma5yQY(FX>|N~Y^mgq`xc zdxOf6r{9u#_e0gV3(fdBTdV2Sc4SN5ZmP?cB4?KR + + + + artemis-benchmarking - Swagger UI + + + + + + + +
+ + + + + + + + diff --git a/src/test/java/de/tum/cit/ase/IntegrationTest.java b/src/test/java/de/tum/cit/ase/IntegrationTest.java new file mode 100644 index 00000000..e88c4b0a --- /dev/null +++ b/src/test/java/de/tum/cit/ase/IntegrationTest.java @@ -0,0 +1,21 @@ +package de.tum.cit.ase; + +import de.tum.cit.ase.config.AsyncSyncConfiguration; +import de.tum.cit.ase.config.EmbeddedSQL; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; + +/** + * Base composite annotation for integration tests. + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@SpringBootTest(classes = { ArtemisBenchmarkingApp.class, AsyncSyncConfiguration.class }) +@EmbeddedSQL +@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) +public @interface IntegrationTest { +} diff --git a/src/test/java/de/tum/cit/ase/TechnicalStructureTest.java b/src/test/java/de/tum/cit/ase/TechnicalStructureTest.java new file mode 100644 index 00000000..34ffcd2a --- /dev/null +++ b/src/test/java/de/tum/cit/ase/TechnicalStructureTest.java @@ -0,0 +1,38 @@ +package de.tum.cit.ase; + +import static com.tngtech.archunit.base.DescribedPredicate.alwaysTrue; +import static com.tngtech.archunit.core.domain.JavaClass.Predicates.belongToAnyOf; +import static com.tngtech.archunit.library.Architectures.layeredArchitecture; + +import com.tngtech.archunit.core.importer.ImportOption.DoNotIncludeTests; +import com.tngtech.archunit.junit.AnalyzeClasses; +import com.tngtech.archunit.junit.ArchTest; +import com.tngtech.archunit.lang.ArchRule; + +@AnalyzeClasses(packagesOf = ArtemisBenchmarkingApp.class, importOptions = DoNotIncludeTests.class) +class TechnicalStructureTest { + + // prettier-ignore + @ArchTest + static final ArchRule respectsTechnicalArchitectureLayers = layeredArchitecture() + .consideringAllDependencies() + .layer("Config").definedBy("..config..") + .layer("Web").definedBy("..web..") + .optionalLayer("Service").definedBy("..service..") + .layer("Security").definedBy("..security..") + .optionalLayer("Persistence").definedBy("..repository..") + .layer("Domain").definedBy("..domain..") + + .whereLayer("Config").mayNotBeAccessedByAnyLayer() + .whereLayer("Web").mayOnlyBeAccessedByLayers("Config") + .whereLayer("Service").mayOnlyBeAccessedByLayers("Web", "Config") + .whereLayer("Security").mayOnlyBeAccessedByLayers("Config", "Service", "Web") + .whereLayer("Persistence").mayOnlyBeAccessedByLayers("Service", "Security", "Web", "Config") + .whereLayer("Domain").mayOnlyBeAccessedByLayers("Persistence", "Service", "Security", "Web", "Config") + + .ignoreDependency(belongToAnyOf(ArtemisBenchmarkingApp.class), alwaysTrue()) + .ignoreDependency(alwaysTrue(), belongToAnyOf( + de.tum.cit.ase.config.Constants.class, + de.tum.cit.ase.config.ApplicationProperties.class + )); +} diff --git a/src/test/java/de/tum/cit/ase/config/AsyncSyncConfiguration.java b/src/test/java/de/tum/cit/ase/config/AsyncSyncConfiguration.java new file mode 100644 index 00000000..8d472839 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/AsyncSyncConfiguration.java @@ -0,0 +1,15 @@ +package de.tum.cit.ase.config; + +import java.util.concurrent.Executor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.task.SyncTaskExecutor; + +@Configuration +public class AsyncSyncConfiguration { + + @Bean(name = "taskExecutor") + public Executor taskExecutor() { + return new SyncTaskExecutor(); + } +} diff --git a/src/test/java/de/tum/cit/ase/config/EmbeddedSQL.java b/src/test/java/de/tum/cit/ase/config/EmbeddedSQL.java new file mode 100644 index 00000000..af568499 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/EmbeddedSQL.java @@ -0,0 +1,11 @@ +package de.tum.cit.ase.config; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface EmbeddedSQL { +} diff --git a/src/test/java/de/tum/cit/ase/config/MysqlTestContainer.java b/src/test/java/de/tum/cit/ase/config/MysqlTestContainer.java new file mode 100644 index 00000000..0ce0a341 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/MysqlTestContainer.java @@ -0,0 +1,42 @@ +package de.tum.cit.ase.config; + +import java.util.Collections; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.JdbcDatabaseContainer; +import org.testcontainers.containers.MySQLContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; + +public class MysqlTestContainer implements SqlTestContainer { + + private static final Logger log = LoggerFactory.getLogger(MysqlTestContainer.class); + + private MySQLContainer mysqlContainer; + + @Override + public void destroy() { + if (null != mysqlContainer && mysqlContainer.isRunning()) { + mysqlContainer.stop(); + } + } + + @Override + public void afterPropertiesSet() { + if (null == mysqlContainer) { + mysqlContainer = + new MySQLContainer<>("mysql:8.2.0") + .withDatabaseName("artemis-benchmarking") + .withTmpFs(Collections.singletonMap("/testtmpfs", "rw")) + .withLogConsumer(new Slf4jLogConsumer(log)) + .withReuse(true); + } + if (!mysqlContainer.isRunning()) { + mysqlContainer.start(); + } + } + + @Override + public JdbcDatabaseContainer getTestContainer() { + return mysqlContainer; + } +} diff --git a/src/test/java/de/tum/cit/ase/config/SpringBootTestClassOrderer.java b/src/test/java/de/tum/cit/ase/config/SpringBootTestClassOrderer.java new file mode 100644 index 00000000..b8363433 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/SpringBootTestClassOrderer.java @@ -0,0 +1,22 @@ +package de.tum.cit.ase.config; + +import de.tum.cit.ase.IntegrationTest; +import java.util.Comparator; +import org.junit.jupiter.api.ClassDescriptor; +import org.junit.jupiter.api.ClassOrderer; +import org.junit.jupiter.api.ClassOrdererContext; + +public class SpringBootTestClassOrderer implements ClassOrderer { + + @Override + public void orderClasses(ClassOrdererContext context) { + context.getClassDescriptors().sort(Comparator.comparingInt(SpringBootTestClassOrderer::getOrder)); + } + + private static int getOrder(ClassDescriptor classDescriptor) { + if (classDescriptor.findAnnotation(IntegrationTest.class).isPresent()) { + return 2; + } + return 1; + } +} diff --git a/src/test/java/de/tum/cit/ase/config/SqlTestContainer.java b/src/test/java/de/tum/cit/ase/config/SqlTestContainer.java new file mode 100644 index 00000000..047184cb --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/SqlTestContainer.java @@ -0,0 +1,9 @@ +package de.tum.cit.ase.config; + +import org.springframework.beans.factory.DisposableBean; +import org.springframework.beans.factory.InitializingBean; +import org.testcontainers.containers.JdbcDatabaseContainer; + +public interface SqlTestContainer extends InitializingBean, DisposableBean { + JdbcDatabaseContainer getTestContainer(); +} diff --git a/src/test/java/de/tum/cit/ase/config/SqlTestContainersSpringContextCustomizerFactory.java b/src/test/java/de/tum/cit/ase/config/SqlTestContainersSpringContextCustomizerFactory.java new file mode 100644 index 00000000..6f9acaf0 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/SqlTestContainersSpringContextCustomizerFactory.java @@ -0,0 +1,52 @@ +package de.tum.cit.ase.config; + +import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.boot.test.util.TestPropertyValues; +import org.springframework.core.annotation.AnnotatedElementUtils; +import org.springframework.test.context.ContextConfigurationAttributes; +import org.springframework.test.context.ContextCustomizer; +import org.springframework.test.context.ContextCustomizerFactory; + +public class SqlTestContainersSpringContextCustomizerFactory implements ContextCustomizerFactory { + + private Logger log = LoggerFactory.getLogger(SqlTestContainersSpringContextCustomizerFactory.class); + + private static SqlTestContainer prodTestContainer; + + @Override + public ContextCustomizer createContextCustomizer(Class testClass, List configAttributes) { + return (context, mergedConfig) -> { + ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); + TestPropertyValues testValues = TestPropertyValues.empty(); + EmbeddedSQL sqlAnnotation = AnnotatedElementUtils.findMergedAnnotation(testClass, EmbeddedSQL.class); + if (null != sqlAnnotation) { + log.debug("detected the EmbeddedSQL annotation on class {}", testClass.getName()); + log.info("Warming up the sql database"); + if (null == prodTestContainer) { + try { + Class containerClass = (Class) Class.forName( + this.getClass().getPackageName() + ".MysqlTestContainer" + ); + prodTestContainer = beanFactory.createBean(containerClass); + beanFactory.registerSingleton(containerClass.getName(), prodTestContainer); + // ((DefaultListableBeanFactory)beanFactory).registerDisposableBean(containerClass.getName(), prodTestContainer); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + } + testValues = + testValues.and( + "spring.datasource.url=" + + prodTestContainer.getTestContainer().getJdbcUrl() + + "?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true" + ); + testValues = testValues.and("spring.datasource.username=" + prodTestContainer.getTestContainer().getUsername()); + testValues = testValues.and("spring.datasource.password=" + prodTestContainer.getTestContainer().getPassword()); + } + testValues.applyTo(context); + }; + } +} diff --git a/src/test/java/de/tum/cit/ase/config/StaticResourcesWebConfigurerTest.java b/src/test/java/de/tum/cit/ase/config/StaticResourcesWebConfigurerTest.java new file mode 100644 index 00000000..ab2862de --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/StaticResourcesWebConfigurerTest.java @@ -0,0 +1,76 @@ +package de.tum.cit.ase.config; + +import static de.tum.cit.ase.config.StaticResourcesWebConfiguration.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.*; + +import java.util.concurrent.TimeUnit; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.http.CacheControl; +import org.springframework.mock.web.MockServletContext; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import tech.jhipster.config.JHipsterDefaults; +import tech.jhipster.config.JHipsterProperties; + +class StaticResourcesWebConfigurerTest { + + public static final int MAX_AGE_TEST = 5; + public StaticResourcesWebConfiguration staticResourcesWebConfiguration; + private ResourceHandlerRegistry resourceHandlerRegistry; + private MockServletContext servletContext; + private WebApplicationContext applicationContext; + private JHipsterProperties props; + + @BeforeEach + void setUp() { + servletContext = spy(new MockServletContext()); + applicationContext = mock(WebApplicationContext.class); + resourceHandlerRegistry = spy(new ResourceHandlerRegistry(applicationContext, servletContext)); + props = new JHipsterProperties(); + staticResourcesWebConfiguration = spy(new StaticResourcesWebConfiguration(props)); + } + + @Test + void shouldAppendResourceHandlerAndInitializeIt() { + staticResourcesWebConfiguration.addResourceHandlers(resourceHandlerRegistry); + + verify(resourceHandlerRegistry, times(1)).addResourceHandler(RESOURCE_PATHS); + verify(staticResourcesWebConfiguration, times(1)).initializeResourceHandler(any(ResourceHandlerRegistration.class)); + for (String testingPath : RESOURCE_PATHS) { + assertThat(resourceHandlerRegistry.hasMappingForPattern(testingPath)).isTrue(); + } + } + + @Test + void shouldInitializeResourceHandlerWithCacheControlAndLocations() { + CacheControl ccExpected = CacheControl.maxAge(5, TimeUnit.DAYS).cachePublic(); + when(staticResourcesWebConfiguration.getCacheControl()).thenReturn(ccExpected); + ResourceHandlerRegistration resourceHandlerRegistration = spy(new ResourceHandlerRegistration(RESOURCE_PATHS)); + + staticResourcesWebConfiguration.initializeResourceHandler(resourceHandlerRegistration); + + verify(staticResourcesWebConfiguration, times(1)).getCacheControl(); + verify(resourceHandlerRegistration, times(1)).setCacheControl(ccExpected); + verify(resourceHandlerRegistration, times(1)).addResourceLocations(RESOURCE_LOCATIONS); + } + + @Test + void shouldCreateCacheControlBasedOnJhipsterDefaultProperties() { + CacheControl cacheExpected = CacheControl.maxAge(JHipsterDefaults.Http.Cache.timeToLiveInDays, TimeUnit.DAYS).cachePublic(); + assertThat(staticResourcesWebConfiguration.getCacheControl()) + .extracting(CacheControl::getHeaderValue) + .isEqualTo(cacheExpected.getHeaderValue()); + } + + @Test + void shouldCreateCacheControlWithSpecificConfigurationInProperties() { + props.getHttp().getCache().setTimeToLiveInDays(MAX_AGE_TEST); + CacheControl cacheExpected = CacheControl.maxAge(MAX_AGE_TEST, TimeUnit.DAYS).cachePublic(); + assertThat(staticResourcesWebConfiguration.getCacheControl()) + .extracting(CacheControl::getHeaderValue) + .isEqualTo(cacheExpected.getHeaderValue()); + } +} diff --git a/src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java b/src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java new file mode 100644 index 00000000..7d07406c --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java @@ -0,0 +1,132 @@ +package de.tum.cit.ase.config; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.*; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import jakarta.servlet.*; +import java.io.File; +import java.util.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.mock.env.MockEnvironment; +import org.springframework.mock.web.MockServletContext; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import tech.jhipster.config.JHipsterConstants; +import tech.jhipster.config.JHipsterProperties; + +/** + * Unit tests for the {@link WebConfigurer} class. + */ +class WebConfigurerTest { + + private WebConfigurer webConfigurer; + + private MockServletContext servletContext; + + private MockEnvironment env; + + private JHipsterProperties props; + + @BeforeEach + public void setup() { + servletContext = spy(new MockServletContext()); + doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class)); + doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class)); + + env = new MockEnvironment(); + props = new JHipsterProperties(); + + webConfigurer = new WebConfigurer(env, props); + } + + @Test + void shouldCustomizeServletContainer() { + env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); + UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); + webConfigurer.customize(container); + assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg"); + assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html"); + assertThat(container.getMimeMappings().get("json")).isEqualTo("application/json"); + if (container.getDocumentRoot() != null) { + assertThat(container.getDocumentRoot()).isEqualTo(new File("build/resources/main/static/")); + } + } + + @Test + void shouldCorsFilterOnApiPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("other.domain.com")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); + + mockMvc + .perform( + options("/api/test-cors") + .header(HttpHeaders.ORIGIN, "other.domain.com") + .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST") + ) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")) + .andExpect(header().string(HttpHeaders.VARY, "Origin")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); + + mockMvc + .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")); + } + + @Test + void shouldCorsFilterOnOtherPath() throws Exception { + props.getCors().setAllowedOrigins(Collections.singletonList("*")); + props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); + props.getCors().setAllowedHeaders(Collections.singletonList("*")); + props.getCors().setMaxAge(1800L); + props.getCors().setAllowCredentials(true); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); + + mockMvc + .perform(get("/test/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + void shouldCorsFilterDeactivatedForNullAllowedOrigins() throws Exception { + props.getCors().setAllowedOrigins(null); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); + + mockMvc + .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } + + @Test + void shouldCorsFilterDeactivatedForEmptyAllowedOrigins() throws Exception { + props.getCors().setAllowedOrigins(new ArrayList<>()); + + MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); + + mockMvc + .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) + .andExpect(status().isOk()) + .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); + } +} diff --git a/src/test/java/de/tum/cit/ase/config/WebConfigurerTestController.java b/src/test/java/de/tum/cit/ase/config/WebConfigurerTestController.java new file mode 100644 index 00000000..899dd1b2 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/WebConfigurerTestController.java @@ -0,0 +1,14 @@ +package de.tum.cit.ase.config; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class WebConfigurerTestController { + + @GetMapping("/api/test-cors") + public void testCorsOnApiPath() {} + + @GetMapping("/test/test-cors") + public void testCorsOnOtherPath() {} +} diff --git a/src/test/java/de/tum/cit/ase/config/timezone/HibernateTimeZoneIT.java b/src/test/java/de/tum/cit/ase/config/timezone/HibernateTimeZoneIT.java new file mode 100644 index 00000000..c4f9d349 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/config/timezone/HibernateTimeZoneIT.java @@ -0,0 +1,172 @@ +package de.tum.cit.ase.config.timezone; + +import static java.lang.String.format; +import static org.assertj.core.api.Assertions.assertThat; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.repository.timezone.DateTimeWrapper; +import de.tum.cit.ase.repository.timezone.DateTimeWrapperRepository; +import java.time.*; +import java.time.format.DateTimeFormatter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.support.rowset.SqlRowSet; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for verifying the behavior of Hibernate in the context of storing various date and time types across different databases. + * The tests focus on ensuring that the stored values are correctly transformed and stored according to the configured timezone. + * Timezone is environment specific, and can be adjusted according to your needs. + * + * For more context, refer to: + * - GitHub Issue: https://github.com/jhipster/generator-jhipster/issues/22579 + * - Pull Request: https://github.com/jhipster/generator-jhipster/pull/22946 + */ +@IntegrationTest +class HibernateTimeZoneIT { + + @Autowired + private DateTimeWrapperRepository dateTimeWrapperRepository; + + @Autowired + private JdbcTemplate jdbcTemplate; + + @Value("${spring.jpa.properties.hibernate.jdbc.time_zone:UTC}") + private String zoneId; + + private DateTimeWrapper dateTimeWrapper; + private DateTimeFormatter dateTimeFormatter; + private DateTimeFormatter timeFormatter; + private DateTimeFormatter offsetTimeFormatter; + private DateTimeFormatter dateFormatter; + + @BeforeEach + public void setup() { + dateTimeWrapper = new DateTimeWrapper(); + dateTimeWrapper.setInstant(Instant.parse("2014-11-12T05:10:00.0Z")); + dateTimeWrapper.setLocalDateTime(LocalDateTime.parse("2014-11-12T07:20:00.0")); + dateTimeWrapper.setOffsetDateTime(OffsetDateTime.parse("2011-12-14T08:30:00.0Z")); + dateTimeWrapper.setZonedDateTime(ZonedDateTime.parse("2011-12-14T08:40:00.0Z")); + dateTimeWrapper.setLocalTime(LocalTime.parse("14:50:00")); + dateTimeWrapper.setOffsetTime(OffsetTime.parse("14:00:00+02:00")); + dateTimeWrapper.setLocalDate(LocalDate.parse("2016-09-10")); + + dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S").withZone(ZoneId.of(zoneId)); + timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss").withZone(ZoneId.of(zoneId)); + offsetTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + } + + @Test + @Transactional + void storeInstantWithZoneIdConfigShouldBeStoredOnConfiguredTimeZone() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("instant", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeFormatter.format(dateTimeWrapper.getInstant()); + + assertThatValueFromSqlRowSetIsEqualToExpectedValue(resultSet, expectedValue); + } + + @Test + @Transactional + void storeLocalDateTimeWithZoneIdConfigShouldBeStoredOnConfiguredTimeZone() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("local_date_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper.getLocalDateTime().atZone(ZoneId.systemDefault()).format(dateTimeFormatter); + + assertThatValueFromSqlRowSetIsEqualToExpectedValue(resultSet, expectedValue); + } + + @Test + @Transactional + void storeOffsetDateTimeWithZoneIdConfigShouldBeStoredOnConfiguredTimeZone() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("offset_date_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper.getOffsetDateTime().format(dateTimeFormatter); + + assertThatValueFromSqlRowSetIsEqualToExpectedValue(resultSet, expectedValue); + } + + @Test + @Transactional + void storeZoneDateTimeWithZoneIdConfigShouldBeStoredOnConfiguredTimeZone() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("zoned_date_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper.getZonedDateTime().format(dateTimeFormatter); + + assertThatValueFromSqlRowSetIsEqualToExpectedValue(resultSet, expectedValue); + } + + @Test + @Transactional + void storeLocalTimeWithZoneIdConfigShouldBeStoredOnConfiguredTimeZoneAccordingToHis1stJan1970Value() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("local_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper + .getLocalTime() + .atDate(LocalDate.of(1970, Month.JANUARY, 1)) + .atZone(ZoneId.systemDefault()) + .format(timeFormatter); + + assertThatValueFromSqlRowSetIsEqualToExpectedValue(resultSet, expectedValue); + } + + @Test + @Transactional + void storeOffsetTimeWithZoneIdConfigShouldBeStoredOnConfiguredTimeZoneAccordingToHis1stJan1970Value() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("offset_time", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper + .getOffsetTime() + // Convert to configured timezone + .withOffsetSameInstant(ZoneId.of(zoneId).getRules().getOffset(Instant.now())) + // Normalize to System TimeZone. + // TODO this behavior looks a bug, refer to https://github.com/jhipster/generator-jhipster/issues/22579. + .withOffsetSameLocal(OffsetDateTime.ofInstant(Instant.EPOCH, ZoneId.systemDefault()).getOffset()) + // Convert the normalized value to configured timezone + .withOffsetSameInstant(ZoneId.of(zoneId).getRules().getOffset(Instant.EPOCH)) + .format(offsetTimeFormatter); + + assertThatValueFromSqlRowSetIsEqualToExpectedValue(resultSet, expectedValue); + } + + @Test + @Transactional + void storeLocalDateWithZoneIdConfigShouldBeStoredWithoutTransformation() { + dateTimeWrapperRepository.saveAndFlush(dateTimeWrapper); + + String request = generateSqlRequest("local_date", dateTimeWrapper.getId()); + SqlRowSet resultSet = jdbcTemplate.queryForRowSet(request); + String expectedValue = dateTimeWrapper.getLocalDate().format(dateFormatter); + + assertThatValueFromSqlRowSetIsEqualToExpectedValue(resultSet, expectedValue); + } + + private String generateSqlRequest(String fieldName, long id) { + return format("SELECT %s FROM jhi_date_time_wrapper where id=%d", fieldName, id); + } + + private void assertThatValueFromSqlRowSetIsEqualToExpectedValue(SqlRowSet sqlRowSet, String expectedValue) { + while (sqlRowSet.next()) { + String dbValue = sqlRowSet.getString(1); + + assertThat(dbValue).isNotNull(); + assertThat(dbValue).isEqualTo(expectedValue); + } + } +} diff --git a/src/test/java/de/tum/cit/ase/management/SecurityMetersServiceTests.java b/src/test/java/de/tum/cit/ase/management/SecurityMetersServiceTests.java new file mode 100644 index 00000000..45eca590 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/management/SecurityMetersServiceTests.java @@ -0,0 +1,70 @@ +package de.tum.cit.ase.management; + +import static org.assertj.core.api.Assertions.assertThat; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import java.util.Collection; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +class SecurityMetersServiceTests { + + private static final String INVALID_TOKENS_METER_EXPECTED_NAME = "security.authentication.invalid-tokens"; + + private MeterRegistry meterRegistry; + + private SecurityMetersService securityMetersService; + + @BeforeEach + public void setup() { + meterRegistry = new SimpleMeterRegistry(); + + securityMetersService = new SecurityMetersService(meterRegistry); + } + + @Test + void testInvalidTokensCountersByCauseAreCreated() { + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).counter(); + + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter(); + + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter(); + + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter(); + + meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter(); + + Collection counters = meterRegistry.find(INVALID_TOKENS_METER_EXPECTED_NAME).counters(); + + assertThat(counters).hasSize(4); + } + + @Test + void testCountMethodsShouldBeBoundToCorrectCounters() { + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isZero(); + + securityMetersService.trackTokenExpired(); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isEqualTo(1); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isZero(); + + securityMetersService.trackTokenUnsupported(); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "unsupported").counter().count()).isEqualTo(1); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isZero(); + + securityMetersService.trackTokenInvalidSignature(); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()).isEqualTo(1); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isZero(); + + securityMetersService.trackTokenMalformed(); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isEqualTo(1); + } +} diff --git a/src/test/java/de/tum/cit/ase/repository/timezone/DateTimeWrapper.java b/src/test/java/de/tum/cit/ase/repository/timezone/DateTimeWrapper.java new file mode 100644 index 00000000..0fe17386 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/repository/timezone/DateTimeWrapper.java @@ -0,0 +1,132 @@ +package de.tum.cit.ase.repository.timezone; + +import jakarta.persistence.*; +import java.io.Serializable; +import java.time.*; +import java.util.Objects; + +@Entity +@Table(name = "jhi_date_time_wrapper") +public class DateTimeWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "instant") + private Instant instant; + + @Column(name = "local_date_time") + private LocalDateTime localDateTime; + + @Column(name = "offset_date_time") + private OffsetDateTime offsetDateTime; + + @Column(name = "zoned_date_time") + private ZonedDateTime zonedDateTime; + + @Column(name = "local_time") + private LocalTime localTime; + + @Column(name = "offset_time") + private OffsetTime offsetTime; + + @Column(name = "local_date") + private LocalDate localDate; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Instant getInstant() { + return instant; + } + + public void setInstant(Instant instant) { + this.instant = instant; + } + + public LocalDateTime getLocalDateTime() { + return localDateTime; + } + + public void setLocalDateTime(LocalDateTime localDateTime) { + this.localDateTime = localDateTime; + } + + public OffsetDateTime getOffsetDateTime() { + return offsetDateTime; + } + + public void setOffsetDateTime(OffsetDateTime offsetDateTime) { + this.offsetDateTime = offsetDateTime; + } + + public ZonedDateTime getZonedDateTime() { + return zonedDateTime; + } + + public void setZonedDateTime(ZonedDateTime zonedDateTime) { + this.zonedDateTime = zonedDateTime; + } + + public LocalTime getLocalTime() { + return localTime; + } + + public void setLocalTime(LocalTime localTime) { + this.localTime = localTime; + } + + public OffsetTime getOffsetTime() { + return offsetTime; + } + + public void setOffsetTime(OffsetTime offsetTime) { + this.offsetTime = offsetTime; + } + + public LocalDate getLocalDate() { + return localDate; + } + + public void setLocalDate(LocalDate localDate) { + this.localDate = localDate; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + DateTimeWrapper dateTimeWrapper = (DateTimeWrapper) o; + return !(dateTimeWrapper.getId() == null || getId() == null) && Objects.equals(getId(), dateTimeWrapper.getId()); + } + + @Override + public int hashCode() { + return Objects.hashCode(getId()); + } + + // prettier-ignore + @Override + public String toString() { + return "TimeZoneTest{" + + "id=" + id + + ", instant=" + instant + + ", localDateTime=" + localDateTime + + ", offsetDateTime=" + offsetDateTime + + ", zonedDateTime=" + zonedDateTime + + '}'; + } +} diff --git a/src/test/java/de/tum/cit/ase/repository/timezone/DateTimeWrapperRepository.java b/src/test/java/de/tum/cit/ase/repository/timezone/DateTimeWrapperRepository.java new file mode 100644 index 00000000..462b20c3 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/repository/timezone/DateTimeWrapperRepository.java @@ -0,0 +1,10 @@ +package de.tum.cit.ase.repository.timezone; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +/** + * Spring Data JPA repository for the {@link DateTimeWrapper} entity. + */ +@Repository +public interface DateTimeWrapperRepository extends JpaRepository {} diff --git a/src/test/java/de/tum/cit/ase/security/DomainUserDetailsServiceIT.java b/src/test/java/de/tum/cit/ase/security/DomainUserDetailsServiceIT.java new file mode 100644 index 00000000..4a24b1ec --- /dev/null +++ b/src/test/java/de/tum/cit/ase/security/DomainUserDetailsServiceIT.java @@ -0,0 +1,113 @@ +package de.tum.cit.ase.security; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.UserRepository; +import java.util.Locale; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integrations tests for {@link DomainUserDetailsService}. + */ +@Transactional +@IntegrationTest +class DomainUserDetailsServiceIT { + + private static final String USER_ONE_LOGIN = "test-user-one"; + private static final String USER_ONE_EMAIL = "test-user-one@localhost"; + private static final String USER_TWO_LOGIN = "test-user-two"; + private static final String USER_TWO_EMAIL = "test-user-two@localhost"; + private static final String USER_THREE_LOGIN = "test-user-three"; + private static final String USER_THREE_EMAIL = "test-user-three@localhost"; + + @Autowired + private UserRepository userRepository; + + @Autowired + @Qualifier("userDetailsService") + private UserDetailsService domainUserDetailsService; + + @BeforeEach + public void init() { + User userOne = new User(); + userOne.setLogin(USER_ONE_LOGIN); + userOne.setPassword(RandomStringUtils.randomAlphanumeric(60)); + userOne.setActivated(true); + userOne.setEmail(USER_ONE_EMAIL); + userOne.setFirstName("userOne"); + userOne.setLastName("doe"); + userOne.setLangKey("en"); + userRepository.save(userOne); + + User userTwo = new User(); + userTwo.setLogin(USER_TWO_LOGIN); + userTwo.setPassword(RandomStringUtils.randomAlphanumeric(60)); + userTwo.setActivated(true); + userTwo.setEmail(USER_TWO_EMAIL); + userTwo.setFirstName("userTwo"); + userTwo.setLastName("doe"); + userTwo.setLangKey("en"); + userRepository.save(userTwo); + + User userThree = new User(); + userThree.setLogin(USER_THREE_LOGIN); + userThree.setPassword(RandomStringUtils.randomAlphanumeric(60)); + userThree.setActivated(false); + userThree.setEmail(USER_THREE_EMAIL); + userThree.setFirstName("userThree"); + userThree.setLastName("doe"); + userThree.setLangKey("en"); + userRepository.save(userThree); + } + + @Test + void assertThatUserCanBeFoundByLogin() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); + } + + @Test + void assertThatUserCanBeFoundByLoginIgnoreCase() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_LOGIN.toUpperCase(Locale.ENGLISH)); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); + } + + @Test + void assertThatUserCanBeFoundByEmail() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); + } + + @Test + void assertThatUserCanBeFoundByEmailIgnoreCase() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_TWO_EMAIL.toUpperCase(Locale.ENGLISH)); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_TWO_LOGIN); + } + + @Test + void assertThatEmailIsPrioritizedOverLogin() { + UserDetails userDetails = domainUserDetailsService.loadUserByUsername(USER_ONE_EMAIL); + assertThat(userDetails).isNotNull(); + assertThat(userDetails.getUsername()).isEqualTo(USER_ONE_LOGIN); + } + + @Test + void assertThatUserNotActivatedExceptionIsThrownForNotActivatedUsers() { + assertThatExceptionOfType(UserNotActivatedException.class) + .isThrownBy(() -> domainUserDetailsService.loadUserByUsername(USER_THREE_LOGIN)); + } +} diff --git a/src/test/java/de/tum/cit/ase/security/SecurityUtilsUnitTest.java b/src/test/java/de/tum/cit/ase/security/SecurityUtilsUnitTest.java new file mode 100644 index 00000000..b5d812b4 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/security/SecurityUtilsUnitTest.java @@ -0,0 +1,101 @@ +package de.tum.cit.ase.security; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Optional; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; + +/** + * Test class for the {@link SecurityUtils} utility class. + */ +class SecurityUtilsUnitTest { + + @BeforeEach + @AfterEach + void cleanup() { + SecurityContextHolder.clearContext(); + } + + @Test + void testGetCurrentUserLogin() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin")); + SecurityContextHolder.setContext(securityContext); + Optional login = SecurityUtils.getCurrentUserLogin(); + assertThat(login).contains("admin"); + } + + @Test + void testGetCurrentUserJWT() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "token")); + SecurityContextHolder.setContext(securityContext); + Optional jwt = SecurityUtils.getCurrentUserJWT(); + assertThat(jwt).contains("token"); + } + + @Test + void testIsAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("admin", "admin")); + SecurityContextHolder.setContext(securityContext); + boolean isAuthenticated = SecurityUtils.isAuthenticated(); + assertThat(isAuthenticated).isTrue(); + } + + @Test + void testAnonymousIsNotAuthenticated() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.ANONYMOUS)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("anonymous", "anonymous", authorities)); + SecurityContextHolder.setContext(securityContext); + boolean isAuthenticated = SecurityUtils.isAuthenticated(); + assertThat(isAuthenticated).isFalse(); + } + + @Test + void testHasCurrentUserThisAuthority() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities)); + SecurityContextHolder.setContext(securityContext); + + assertThat(SecurityUtils.hasCurrentUserThisAuthority(AuthoritiesConstants.USER)).isTrue(); + assertThat(SecurityUtils.hasCurrentUserThisAuthority(AuthoritiesConstants.ADMIN)).isFalse(); + } + + @Test + void testHasCurrentUserAnyOfAuthorities() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities)); + SecurityContextHolder.setContext(securityContext); + + assertThat(SecurityUtils.hasCurrentUserAnyOfAuthorities(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)).isTrue(); + assertThat(SecurityUtils.hasCurrentUserAnyOfAuthorities(AuthoritiesConstants.ANONYMOUS, AuthoritiesConstants.ADMIN)).isFalse(); + } + + @Test + void testHasCurrentUserNoneOfAuthorities() { + SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); + Collection authorities = new ArrayList<>(); + authorities.add(new SimpleGrantedAuthority(AuthoritiesConstants.USER)); + securityContext.setAuthentication(new UsernamePasswordAuthenticationToken("user", "user", authorities)); + SecurityContextHolder.setContext(securityContext); + + assertThat(SecurityUtils.hasCurrentUserNoneOfAuthorities(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN)).isFalse(); + assertThat(SecurityUtils.hasCurrentUserNoneOfAuthorities(AuthoritiesConstants.ANONYMOUS, AuthoritiesConstants.ADMIN)).isTrue(); + } +} diff --git a/src/test/java/de/tum/cit/ase/security/jwt/AuthenticationIntegrationTest.java b/src/test/java/de/tum/cit/ase/security/jwt/AuthenticationIntegrationTest.java new file mode 100644 index 00000000..ad4a6082 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/security/jwt/AuthenticationIntegrationTest.java @@ -0,0 +1,35 @@ +package de.tum.cit.ase.security.jwt; + +import de.tum.cit.ase.config.SecurityConfiguration; +import de.tum.cit.ase.config.SecurityJwtConfiguration; +import de.tum.cit.ase.config.WebConfigurer; +import de.tum.cit.ase.management.SecurityMetersService; +import de.tum.cit.ase.web.rest.AuthenticateController; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; +import tech.jhipster.config.JHipsterProperties; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@SpringBootTest( + properties = { + "jhipster.security.authentication.jwt.base64-secret=fd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8", + "jhipster.security.authentication.jwt.token-validity-in-seconds=60000", + }, + classes = { + JHipsterProperties.class, + WebConfigurer.class, + SecurityConfiguration.class, + SecurityJwtConfiguration.class, + SecurityMetersService.class, + AuthenticateController.class, + JwtAuthenticationTestUtils.class, + } +) +@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) +public @interface AuthenticationIntegrationTest { +} diff --git a/src/test/java/de/tum/cit/ase/security/jwt/JwtAuthenticationTestUtils.java b/src/test/java/de/tum/cit/ase/security/jwt/JwtAuthenticationTestUtils.java new file mode 100644 index 00000000..38cb694c --- /dev/null +++ b/src/test/java/de/tum/cit/ase/security/jwt/JwtAuthenticationTestUtils.java @@ -0,0 +1,106 @@ +package de.tum.cit.ase.security.jwt; + +import static de.tum.cit.ase.security.SecurityUtils.AUTHORITIES_KEY; +import static de.tum.cit.ase.security.SecurityUtils.JWT_ALGORITHM; + +import com.nimbusds.jose.jwk.source.ImmutableSecret; +import com.nimbusds.jose.util.Base64; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.simple.SimpleMeterRegistry; +import java.time.Instant; +import java.util.Collections; +import javax.crypto.Mac; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import org.springframework.context.annotation.Bean; +import org.springframework.security.crypto.codec.Hex; +import org.springframework.security.oauth2.jwt.JwsHeader; +import org.springframework.security.oauth2.jwt.JwtClaimsSet; +import org.springframework.security.oauth2.jwt.JwtEncoder; +import org.springframework.security.oauth2.jwt.JwtEncoderParameters; +import org.springframework.security.oauth2.jwt.NimbusJwtEncoder; +import org.springframework.web.servlet.handler.HandlerMappingIntrospector; + +public class JwtAuthenticationTestUtils { + + public static final String BEARER = "Bearer "; + + @Bean + private HandlerMappingIntrospector mvcHandlerMappingIntrospector() { + return new HandlerMappingIntrospector(); + } + + @Bean + private MeterRegistry meterRegistry() { + return new SimpleMeterRegistry(); + } + + public static String createValidToken(String jwtKey) { + return createValidTokenForUser(jwtKey, "anonymous"); + } + + public static String createValidTokenForUser(String jwtKey, String user) { + JwtEncoder encoder = jwtEncoder(jwtKey); + + var now = Instant.now(); + + JwtClaimsSet claims = JwtClaimsSet + .builder() + .issuedAt(now) + .expiresAt(now.plusSeconds(60)) + .subject(user) + .claims(customClain -> customClain.put(AUTHORITIES_KEY, Collections.singletonList("ROLE_ADMIN"))) + .build(); + + JwsHeader jwsHeader = JwsHeader.with(JWT_ALGORITHM).build(); + return encoder.encode(JwtEncoderParameters.from(jwsHeader, claims)).getTokenValue(); + } + + public static String createTokenWithDifferentSignature() { + JwtEncoder encoder = jwtEncoder("Xfd54a45s65fds737b9aafcb3412e07ed99b267f33413274720ddbb7f6c5e64e9f14075f2d7ed041592f0b7657baf8"); + + var now = Instant.now(); + var past = now.plusSeconds(60); + + JwtClaimsSet claims = JwtClaimsSet.builder().issuedAt(now).expiresAt(past).subject("anonymous").build(); + + JwsHeader jwsHeader = JwsHeader.with(JWT_ALGORITHM).build(); + return encoder.encode(JwtEncoderParameters.from(jwsHeader, claims)).getTokenValue(); + } + + public static String createExpiredToken(String jwtKey) { + JwtEncoder encoder = jwtEncoder(jwtKey); + + var now = Instant.now(); + var past = now.minusSeconds(600); + + JwtClaimsSet claims = JwtClaimsSet.builder().issuedAt(past).expiresAt(past.plusSeconds(1)).subject("anonymous").build(); + + JwsHeader jwsHeader = JwsHeader.with(JWT_ALGORITHM).build(); + return encoder.encode(JwtEncoderParameters.from(jwsHeader, claims)).getTokenValue(); + } + + public static String createInvalidToken(String jwtKey) throws Exception { + return createValidToken(jwtKey).substring(1); + } + + public static String createSignedInvalidJwt(String jwtKey) throws Exception { + return calculateHMAC("foo", jwtKey); + } + + private static JwtEncoder jwtEncoder(String jwtKey) { + return new NimbusJwtEncoder(new ImmutableSecret<>(getSecretKey(jwtKey))); + } + + private static SecretKey getSecretKey(String jwtKey) { + byte[] keyBytes = Base64.from(jwtKey).decode(); + return new SecretKeySpec(keyBytes, 0, keyBytes.length, JWT_ALGORITHM.getName()); + } + + private static String calculateHMAC(String data, String key) throws Exception { + SecretKeySpec secretKeySpec = new SecretKeySpec(Base64.from(key).decode(), "HmacSHA512"); + Mac mac = Mac.getInstance("HmacSHA512"); + mac.init(secretKeySpec); + return String.copyValueOf(Hex.encode(mac.doFinal(data.getBytes()))); + } +} diff --git a/src/test/java/de/tum/cit/ase/security/jwt/TokenAuthenticationIT.java b/src/test/java/de/tum/cit/ase/security/jwt/TokenAuthenticationIT.java new file mode 100644 index 00000000..3c9c8f60 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/security/jwt/TokenAuthenticationIT.java @@ -0,0 +1,53 @@ +package de.tum.cit.ase.security.jwt; + +import static de.tum.cit.ase.security.jwt.JwtAuthenticationTestUtils.*; +import static org.springframework.http.HttpHeaders.AUTHORIZATION; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +@AutoConfigureMockMvc +@AuthenticationIntegrationTest +class TokenAuthenticationIT { + + @Autowired + private MockMvc mvc; + + @Value("${jhipster.security.authentication.jwt.base64-secret}") + private String jwtKey; + + @Test + void testLoginWithValidToken() throws Exception { + expectOk(createValidToken(jwtKey)); + } + + @Test + void testReturnFalseWhenJWThasInvalidSignature() throws Exception { + expectUnauthorized(createTokenWithDifferentSignature()); + } + + @Test + void testReturnFalseWhenJWTisMalformed() throws Exception { + expectUnauthorized(createSignedInvalidJwt(jwtKey)); + } + + @Test + void testReturnFalseWhenJWTisExpired() throws Exception { + expectUnauthorized(createExpiredToken(jwtKey)); + } + + private void expectOk(String token) throws Exception { + mvc.perform(MockMvcRequestBuilders.get("/api/authenticate").header(AUTHORIZATION, BEARER + token)).andExpect(status().isOk()); + } + + private void expectUnauthorized(String token) throws Exception { + mvc + .perform(MockMvcRequestBuilders.get("/api/authenticate").header(AUTHORIZATION, BEARER + token)) + .andExpect(status().isUnauthorized()); + } +} diff --git a/src/test/java/de/tum/cit/ase/security/jwt/TokenAuthenticationSecurityMetersIT.java b/src/test/java/de/tum/cit/ase/security/jwt/TokenAuthenticationSecurityMetersIT.java new file mode 100644 index 00000000..510e1eed --- /dev/null +++ b/src/test/java/de/tum/cit/ase/security/jwt/TokenAuthenticationSecurityMetersIT.java @@ -0,0 +1,87 @@ +package de.tum.cit.ase.security.jwt; + +import static de.tum.cit.ase.security.jwt.JwtAuthenticationTestUtils.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.http.HttpHeaders.AUTHORIZATION; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import java.util.Collection; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +@AutoConfigureMockMvc +@AuthenticationIntegrationTest +class TokenAuthenticationSecurityMetersIT { + + private static final String INVALID_TOKENS_METER_EXPECTED_NAME = "security.authentication.invalid-tokens"; + + @Autowired + private MockMvc mvc; + + @Value("${jhipster.security.authentication.jwt.base64-secret}") + private String jwtKey; + + @Autowired + private MeterRegistry meterRegistry; + + @Test + void testValidTokenShouldNotCountAnything() throws Exception { + Collection counters = meterRegistry.find(INVALID_TOKENS_METER_EXPECTED_NAME).counters(); + + var count = aggregate(counters); + + tryToAuthenticate(createValidToken(jwtKey)); + + assertThat(aggregate(counters)).isEqualTo(count); + } + + @Test + void testTokenExpiredCount() throws Exception { + var count = meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count(); + + tryToAuthenticate(createExpiredToken(jwtKey)); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "expired").counter().count()).isEqualTo(count + 1); + } + + @Test + void testTokenSignatureInvalidCount() throws Exception { + var count = meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count(); + + tryToAuthenticate(createTokenWithDifferentSignature()); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "invalid-signature").counter().count()) + .isEqualTo(count + 1); + } + + @Test + void testTokenMalformedCount() throws Exception { + var count = meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count(); + + tryToAuthenticate(createSignedInvalidJwt(jwtKey)); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isEqualTo(count + 1); + } + + @Test + void testTokenInvalidCount() throws Exception { + var count = meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count(); + + tryToAuthenticate(createInvalidToken(jwtKey)); + + assertThat(meterRegistry.get(INVALID_TOKENS_METER_EXPECTED_NAME).tag("cause", "malformed").counter().count()).isEqualTo(count + 1); + } + + private void tryToAuthenticate(String token) throws Exception { + mvc.perform(MockMvcRequestBuilders.get("/api/authenticate").header(AUTHORIZATION, BEARER + token)); + } + + private double aggregate(Collection counters) { + return counters.stream().mapToDouble(Counter::count).sum(); + } +} diff --git a/src/test/java/de/tum/cit/ase/service/MailServiceIT.java b/src/test/java/de/tum/cit/ase/service/MailServiceIT.java new file mode 100644 index 00000000..af100a0b --- /dev/null +++ b/src/test/java/de/tum/cit/ase/service/MailServiceIT.java @@ -0,0 +1,235 @@ +package de.tum.cit.ase.service; + +import static org.assertj.core.api.Assertions.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.config.Constants; +import de.tum.cit.ase.domain.User; +import jakarta.mail.Multipart; +import jakarta.mail.Session; +import jakarta.mail.internet.MimeBodyPart; +import jakarta.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMultipart; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.net.URI; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.mail.MailSendException; +import org.springframework.mail.javamail.JavaMailSender; +import tech.jhipster.config.JHipsterProperties; + +/** + * Integration tests for {@link MailService}. + */ +@IntegrationTest +class MailServiceIT { + + private static final String[] languages = { + // jhipster-needle-i18n-language-constant - JHipster will add/remove languages in this array + }; + private static final Pattern PATTERN_LOCALE_3 = Pattern.compile("([a-z]{2})-([a-zA-Z]{4})-([a-z]{2})"); + private static final Pattern PATTERN_LOCALE_2 = Pattern.compile("([a-z]{2})-([a-z]{2})"); + + @Autowired + private JHipsterProperties jHipsterProperties; + + @MockBean + private JavaMailSender javaMailSender; + + @Captor + private ArgumentCaptor messageCaptor; + + @Autowired + private MailService mailService; + + @BeforeEach + public void setup() { + doNothing().when(javaMailSender).send(any(MimeMessage.class)); + when(javaMailSender.createMimeMessage()).thenReturn(new MimeMessage((Session) null)); + } + + @Test + void testSendEmail() throws Exception { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, false); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getSubject()).isEqualTo("testSubject"); + assertThat(message.getAllRecipients()[0]).hasToString("john.doe@example.com"); + assertThat(message.getFrom()[0]).hasToString(jHipsterProperties.getMail().getFrom()); + assertThat(message.getContent()).isInstanceOf(String.class); + assertThat(message.getContent()).hasToString("testContent"); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/plain; charset=UTF-8"); + } + + @Test + void testSendHtmlEmail() throws Exception { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, true); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getSubject()).isEqualTo("testSubject"); + assertThat(message.getAllRecipients()[0]).hasToString("john.doe@example.com"); + assertThat(message.getFrom()[0]).hasToString(jHipsterProperties.getMail().getFrom()); + assertThat(message.getContent()).isInstanceOf(String.class); + assertThat(message.getContent()).hasToString("testContent"); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + void testSendMultipartEmail() throws Exception { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", true, false); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + MimeMultipart mp = (MimeMultipart) message.getContent(); + MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) mp.getBodyPart(0).getContent()).getBodyPart(0); + ByteArrayOutputStream aos = new ByteArrayOutputStream(); + part.writeTo(aos); + assertThat(message.getSubject()).isEqualTo("testSubject"); + assertThat(message.getAllRecipients()[0]).hasToString("john.doe@example.com"); + assertThat(message.getFrom()[0]).hasToString(jHipsterProperties.getMail().getFrom()); + assertThat(message.getContent()).isInstanceOf(Multipart.class); + assertThat(aos).hasToString("\r\ntestContent"); + assertThat(part.getDataHandler().getContentType()).isEqualTo("text/plain; charset=UTF-8"); + } + + @Test + void testSendMultipartHtmlEmail() throws Exception { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", true, true); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + MimeMultipart mp = (MimeMultipart) message.getContent(); + MimeBodyPart part = (MimeBodyPart) ((MimeMultipart) mp.getBodyPart(0).getContent()).getBodyPart(0); + ByteArrayOutputStream aos = new ByteArrayOutputStream(); + part.writeTo(aos); + assertThat(message.getSubject()).isEqualTo("testSubject"); + assertThat(message.getAllRecipients()[0]).hasToString("john.doe@example.com"); + assertThat(message.getFrom()[0]).hasToString(jHipsterProperties.getMail().getFrom()); + assertThat(message.getContent()).isInstanceOf(Multipart.class); + assertThat(aos).hasToString("\r\ntestContent"); + assertThat(part.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + void testSendEmailFromTemplate() throws Exception { + User user = new User(); + user.setLangKey(Constants.DEFAULT_LANGUAGE); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + mailService.sendEmailFromTemplate(user, "mail/testEmail", "email.test.title"); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getSubject()).isEqualTo("test title"); + assertThat(message.getAllRecipients()[0]).hasToString(user.getEmail()); + assertThat(message.getFrom()[0]).hasToString(jHipsterProperties.getMail().getFrom()); + assertThat(message.getContent().toString()).isEqualToNormalizingNewlines("test title, http://127.0.0.1:8080, john\n"); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + void testSendActivationEmail() throws Exception { + User user = new User(); + user.setLangKey(Constants.DEFAULT_LANGUAGE); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + mailService.sendActivationEmail(user); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getAllRecipients()[0]).hasToString(user.getEmail()); + assertThat(message.getFrom()[0]).hasToString(jHipsterProperties.getMail().getFrom()); + assertThat(message.getContent().toString()).isNotEmpty(); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + void testCreationEmail() throws Exception { + User user = new User(); + user.setLangKey(Constants.DEFAULT_LANGUAGE); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + mailService.sendCreationEmail(user); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getAllRecipients()[0]).hasToString(user.getEmail()); + assertThat(message.getFrom()[0]).hasToString(jHipsterProperties.getMail().getFrom()); + assertThat(message.getContent().toString()).isNotEmpty(); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + void testSendPasswordResetMail() throws Exception { + User user = new User(); + user.setLangKey(Constants.DEFAULT_LANGUAGE); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + mailService.sendPasswordResetMail(user); + verify(javaMailSender).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + assertThat(message.getAllRecipients()[0]).hasToString(user.getEmail()); + assertThat(message.getFrom()[0]).hasToString(jHipsterProperties.getMail().getFrom()); + assertThat(message.getContent().toString()).isNotEmpty(); + assertThat(message.getDataHandler().getContentType()).isEqualTo("text/html;charset=UTF-8"); + } + + @Test + void testSendEmailWithException() { + doThrow(MailSendException.class).when(javaMailSender).send(any(MimeMessage.class)); + try { + mailService.sendEmail("john.doe@example.com", "testSubject", "testContent", false, false); + } catch (Exception e) { + fail("Exception shouldn't have been thrown"); + } + } + + @Test + void testSendLocalizedEmailForAllSupportedLanguages() throws Exception { + User user = new User(); + user.setLogin("john"); + user.setEmail("john.doe@example.com"); + for (String langKey : languages) { + user.setLangKey(langKey); + mailService.sendEmailFromTemplate(user, "mail/testEmail", "email.test.title"); + verify(javaMailSender, atLeastOnce()).send(messageCaptor.capture()); + MimeMessage message = messageCaptor.getValue(); + + String propertyFilePath = "i18n/messages_" + getMessageSourceSuffixForLanguage(langKey) + ".properties"; + URL resource = this.getClass().getClassLoader().getResource(propertyFilePath); + File file = new File(new URI(resource.getFile()).getPath()); + Properties properties = new Properties(); + properties.load(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8"))); + + String emailTitle = (String) properties.get("email.test.title"); + assertThat(message.getSubject()).isEqualTo(emailTitle); + assertThat(message.getContent().toString()) + .isEqualToNormalizingNewlines("" + emailTitle + ", http://127.0.0.1:8080, john\n"); + } + } + + /** + * Convert a lang key to the Java locale. + */ + private String getMessageSourceSuffixForLanguage(String langKey) { + String javaLangKey = langKey; + Matcher matcher2 = PATTERN_LOCALE_2.matcher(langKey); + if (matcher2.matches()) { + javaLangKey = matcher2.group(1) + "_" + matcher2.group(2).toUpperCase(); + } + Matcher matcher3 = PATTERN_LOCALE_3.matcher(langKey); + if (matcher3.matches()) { + javaLangKey = matcher3.group(1) + "_" + matcher3.group(2) + "_" + matcher3.group(3).toUpperCase(); + } + return javaLangKey; + } +} diff --git a/src/test/java/de/tum/cit/ase/service/UserServiceIT.java b/src/test/java/de/tum/cit/ase/service/UserServiceIT.java new file mode 100644 index 00000000..85b44a8e --- /dev/null +++ b/src/test/java/de/tum/cit/ase/service/UserServiceIT.java @@ -0,0 +1,180 @@ +package de.tum.cit.ase.service; + +import static org.assertj.core.api.Assertions.assertThat; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.UserRepository; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Optional; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.data.auditing.AuditingHandler; +import org.springframework.data.auditing.DateTimeProvider; +import org.springframework.transaction.annotation.Transactional; +import tech.jhipster.security.RandomUtil; + +/** + * Integration tests for {@link UserService}. + */ +@IntegrationTest +@Transactional +class UserServiceIT { + + private static final String DEFAULT_LOGIN = "johndoe"; + + private static final String DEFAULT_EMAIL = "johndoe@localhost"; + + private static final String DEFAULT_FIRSTNAME = "john"; + + private static final String DEFAULT_LASTNAME = "doe"; + + private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50"; + + private static final String DEFAULT_LANGKEY = "dummy"; + + @Autowired + private UserRepository userRepository; + + @Autowired + private UserService userService; + + @Autowired + private AuditingHandler auditingHandler; + + @MockBean + private DateTimeProvider dateTimeProvider; + + private User user; + + @BeforeEach + public void init() { + user = new User(); + user.setLogin(DEFAULT_LOGIN); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + user.setEmail(DEFAULT_EMAIL); + user.setFirstName(DEFAULT_FIRSTNAME); + user.setLastName(DEFAULT_LASTNAME); + user.setImageUrl(DEFAULT_IMAGEURL); + user.setLangKey(DEFAULT_LANGKEY); + + when(dateTimeProvider.getNow()).thenReturn(Optional.of(LocalDateTime.now())); + auditingHandler.setDateTimeProvider(dateTimeProvider); + } + + @Test + @Transactional + void assertThatUserMustExistToResetPassword() { + userRepository.saveAndFlush(user); + Optional maybeUser = userService.requestPasswordReset("invalid.login@localhost"); + assertThat(maybeUser).isNotPresent(); + + maybeUser = userService.requestPasswordReset(user.getEmail()); + assertThat(maybeUser).isPresent(); + assertThat(maybeUser.orElse(null).getEmail()).isEqualTo(user.getEmail()); + assertThat(maybeUser.orElse(null).getResetDate()).isNotNull(); + assertThat(maybeUser.orElse(null).getResetKey()).isNotNull(); + } + + @Test + @Transactional + void assertThatOnlyActivatedUserCanRequestPasswordReset() { + user.setActivated(false); + userRepository.saveAndFlush(user); + + Optional maybeUser = userService.requestPasswordReset(user.getLogin()); + assertThat(maybeUser).isNotPresent(); + userRepository.delete(user); + } + + @Test + @Transactional + void assertThatResetKeyMustNotBeOlderThan24Hours() { + Instant daysAgo = Instant.now().minus(25, ChronoUnit.HOURS); + String resetKey = RandomUtil.generateResetKey(); + user.setActivated(true); + user.setResetDate(daysAgo); + user.setResetKey(resetKey); + userRepository.saveAndFlush(user); + + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + assertThat(maybeUser).isNotPresent(); + userRepository.delete(user); + } + + @Test + @Transactional + void assertThatResetKeyMustBeValid() { + Instant daysAgo = Instant.now().minus(25, ChronoUnit.HOURS); + user.setActivated(true); + user.setResetDate(daysAgo); + user.setResetKey("1234"); + userRepository.saveAndFlush(user); + + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + assertThat(maybeUser).isNotPresent(); + userRepository.delete(user); + } + + @Test + @Transactional + void assertThatUserCanResetPassword() { + String oldPassword = user.getPassword(); + Instant daysAgo = Instant.now().minus(2, ChronoUnit.HOURS); + String resetKey = RandomUtil.generateResetKey(); + user.setActivated(true); + user.setResetDate(daysAgo); + user.setResetKey(resetKey); + userRepository.saveAndFlush(user); + + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + assertThat(maybeUser).isPresent(); + assertThat(maybeUser.orElse(null).getResetDate()).isNull(); + assertThat(maybeUser.orElse(null).getResetKey()).isNull(); + assertThat(maybeUser.orElse(null).getPassword()).isNotEqualTo(oldPassword); + + userRepository.delete(user); + } + + @Test + @Transactional + void assertThatNotActivatedUsersWithNotNullActivationKeyCreatedBefore3DaysAreDeleted() { + Instant now = Instant.now(); + when(dateTimeProvider.getNow()).thenReturn(Optional.of(now.minus(4, ChronoUnit.DAYS))); + user.setActivated(false); + user.setActivationKey(RandomStringUtils.random(20)); + User dbUser = userRepository.saveAndFlush(user); + dbUser.setCreatedDate(now.minus(4, ChronoUnit.DAYS)); + userRepository.saveAndFlush(user); + Instant threeDaysAgo = now.minus(3, ChronoUnit.DAYS); + List users = userRepository.findAllByActivatedIsFalseAndActivationKeyIsNotNullAndCreatedDateBefore(threeDaysAgo); + assertThat(users).isNotEmpty(); + userService.removeNotActivatedUsers(); + users = userRepository.findAllByActivatedIsFalseAndActivationKeyIsNotNullAndCreatedDateBefore(threeDaysAgo); + assertThat(users).isEmpty(); + } + + @Test + @Transactional + void assertThatNotActivatedUsersWithNullActivationKeyCreatedBefore3DaysAreNotDeleted() { + Instant now = Instant.now(); + when(dateTimeProvider.getNow()).thenReturn(Optional.of(now.minus(4, ChronoUnit.DAYS))); + user.setActivated(false); + User dbUser = userRepository.saveAndFlush(user); + dbUser.setCreatedDate(now.minus(4, ChronoUnit.DAYS)); + userRepository.saveAndFlush(user); + Instant threeDaysAgo = now.minus(3, ChronoUnit.DAYS); + List users = userRepository.findAllByActivatedIsFalseAndActivationKeyIsNotNullAndCreatedDateBefore(threeDaysAgo); + assertThat(users).isEmpty(); + userService.removeNotActivatedUsers(); + Optional maybeDbUser = userRepository.findById(dbUser.getId()); + assertThat(maybeDbUser).contains(dbUser); + } +} diff --git a/src/test/java/de/tum/cit/ase/service/mapper/UserMapperTest.java b/src/test/java/de/tum/cit/ase/service/mapper/UserMapperTest.java new file mode 100644 index 00000000..01dc5df0 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/service/mapper/UserMapperTest.java @@ -0,0 +1,132 @@ +package de.tum.cit.ase.service.mapper; + +import static org.assertj.core.api.Assertions.assertThat; + +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.service.dto.AdminUserDTO; +import de.tum.cit.ase.service.dto.UserDTO; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + * Unit tests for {@link UserMapper}. + */ +class UserMapperTest { + + private static final String DEFAULT_LOGIN = "johndoe"; + private static final Long DEFAULT_ID = 1L; + + private UserMapper userMapper; + private User user; + private AdminUserDTO userDto; + + @BeforeEach + public void init() { + userMapper = new UserMapper(); + user = new User(); + user.setLogin(DEFAULT_LOGIN); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + user.setEmail("johndoe@localhost"); + user.setFirstName("john"); + user.setLastName("doe"); + user.setImageUrl("image_url"); + user.setLangKey("en"); + + userDto = new AdminUserDTO(user); + } + + @Test + void usersToUserDTOsShouldMapOnlyNonNullUsers() { + List users = new ArrayList<>(); + users.add(user); + users.add(null); + + List userDTOS = userMapper.usersToUserDTOs(users); + + assertThat(userDTOS).isNotEmpty().size().isEqualTo(1); + } + + @Test + void userDTOsToUsersShouldMapOnlyNonNullUsers() { + List usersDto = new ArrayList<>(); + usersDto.add(userDto); + usersDto.add(null); + + List users = userMapper.userDTOsToUsers(usersDto); + + assertThat(users).isNotEmpty().size().isEqualTo(1); + } + + @Test + void userDTOsToUsersWithAuthoritiesStringShouldMapToUsersWithAuthoritiesDomain() { + Set authoritiesAsString = new HashSet<>(); + authoritiesAsString.add("ADMIN"); + userDto.setAuthorities(authoritiesAsString); + + List usersDto = new ArrayList<>(); + usersDto.add(userDto); + + List users = userMapper.userDTOsToUsers(usersDto); + + assertThat(users).isNotEmpty().size().isEqualTo(1); + assertThat(users.get(0).getAuthorities()).isNotNull(); + assertThat(users.get(0).getAuthorities()).isNotEmpty(); + assertThat(users.get(0).getAuthorities().iterator().next().getName()).isEqualTo("ADMIN"); + } + + @Test + void userDTOsToUsersMapWithNullAuthoritiesStringShouldReturnUserWithEmptyAuthorities() { + userDto.setAuthorities(null); + + List usersDto = new ArrayList<>(); + usersDto.add(userDto); + + List users = userMapper.userDTOsToUsers(usersDto); + + assertThat(users).isNotEmpty().size().isEqualTo(1); + assertThat(users.get(0).getAuthorities()).isNotNull(); + assertThat(users.get(0).getAuthorities()).isEmpty(); + } + + @Test + void userDTOToUserMapWithAuthoritiesStringShouldReturnUserWithAuthorities() { + Set authoritiesAsString = new HashSet<>(); + authoritiesAsString.add("ADMIN"); + userDto.setAuthorities(authoritiesAsString); + + User user = userMapper.userDTOToUser(userDto); + + assertThat(user).isNotNull(); + assertThat(user.getAuthorities()).isNotNull(); + assertThat(user.getAuthorities()).isNotEmpty(); + assertThat(user.getAuthorities().iterator().next().getName()).isEqualTo("ADMIN"); + } + + @Test + void userDTOToUserMapWithNullAuthoritiesStringShouldReturnUserWithEmptyAuthorities() { + userDto.setAuthorities(null); + + User user = userMapper.userDTOToUser(userDto); + + assertThat(user).isNotNull(); + assertThat(user.getAuthorities()).isNotNull(); + assertThat(user.getAuthorities()).isEmpty(); + } + + @Test + void userDTOToUserMapWithNullUserShouldReturnNull() { + assertThat(userMapper.userDTOToUser(null)).isNull(); + } + + @Test + void testUserFromId() { + assertThat(userMapper.userFromId(DEFAULT_ID).getId()).isEqualTo(DEFAULT_ID); + assertThat(userMapper.userFromId(null)).isNull(); + } +} diff --git a/src/test/java/de/tum/cit/ase/web/filter/SpaWebFilterIT.java b/src/test/java/de/tum/cit/ase/web/filter/SpaWebFilterIT.java new file mode 100644 index 00000000..2b131d82 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/filter/SpaWebFilterIT.java @@ -0,0 +1,88 @@ +package de.tum.cit.ase.web.filter; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.security.AuthoritiesConstants; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; + +@AutoConfigureMockMvc +@WithMockUser +@IntegrationTest +class SpaWebFilterIT { + + @Autowired + private MockMvc mockMvc; + + @Test + void testFilterForwardsToIndex() throws Exception { + mockMvc.perform(get("/")).andExpect(status().isOk()).andExpect(forwardedUrl("/index.html")); + } + + @Test + void testFilterDoesNotForwardToIndexForApi() throws Exception { + mockMvc.perform(get("/api/authenticate")).andExpect(status().isOk()).andExpect(forwardedUrl(null)); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.ADMIN) + void testFilterDoesNotForwardToIndexForV3ApiDocs() throws Exception { + mockMvc.perform(get("/v3/api-docs")).andExpect(status().isOk()).andExpect(forwardedUrl(null)); + } + + @Test + void testFilterDoesNotForwardToIndexForDotFile() throws Exception { + mockMvc.perform(get("/file.js")).andExpect(status().isNotFound()); + } + + @Test + void getBackendEndpoint() throws Exception { + mockMvc.perform(get("/test")).andExpect(status().isOk()).andExpect(forwardedUrl("/index.html")); + } + + @Test + void forwardUnmappedFirstLevelMapping() throws Exception { + mockMvc.perform(get("/first-level")).andExpect(status().isOk()).andExpect(forwardedUrl("/index.html")); + } + + @Test + void forwardUnmappedSecondLevelMapping() throws Exception { + mockMvc.perform(get("/first-level/second-level")).andExpect(status().isOk()).andExpect(forwardedUrl("/index.html")); + } + + @Test + void forwardUnmappedThirdLevelMapping() throws Exception { + mockMvc.perform(get("/first-level/second-level/third-level")).andExpect(status().isOk()).andExpect(forwardedUrl("/index.html")); + } + + @Test + void forwardUnmappedDeepMapping() throws Exception { + mockMvc.perform(get("/1/2/3/4/5/6/7/8/9/10")).andExpect(forwardedUrl("/index.html")); + } + + @Test + void getUnmappedFirstLevelFile() throws Exception { + mockMvc.perform(get("/foo.js")).andExpect(status().isNotFound()); + } + + /** + * This test verifies that any files that aren't permitted by Spring Security will be forbidden. + * If you want to change this to return isNotFound(), you need to add a request mapping that + * allows this file in SecurityConfiguration. + */ + @Test + void getUnmappedSecondLevelFile() throws Exception { + mockMvc.perform(get("/foo/bar.js")).andExpect(status().isForbidden()); + } + + @Test + void getUnmappedThirdLevelFile() throws Exception { + mockMvc.perform(get("/foo/another/bar.js")).andExpect(status().isForbidden()); + } +} diff --git a/src/test/java/de/tum/cit/ase/web/rest/AccountResourceIT.java b/src/test/java/de/tum/cit/ase/web/rest/AccountResourceIT.java new file mode 100644 index 00000000..279693bc --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/rest/AccountResourceIT.java @@ -0,0 +1,752 @@ +package de.tum.cit.ase.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.config.Constants; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.AuthorityRepository; +import de.tum.cit.ase.repository.UserRepository; +import de.tum.cit.ase.security.AuthoritiesConstants; +import de.tum.cit.ase.service.UserService; +import de.tum.cit.ase.service.dto.AdminUserDTO; +import de.tum.cit.ase.service.dto.PasswordChangeDTO; +import de.tum.cit.ase.web.rest.vm.KeyAndPasswordVM; +import de.tum.cit.ase.web.rest.vm.ManagedUserVM; +import java.time.Instant; +import java.util.*; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link AccountResource} REST controller. + */ +@AutoConfigureMockMvc +@IntegrationTest +class AccountResourceIT { + + static final String TEST_USER_LOGIN = "test"; + + @Autowired + private UserRepository userRepository; + + @Autowired + private AuthorityRepository authorityRepository; + + @Autowired + private UserService userService; + + @Autowired + private PasswordEncoder passwordEncoder; + + @Autowired + private MockMvc restAccountMockMvc; + + @Test + @WithUnauthenticatedMockUser + void testNonAuthenticatedUser() throws Exception { + restAccountMockMvc + .perform(get("/api/authenticate").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string("")); + } + + @Test + @WithMockUser(TEST_USER_LOGIN) + void testAuthenticatedUser() throws Exception { + restAccountMockMvc + .perform(get("/api/authenticate").with(request -> request).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(TEST_USER_LOGIN)); + } + + @Test + @WithMockUser(TEST_USER_LOGIN) + void testGetExistingAccount() throws Exception { + Set authorities = new HashSet<>(); + authorities.add(AuthoritiesConstants.ADMIN); + + AdminUserDTO user = new AdminUserDTO(); + user.setLogin(TEST_USER_LOGIN); + user.setFirstName("john"); + user.setLastName("doe"); + user.setEmail("john.doe@jhipster.com"); + user.setImageUrl("http://placehold.it/50x50"); + user.setLangKey("en"); + user.setAuthorities(authorities); + userService.createUser(user); + + restAccountMockMvc + .perform(get("/api/account").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.login").value(TEST_USER_LOGIN)) + .andExpect(jsonPath("$.firstName").value("john")) + .andExpect(jsonPath("$.lastName").value("doe")) + .andExpect(jsonPath("$.email").value("john.doe@jhipster.com")) + .andExpect(jsonPath("$.imageUrl").value("http://placehold.it/50x50")) + .andExpect(jsonPath("$.langKey").value("en")) + .andExpect(jsonPath("$.authorities").value(AuthoritiesConstants.ADMIN)); + } + + @Test + void testGetUnknownAccount() throws Exception { + restAccountMockMvc.perform(get("/api/account").accept(MediaType.APPLICATION_PROBLEM_JSON)).andExpect(status().isUnauthorized()); + } + + @Test + @Transactional + void testRegisterValid() throws Exception { + ManagedUserVM validUser = new ManagedUserVM(); + validUser.setLogin("test-register-valid"); + validUser.setPassword("password"); + validUser.setFirstName("Alice"); + validUser.setLastName("Test"); + validUser.setEmail("test-register-valid@example.com"); + validUser.setImageUrl("http://placehold.it/50x50"); + validUser.setLangKey(Constants.DEFAULT_LANGUAGE); + validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + assertThat(userRepository.findOneByLogin("test-register-valid")).isEmpty(); + + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(validUser))) + .andExpect(status().isCreated()); + + assertThat(userRepository.findOneByLogin("test-register-valid")).isPresent(); + } + + @Test + @Transactional + void testRegisterInvalidLogin() throws Exception { + ManagedUserVM invalidUser = new ManagedUserVM(); + invalidUser.setLogin("funky-log(n"); // <-- invalid + invalidUser.setPassword("password"); + invalidUser.setFirstName("Funky"); + invalidUser.setLastName("One"); + invalidUser.setEmail("funky@example.com"); + invalidUser.setActivated(true); + invalidUser.setImageUrl("http://placehold.it/50x50"); + invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); + invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(invalidUser))) + .andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByEmailIgnoreCase("funky@example.com"); + assertThat(user).isEmpty(); + } + + @Test + @Transactional + void testRegisterInvalidEmail() throws Exception { + ManagedUserVM invalidUser = new ManagedUserVM(); + invalidUser.setLogin("bob"); + invalidUser.setPassword("password"); + invalidUser.setFirstName("Bob"); + invalidUser.setLastName("Green"); + invalidUser.setEmail("invalid"); // <-- invalid + invalidUser.setActivated(true); + invalidUser.setImageUrl("http://placehold.it/50x50"); + invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); + invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(invalidUser))) + .andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByLogin("bob"); + assertThat(user).isEmpty(); + } + + @Test + @Transactional + void testRegisterInvalidPassword() throws Exception { + ManagedUserVM invalidUser = new ManagedUserVM(); + invalidUser.setLogin("bob"); + invalidUser.setPassword("123"); // password with only 3 digits + invalidUser.setFirstName("Bob"); + invalidUser.setLastName("Green"); + invalidUser.setEmail("bob@example.com"); + invalidUser.setActivated(true); + invalidUser.setImageUrl("http://placehold.it/50x50"); + invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); + invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(invalidUser))) + .andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByLogin("bob"); + assertThat(user).isEmpty(); + } + + @Test + @Transactional + void testRegisterNullPassword() throws Exception { + ManagedUserVM invalidUser = new ManagedUserVM(); + invalidUser.setLogin("bob"); + invalidUser.setPassword(null); // invalid null password + invalidUser.setFirstName("Bob"); + invalidUser.setLastName("Green"); + invalidUser.setEmail("bob@example.com"); + invalidUser.setActivated(true); + invalidUser.setImageUrl("http://placehold.it/50x50"); + invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); + invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(invalidUser))) + .andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByLogin("bob"); + assertThat(user).isEmpty(); + } + + @Test + @Transactional + void testRegisterDuplicateLogin() throws Exception { + // First registration + ManagedUserVM firstUser = new ManagedUserVM(); + firstUser.setLogin("alice"); + firstUser.setPassword("password"); + firstUser.setFirstName("Alice"); + firstUser.setLastName("Something"); + firstUser.setEmail("alice@example.com"); + firstUser.setImageUrl("http://placehold.it/50x50"); + firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); + firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // Duplicate login, different email + ManagedUserVM secondUser = new ManagedUserVM(); + secondUser.setLogin(firstUser.getLogin()); + secondUser.setPassword(firstUser.getPassword()); + secondUser.setFirstName(firstUser.getFirstName()); + secondUser.setLastName(firstUser.getLastName()); + secondUser.setEmail("alice2@example.com"); + secondUser.setImageUrl(firstUser.getImageUrl()); + secondUser.setLangKey(firstUser.getLangKey()); + secondUser.setCreatedBy(firstUser.getCreatedBy()); + secondUser.setCreatedDate(firstUser.getCreatedDate()); + secondUser.setLastModifiedBy(firstUser.getLastModifiedBy()); + secondUser.setLastModifiedDate(firstUser.getLastModifiedDate()); + secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); + + // First user + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(firstUser))) + .andExpect(status().isCreated()); + + // Second (non activated) user + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(secondUser))) + .andExpect(status().isCreated()); + + Optional testUser = userRepository.findOneByEmailIgnoreCase("alice2@example.com"); + assertThat(testUser).isPresent(); + testUser.orElseThrow().setActivated(true); + userRepository.save(testUser.orElseThrow()); + + // Second (already activated) user + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(secondUser))) + .andExpect(status().is4xxClientError()); + } + + @Test + @Transactional + void testRegisterDuplicateEmail() throws Exception { + // First user + ManagedUserVM firstUser = new ManagedUserVM(); + firstUser.setLogin("test-register-duplicate-email"); + firstUser.setPassword("password"); + firstUser.setFirstName("Alice"); + firstUser.setLastName("Test"); + firstUser.setEmail("test-register-duplicate-email@example.com"); + firstUser.setImageUrl("http://placehold.it/50x50"); + firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); + firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // Register first user + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(firstUser))) + .andExpect(status().isCreated()); + + Optional testUser1 = userRepository.findOneByLogin("test-register-duplicate-email"); + assertThat(testUser1).isPresent(); + + // Duplicate email, different login + ManagedUserVM secondUser = new ManagedUserVM(); + secondUser.setLogin("test-register-duplicate-email-2"); + secondUser.setPassword(firstUser.getPassword()); + secondUser.setFirstName(firstUser.getFirstName()); + secondUser.setLastName(firstUser.getLastName()); + secondUser.setEmail(firstUser.getEmail()); + secondUser.setImageUrl(firstUser.getImageUrl()); + secondUser.setLangKey(firstUser.getLangKey()); + secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); + + // Register second (non activated) user + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(secondUser))) + .andExpect(status().isCreated()); + + Optional testUser2 = userRepository.findOneByLogin("test-register-duplicate-email"); + assertThat(testUser2).isEmpty(); + + Optional testUser3 = userRepository.findOneByLogin("test-register-duplicate-email-2"); + assertThat(testUser3).isPresent(); + + // Duplicate email - with uppercase email address + ManagedUserVM userWithUpperCaseEmail = new ManagedUserVM(); + userWithUpperCaseEmail.setId(firstUser.getId()); + userWithUpperCaseEmail.setLogin("test-register-duplicate-email-3"); + userWithUpperCaseEmail.setPassword(firstUser.getPassword()); + userWithUpperCaseEmail.setFirstName(firstUser.getFirstName()); + userWithUpperCaseEmail.setLastName(firstUser.getLastName()); + userWithUpperCaseEmail.setEmail("TEST-register-duplicate-email@example.com"); + userWithUpperCaseEmail.setImageUrl(firstUser.getImageUrl()); + userWithUpperCaseEmail.setLangKey(firstUser.getLangKey()); + userWithUpperCaseEmail.setAuthorities(new HashSet<>(firstUser.getAuthorities())); + + // Register third (not activated) user + restAccountMockMvc + .perform( + post("/api/register") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(userWithUpperCaseEmail)) + ) + .andExpect(status().isCreated()); + + Optional testUser4 = userRepository.findOneByLogin("test-register-duplicate-email-3"); + assertThat(testUser4).isPresent(); + assertThat(testUser4.orElseThrow().getEmail()).isEqualTo("test-register-duplicate-email@example.com"); + + testUser4.orElseThrow().setActivated(true); + userService.updateUser((new AdminUserDTO(testUser4.orElseThrow()))); + + // Register 4th (already activated) user + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(secondUser))) + .andExpect(status().is4xxClientError()); + } + + @Test + @Transactional + void testRegisterAdminIsIgnored() throws Exception { + ManagedUserVM validUser = new ManagedUserVM(); + validUser.setLogin("badguy"); + validUser.setPassword("password"); + validUser.setFirstName("Bad"); + validUser.setLastName("Guy"); + validUser.setEmail("badguy@example.com"); + validUser.setActivated(true); + validUser.setImageUrl("http://placehold.it/50x50"); + validUser.setLangKey(Constants.DEFAULT_LANGUAGE); + validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restAccountMockMvc + .perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(validUser))) + .andExpect(status().isCreated()); + + Optional userDup = userRepository.findOneWithAuthoritiesByLogin("badguy"); + assertThat(userDup).isPresent(); + assertThat(userDup.orElseThrow().getAuthorities()) + .hasSize(1) + .containsExactly(authorityRepository.findById(AuthoritiesConstants.USER).orElseThrow()); + } + + @Test + @Transactional + void testActivateAccount() throws Exception { + final String activationKey = "some activation key"; + User user = new User(); + user.setLogin("activate-account"); + user.setEmail("activate-account@example.com"); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(false); + user.setActivationKey(activationKey); + + userRepository.saveAndFlush(user); + + restAccountMockMvc.perform(get("/api/activate?key={activationKey}", activationKey)).andExpect(status().isOk()); + + user = userRepository.findOneByLogin(user.getLogin()).orElse(null); + assertThat(user.isActivated()).isTrue(); + } + + @Test + @Transactional + void testActivateAccountWithWrongKey() throws Exception { + restAccountMockMvc.perform(get("/api/activate?key=wrongActivationKey")).andExpect(status().isInternalServerError()); + } + + @Test + @Transactional + @WithMockUser("save-account") + void testSaveAccount() throws Exception { + User user = new User(); + user.setLogin("save-account"); + user.setEmail("save-account@example.com"); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + userRepository.saveAndFlush(user); + + AdminUserDTO userDTO = new AdminUserDTO(); + userDTO.setLogin("not-used"); + userDTO.setFirstName("firstname"); + userDTO.setLastName("lastname"); + userDTO.setEmail("save-account@example.com"); + userDTO.setActivated(false); + userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restAccountMockMvc + .perform(post("/api/account").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(userDTO))) + .andExpect(status().isOk()); + + User updatedUser = userRepository.findOneWithAuthoritiesByLogin(user.getLogin()).orElse(null); + assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName()); + assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName()); + assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail()); + assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey()); + assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); + assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl()); + assertThat(updatedUser.isActivated()).isTrue(); + assertThat(updatedUser.getAuthorities()).isEmpty(); + } + + @Test + @Transactional + @WithMockUser("save-invalid-email") + void testSaveInvalidEmail() throws Exception { + User user = new User(); + user.setLogin("save-invalid-email"); + user.setEmail("save-invalid-email@example.com"); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + + userRepository.saveAndFlush(user); + + AdminUserDTO userDTO = new AdminUserDTO(); + userDTO.setLogin("not-used"); + userDTO.setFirstName("firstname"); + userDTO.setLastName("lastname"); + userDTO.setEmail("invalid email"); + userDTO.setActivated(false); + userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restAccountMockMvc + .perform(post("/api/account").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(userDTO))) + .andExpect(status().isBadRequest()); + + assertThat(userRepository.findOneByEmailIgnoreCase("invalid email")).isNotPresent(); + } + + @Test + @Transactional + @WithMockUser("save-existing-email") + void testSaveExistingEmail() throws Exception { + User user = new User(); + user.setLogin("save-existing-email"); + user.setEmail("save-existing-email@example.com"); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + userRepository.saveAndFlush(user); + + User anotherUser = new User(); + anotherUser.setLogin("save-existing-email2"); + anotherUser.setEmail("save-existing-email2@example.com"); + anotherUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); + anotherUser.setActivated(true); + + userRepository.saveAndFlush(anotherUser); + + AdminUserDTO userDTO = new AdminUserDTO(); + userDTO.setLogin("not-used"); + userDTO.setFirstName("firstname"); + userDTO.setLastName("lastname"); + userDTO.setEmail("save-existing-email2@example.com"); + userDTO.setActivated(false); + userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restAccountMockMvc + .perform(post("/api/account").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(userDTO))) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("save-existing-email").orElse(null); + assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email@example.com"); + } + + @Test + @Transactional + @WithMockUser("save-existing-email-and-login") + void testSaveExistingEmailAndLogin() throws Exception { + User user = new User(); + user.setLogin("save-existing-email-and-login"); + user.setEmail("save-existing-email-and-login@example.com"); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + userRepository.saveAndFlush(user); + + AdminUserDTO userDTO = new AdminUserDTO(); + userDTO.setLogin("not-used"); + userDTO.setFirstName("firstname"); + userDTO.setLastName("lastname"); + userDTO.setEmail("save-existing-email-and-login@example.com"); + userDTO.setActivated(false); + userDTO.setImageUrl("http://placehold.it/50x50"); + userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); + + restAccountMockMvc + .perform(post("/api/account").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(userDTO))) + .andExpect(status().isOk()); + + User updatedUser = userRepository.findOneByLogin("save-existing-email-and-login").orElse(null); + assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email-and-login@example.com"); + } + + @Test + @Transactional + @WithMockUser("change-password-wrong-existing-password") + void testChangePasswordWrongExistingPassword() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.randomAlphanumeric(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password-wrong-existing-password"); + user.setEmail("change-password-wrong-existing-password@example.com"); + userRepository.saveAndFlush(user); + + restAccountMockMvc + .perform( + post("/api/account/change-password") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO("1" + currentPassword, "new password"))) + ) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("change-password-wrong-existing-password").orElse(null); + assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isFalse(); + assertThat(passwordEncoder.matches(currentPassword, updatedUser.getPassword())).isTrue(); + } + + @Test + @Transactional + @WithMockUser("change-password") + void testChangePassword() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.randomAlphanumeric(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password"); + user.setEmail("change-password@example.com"); + userRepository.saveAndFlush(user); + + restAccountMockMvc + .perform( + post("/api/account/change-password") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "new password"))) + ) + .andExpect(status().isOk()); + + User updatedUser = userRepository.findOneByLogin("change-password").orElse(null); + assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isTrue(); + } + + @Test + @Transactional + @WithMockUser("change-password-too-small") + void testChangePasswordTooSmall() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.randomAlphanumeric(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password-too-small"); + user.setEmail("change-password-too-small@example.com"); + userRepository.saveAndFlush(user); + + String newPassword = RandomStringUtils.random(ManagedUserVM.PASSWORD_MIN_LENGTH - 1); + + restAccountMockMvc + .perform( + post("/api/account/change-password") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, newPassword))) + ) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("change-password-too-small").orElse(null); + assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); + } + + @Test + @Transactional + @WithMockUser("change-password-too-long") + void testChangePasswordTooLong() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.randomAlphanumeric(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password-too-long"); + user.setEmail("change-password-too-long@example.com"); + userRepository.saveAndFlush(user); + + String newPassword = RandomStringUtils.random(ManagedUserVM.PASSWORD_MAX_LENGTH + 1); + + restAccountMockMvc + .perform( + post("/api/account/change-password") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, newPassword))) + ) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("change-password-too-long").orElse(null); + assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); + } + + @Test + @Transactional + @WithMockUser("change-password-empty") + void testChangePasswordEmpty() throws Exception { + User user = new User(); + String currentPassword = RandomStringUtils.randomAlphanumeric(60); + user.setPassword(passwordEncoder.encode(currentPassword)); + user.setLogin("change-password-empty"); + user.setEmail("change-password-empty@example.com"); + userRepository.saveAndFlush(user); + + restAccountMockMvc + .perform( + post("/api/account/change-password") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, ""))) + ) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin("change-password-empty").orElse(null); + assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); + } + + @Test + @Transactional + void testRequestPasswordReset() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + user.setLogin("password-reset"); + user.setEmail("password-reset@example.com"); + user.setLangKey("en"); + userRepository.saveAndFlush(user); + + restAccountMockMvc + .perform(post("/api/account/reset-password/init").content("password-reset@example.com")) + .andExpect(status().isOk()); + } + + @Test + @Transactional + void testRequestPasswordResetUpperCaseEmail() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + user.setLogin("password-reset-upper-case"); + user.setEmail("password-reset-upper-case@example.com"); + user.setLangKey("en"); + userRepository.saveAndFlush(user); + + restAccountMockMvc + .perform(post("/api/account/reset-password/init").content("password-reset-upper-case@EXAMPLE.COM")) + .andExpect(status().isOk()); + } + + @Test + void testRequestPasswordResetWrongEmail() throws Exception { + restAccountMockMvc + .perform(post("/api/account/reset-password/init").content("password-reset-wrong-email@example.com")) + .andExpect(status().isOk()); + } + + @Test + @Transactional + void testFinishPasswordReset() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setLogin("finish-password-reset"); + user.setEmail("finish-password-reset@example.com"); + user.setResetDate(Instant.now().plusSeconds(60)); + user.setResetKey("reset key"); + userRepository.saveAndFlush(user); + + KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); + keyAndPassword.setKey(user.getResetKey()); + keyAndPassword.setNewPassword("new password"); + + restAccountMockMvc + .perform( + post("/api/account/reset-password/finish") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(keyAndPassword)) + ) + .andExpect(status().isOk()); + + User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null); + assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isTrue(); + } + + @Test + @Transactional + void testFinishPasswordResetTooSmall() throws Exception { + User user = new User(); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setLogin("finish-password-reset-too-small"); + user.setEmail("finish-password-reset-too-small@example.com"); + user.setResetDate(Instant.now().plusSeconds(60)); + user.setResetKey("reset key too small"); + userRepository.saveAndFlush(user); + + KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); + keyAndPassword.setKey(user.getResetKey()); + keyAndPassword.setNewPassword("foo"); + + restAccountMockMvc + .perform( + post("/api/account/reset-password/finish") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(keyAndPassword)) + ) + .andExpect(status().isBadRequest()); + + User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null); + assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isFalse(); + } + + @Test + @Transactional + void testFinishPasswordResetWrongKey() throws Exception { + KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); + keyAndPassword.setKey("wrong reset key"); + keyAndPassword.setNewPassword("new password"); + + restAccountMockMvc + .perform( + post("/api/account/reset-password/finish") + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(keyAndPassword)) + ) + .andExpect(status().isInternalServerError()); + } +} diff --git a/src/test/java/de/tum/cit/ase/web/rest/AuthenticateControllerIT.java b/src/test/java/de/tum/cit/ase/web/rest/AuthenticateControllerIT.java new file mode 100644 index 00000000..535516c7 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/rest/AuthenticateControllerIT.java @@ -0,0 +1,98 @@ +package de.tum.cit.ase.web.rest; + +import static org.hamcrest.Matchers.emptyString; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.UserRepository; +import de.tum.cit.ase.web.rest.vm.LoginVM; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link AuthenticateController} REST controller. + */ +@AutoConfigureMockMvc +@IntegrationTest +class AuthenticateControllerIT { + + @Autowired + private UserRepository userRepository; + + @Autowired + private PasswordEncoder passwordEncoder; + + @Autowired + private MockMvc mockMvc; + + @Test + @Transactional + void testAuthorize() throws Exception { + User user = new User(); + user.setLogin("user-jwt-controller"); + user.setEmail("user-jwt-controller@example.com"); + user.setActivated(true); + user.setPassword(passwordEncoder.encode("test")); + + userRepository.saveAndFlush(user); + + LoginVM login = new LoginVM(); + login.setUsername("user-jwt-controller"); + login.setPassword("test"); + mockMvc + .perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.id_token").isString()) + .andExpect(jsonPath("$.id_token").isNotEmpty()) + .andExpect(header().string("Authorization", not(nullValue()))) + .andExpect(header().string("Authorization", not(is(emptyString())))); + } + + @Test + @Transactional + void testAuthorizeWithRememberMe() throws Exception { + User user = new User(); + user.setLogin("user-jwt-controller-remember-me"); + user.setEmail("user-jwt-controller-remember-me@example.com"); + user.setActivated(true); + user.setPassword(passwordEncoder.encode("test")); + + userRepository.saveAndFlush(user); + + LoginVM login = new LoginVM(); + login.setUsername("user-jwt-controller-remember-me"); + login.setPassword("test"); + login.setRememberMe(true); + mockMvc + .perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.id_token").isString()) + .andExpect(jsonPath("$.id_token").isNotEmpty()) + .andExpect(header().string("Authorization", not(nullValue()))) + .andExpect(header().string("Authorization", not(is(emptyString())))); + } + + @Test + void testAuthorizeFails() throws Exception { + LoginVM login = new LoginVM(); + login.setUsername("wrong-user"); + login.setPassword("wrong password"); + mockMvc + .perform(post("/api/authenticate").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(login))) + .andExpect(status().isUnauthorized()) + .andExpect(jsonPath("$.id_token").doesNotExist()) + .andExpect(header().doesNotExist("Authorization")); + } +} diff --git a/src/test/java/de/tum/cit/ase/web/rest/PublicUserResourceIT.java b/src/test/java/de/tum/cit/ase/web/rest/PublicUserResourceIT.java new file mode 100644 index 00000000..7317fdbc --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/rest/PublicUserResourceIT.java @@ -0,0 +1,99 @@ +package de.tum.cit.ase.web.rest; + +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasItems; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.UserRepository; +import de.tum.cit.ase.security.AuthoritiesConstants; +import jakarta.persistence.EntityManager; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.cache.CacheManager; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link PublicUserResource} REST controller. + */ +@AutoConfigureMockMvc +@WithMockUser(authorities = AuthoritiesConstants.ADMIN) +@IntegrationTest +class PublicUserResourceIT { + + private static final String DEFAULT_LOGIN = "johndoe"; + + @Autowired + private UserRepository userRepository; + + @Autowired + private EntityManager em; + + @Autowired + private CacheManager cacheManager; + + @Autowired + private MockMvc restUserMockMvc; + + private User user; + + @BeforeEach + public void setup() { + cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear(); + cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE).clear(); + } + + @BeforeEach + public void initTest() { + user = UserResourceIT.initTestUser(userRepository, em); + } + + @Test + @Transactional + void getAllPublicUsers() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + + // Get all the users + restUserMockMvc + .perform(get("/api/users?sort=id,desc").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))) + .andExpect(jsonPath("$.[*].email").doesNotExist()) + .andExpect(jsonPath("$.[*].imageUrl").doesNotExist()) + .andExpect(jsonPath("$.[*].langKey").doesNotExist()); + } + + @Test + @Transactional + void getAllAuthorities() throws Exception { + restUserMockMvc + .perform(get("/api/authorities").accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$").isArray()) + .andExpect(jsonPath("$").value(hasItems(AuthoritiesConstants.USER, AuthoritiesConstants.ADMIN))); + } + + @Test + @Transactional + void getAllUsersSortedByParameters() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + + restUserMockMvc.perform(get("/api/users?sort=resetKey,desc").accept(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + restUserMockMvc.perform(get("/api/users?sort=password,desc").accept(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + restUserMockMvc + .perform(get("/api/users?sort=resetKey,desc&sort=id,desc").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + restUserMockMvc.perform(get("/api/users?sort=id,desc").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()); + } +} diff --git a/src/test/java/de/tum/cit/ase/web/rest/TestUtil.java b/src/test/java/de/tum/cit/ase/web/rest/TestUtil.java new file mode 100644 index 00000000..4123463e --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/rest/TestUtil.java @@ -0,0 +1,206 @@ +package de.tum.cit.ase.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import jakarta.persistence.EntityManager; +import jakarta.persistence.TypedQuery; +import jakarta.persistence.criteria.CriteriaBuilder; +import jakarta.persistence.criteria.CriteriaQuery; +import jakarta.persistence.criteria.Root; +import java.io.IOException; +import java.math.BigDecimal; +import java.time.ZonedDateTime; +import java.time.format.DateTimeParseException; +import java.util.List; +import org.hamcrest.Description; +import org.hamcrest.TypeSafeDiagnosingMatcher; +import org.hamcrest.TypeSafeMatcher; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.format.support.DefaultFormattingConversionService; +import org.springframework.format.support.FormattingConversionService; + +/** + * Utility class for testing REST controllers. + */ +public final class TestUtil { + + private static final ObjectMapper mapper = createObjectMapper(); + + private static ObjectMapper createObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRITE_DURATIONS_AS_TIMESTAMPS, false); + mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); + mapper.registerModule(new JavaTimeModule()); + return mapper; + } + + /** + * Convert an object to JSON byte array. + * + * @param object the object to convert. + * @return the JSON byte array. + * @throws IOException + */ + public static byte[] convertObjectToJsonBytes(Object object) throws IOException { + return mapper.writeValueAsBytes(object); + } + + /** + * Create a byte array with a specific size filled with specified data. + * + * @param size the size of the byte array. + * @param data the data to put in the byte array. + * @return the JSON byte array. + */ + public static byte[] createByteArray(int size, String data) { + byte[] byteArray = new byte[size]; + for (int i = 0; i < size; i++) { + byteArray[i] = Byte.parseByte(data, 2); + } + return byteArray; + } + + /** + * A matcher that tests that the examined string represents the same instant as the reference datetime. + */ + public static class ZonedDateTimeMatcher extends TypeSafeDiagnosingMatcher { + + private final ZonedDateTime date; + + public ZonedDateTimeMatcher(ZonedDateTime date) { + this.date = date; + } + + @Override + protected boolean matchesSafely(String item, Description mismatchDescription) { + try { + if (!date.isEqual(ZonedDateTime.parse(item))) { + mismatchDescription.appendText("was ").appendValue(item); + return false; + } + return true; + } catch (DateTimeParseException e) { + mismatchDescription.appendText("was ").appendValue(item).appendText(", which could not be parsed as a ZonedDateTime"); + return false; + } + } + + @Override + public void describeTo(Description description) { + description.appendText("a String representing the same Instant as ").appendValue(date); + } + } + + /** + * Creates a matcher that matches when the examined string represents the same instant as the reference datetime. + * + * @param date the reference datetime against which the examined string is checked. + */ + public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) { + return new ZonedDateTimeMatcher(date); + } + + /** + * A matcher that tests that the examined number represents the same value - it can be Long, Double, etc - as the reference BigDecimal. + */ + public static class NumberMatcher extends TypeSafeMatcher { + + final BigDecimal value; + + public NumberMatcher(BigDecimal value) { + this.value = value; + } + + @Override + public void describeTo(Description description) { + description.appendText("a numeric value is ").appendValue(value); + } + + @Override + protected boolean matchesSafely(Number item) { + BigDecimal bigDecimal = asDecimal(item); + return bigDecimal != null && value.compareTo(bigDecimal) == 0; + } + + private static BigDecimal asDecimal(Number item) { + if (item == null) { + return null; + } + if (item instanceof BigDecimal) { + return (BigDecimal) item; + } else if (item instanceof Long) { + return BigDecimal.valueOf((Long) item); + } else if (item instanceof Integer) { + return BigDecimal.valueOf((Integer) item); + } else if (item instanceof Double) { + return BigDecimal.valueOf((Double) item); + } else if (item instanceof Float) { + return BigDecimal.valueOf((Float) item); + } else { + return BigDecimal.valueOf(item.doubleValue()); + } + } + } + + /** + * Creates a matcher that matches when the examined number represents the same value as the reference BigDecimal. + * + * @param number the reference BigDecimal against which the examined number is checked. + */ + public static NumberMatcher sameNumber(BigDecimal number) { + return new NumberMatcher(number); + } + + /** + * Verifies the equals/hashcode contract on the domain object. + */ + public static void equalsVerifier(Class clazz) throws Exception { + T domainObject1 = clazz.getConstructor().newInstance(); + assertThat(domainObject1.toString()).isNotNull(); + assertThat(domainObject1).isEqualTo(domainObject1); + assertThat(domainObject1).hasSameHashCodeAs(domainObject1); + // Test with an instance of another class + Object testOtherObject = new Object(); + assertThat(domainObject1).isNotEqualTo(testOtherObject); + assertThat(domainObject1).isNotEqualTo(null); + // Test with an instance of the same class + T domainObject2 = clazz.getConstructor().newInstance(); + assertThat(domainObject1).isNotEqualTo(domainObject2); + // HashCodes are equals because the objects are not persisted yet + assertThat(domainObject1).hasSameHashCodeAs(domainObject2); + } + + /** + * Create a {@link FormattingConversionService} which use ISO date format, instead of the localized one. + * @return the {@link FormattingConversionService}. + */ + public static FormattingConversionService createFormattingConversionService() { + DefaultFormattingConversionService dfcs = new DefaultFormattingConversionService(); + DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); + registrar.setUseIsoFormat(true); + registrar.registerFormatters(dfcs); + return dfcs; + } + + /** + * Executes a query on the EntityManager finding all stored objects. + * @param The type of objects to be searched + * @param em The instance of the EntityManager + * @param clazz The class type to be searched + * @return A list of all found objects + */ + public static List findAll(EntityManager em, Class clazz) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(clazz); + Root rootEntry = cq.from(clazz); + CriteriaQuery all = cq.select(rootEntry); + TypedQuery allQuery = em.createQuery(all); + return allQuery.getResultList(); + } + + private TestUtil() {} +} diff --git a/src/test/java/de/tum/cit/ase/web/rest/UserResourceIT.java b/src/test/java/de/tum/cit/ase/web/rest/UserResourceIT.java new file mode 100644 index 00000000..0b8ce4b0 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/rest/UserResourceIT.java @@ -0,0 +1,557 @@ +package de.tum.cit.ase.web.rest; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.hasItem; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +import de.tum.cit.ase.IntegrationTest; +import de.tum.cit.ase.domain.Authority; +import de.tum.cit.ase.domain.User; +import de.tum.cit.ase.repository.UserRepository; +import de.tum.cit.ase.security.AuthoritiesConstants; +import de.tum.cit.ase.service.dto.AdminUserDTO; +import de.tum.cit.ase.service.mapper.UserMapper; +import jakarta.persistence.EntityManager; +import java.time.Instant; +import java.util.*; +import java.util.function.Consumer; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.cache.CacheManager; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.transaction.annotation.Transactional; + +/** + * Integration tests for the {@link UserResource} REST controller. + */ +@AutoConfigureMockMvc +@WithMockUser(authorities = AuthoritiesConstants.ADMIN) +@IntegrationTest +class UserResourceIT { + + private static final String DEFAULT_LOGIN = "johndoe"; + private static final String UPDATED_LOGIN = "jhipster"; + + private static final Long DEFAULT_ID = 1L; + + private static final String DEFAULT_PASSWORD = "passjohndoe"; + private static final String UPDATED_PASSWORD = "passjhipster"; + + private static final String DEFAULT_EMAIL = "johndoe@localhost"; + private static final String UPDATED_EMAIL = "jhipster@localhost"; + + private static final String DEFAULT_FIRSTNAME = "john"; + private static final String UPDATED_FIRSTNAME = "jhipsterFirstName"; + + private static final String DEFAULT_LASTNAME = "doe"; + private static final String UPDATED_LASTNAME = "jhipsterLastName"; + + private static final String DEFAULT_IMAGEURL = "http://placehold.it/50x50"; + private static final String UPDATED_IMAGEURL = "http://placehold.it/40x40"; + + private static final String DEFAULT_LANGKEY = "en"; + private static final String UPDATED_LANGKEY = "fr"; + + @Autowired + private UserRepository userRepository; + + @Autowired + private UserMapper userMapper; + + @Autowired + private EntityManager em; + + @Autowired + private CacheManager cacheManager; + + @Autowired + private MockMvc restUserMockMvc; + + private User user; + + @BeforeEach + public void setup() { + cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).clear(); + cacheManager.getCache(UserRepository.USERS_BY_EMAIL_CACHE).clear(); + } + + /** + * Create a User. + * + * This is a static method, as tests for other entities might also need it, + * if they test an entity which has a required relationship to the User entity. + */ + public static User createEntity(EntityManager em) { + User user = new User(); + user.setLogin(DEFAULT_LOGIN + RandomStringUtils.randomAlphabetic(5)); + user.setPassword(RandomStringUtils.randomAlphanumeric(60)); + user.setActivated(true); + user.setEmail(RandomStringUtils.randomAlphabetic(5) + DEFAULT_EMAIL); + user.setFirstName(DEFAULT_FIRSTNAME); + user.setLastName(DEFAULT_LASTNAME); + user.setImageUrl(DEFAULT_IMAGEURL); + user.setLangKey(DEFAULT_LANGKEY); + return user; + } + + /** + * Setups the database with one user. + */ + public static User initTestUser(UserRepository userRepository, EntityManager em) { + userRepository.deleteAll(); + User user = createEntity(em); + user.setLogin(DEFAULT_LOGIN); + user.setEmail(DEFAULT_EMAIL); + return user; + } + + @BeforeEach + public void initTest() { + user = initTestUser(userRepository, em); + } + + @Test + @Transactional + void createUser() throws Exception { + int databaseSizeBeforeCreate = userRepository.findAll().size(); + + // Create the User + AdminUserDTO user = new AdminUserDTO(); + user.setLogin(DEFAULT_LOGIN); + user.setFirstName(DEFAULT_FIRSTNAME); + user.setLastName(DEFAULT_LASTNAME); + user.setEmail(DEFAULT_EMAIL); + user.setActivated(true); + user.setImageUrl(DEFAULT_IMAGEURL); + user.setLangKey(DEFAULT_LANGKEY); + user.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc + .perform(post("/api/admin/users").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(user))) + .andExpect(status().isCreated()); + + // Validate the User in the database + assertPersistedUsers(users -> { + assertThat(users).hasSize(databaseSizeBeforeCreate + 1); + User testUser = users.get(users.size() - 1); + assertThat(testUser.getLogin()).isEqualTo(DEFAULT_LOGIN); + assertThat(testUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); + assertThat(testUser.getLastName()).isEqualTo(DEFAULT_LASTNAME); + assertThat(testUser.getEmail()).isEqualTo(DEFAULT_EMAIL); + assertThat(testUser.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); + assertThat(testUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY); + }); + } + + @Test + @Transactional + void createUserWithExistingId() throws Exception { + int databaseSizeBeforeCreate = userRepository.findAll().size(); + + AdminUserDTO user = new AdminUserDTO(); + user.setId(DEFAULT_ID); + user.setLogin(DEFAULT_LOGIN); + user.setFirstName(DEFAULT_FIRSTNAME); + user.setLastName(DEFAULT_LASTNAME); + user.setEmail(DEFAULT_EMAIL); + user.setActivated(true); + user.setImageUrl(DEFAULT_IMAGEURL); + user.setLangKey(DEFAULT_LANGKEY); + user.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // An entity with an existing ID cannot be created, so this API call must fail + restUserMockMvc + .perform(post("/api/admin/users").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(user))) + .andExpect(status().isBadRequest()); + + // Validate the User in the database + assertPersistedUsers(users -> assertThat(users).hasSize(databaseSizeBeforeCreate)); + } + + @Test + @Transactional + void createUserWithExistingLogin() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeCreate = userRepository.findAll().size(); + + AdminUserDTO user = new AdminUserDTO(); + user.setLogin(DEFAULT_LOGIN); // this login should already be used + user.setFirstName(DEFAULT_FIRSTNAME); + user.setLastName(DEFAULT_LASTNAME); + user.setEmail("anothermail@localhost"); + user.setActivated(true); + user.setImageUrl(DEFAULT_IMAGEURL); + user.setLangKey(DEFAULT_LANGKEY); + user.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // Create the User + restUserMockMvc + .perform(post("/api/admin/users").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(user))) + .andExpect(status().isBadRequest()); + + // Validate the User in the database + assertPersistedUsers(users -> assertThat(users).hasSize(databaseSizeBeforeCreate)); + } + + @Test + @Transactional + void createUserWithExistingEmail() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeCreate = userRepository.findAll().size(); + + AdminUserDTO user = new AdminUserDTO(); + user.setLogin("anotherlogin"); + user.setFirstName(DEFAULT_FIRSTNAME); + user.setLastName(DEFAULT_LASTNAME); + user.setEmail(DEFAULT_EMAIL); // this email should already be used + user.setActivated(true); + user.setImageUrl(DEFAULT_IMAGEURL); + user.setLangKey(DEFAULT_LANGKEY); + user.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + // Create the User + restUserMockMvc + .perform(post("/api/admin/users").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(user))) + .andExpect(status().isBadRequest()); + + // Validate the User in the database + assertPersistedUsers(users -> assertThat(users).hasSize(databaseSizeBeforeCreate)); + } + + @Test + @Transactional + void getAllUsers() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + + // Get all the users + restUserMockMvc + .perform(get("/api/admin/users?sort=id,desc").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.[*].login").value(hasItem(DEFAULT_LOGIN))) + .andExpect(jsonPath("$.[*].firstName").value(hasItem(DEFAULT_FIRSTNAME))) + .andExpect(jsonPath("$.[*].lastName").value(hasItem(DEFAULT_LASTNAME))) + .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL))) + .andExpect(jsonPath("$.[*].imageUrl").value(hasItem(DEFAULT_IMAGEURL))) + .andExpect(jsonPath("$.[*].langKey").value(hasItem(DEFAULT_LANGKEY))); + } + + @Test + @Transactional + void getUser() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + + assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull(); + + // Get the user + restUserMockMvc + .perform(get("/api/admin/users/{login}", user.getLogin())) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(jsonPath("$.login").value(user.getLogin())) + .andExpect(jsonPath("$.firstName").value(DEFAULT_FIRSTNAME)) + .andExpect(jsonPath("$.lastName").value(DEFAULT_LASTNAME)) + .andExpect(jsonPath("$.email").value(DEFAULT_EMAIL)) + .andExpect(jsonPath("$.imageUrl").value(DEFAULT_IMAGEURL)) + .andExpect(jsonPath("$.langKey").value(DEFAULT_LANGKEY)); + + assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull(); + } + + @Test + @Transactional + void getNonExistingUser() throws Exception { + restUserMockMvc.perform(get("/api/admin/users/unknown")).andExpect(status().isNotFound()); + } + + @Test + @Transactional + void updateUser() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeUpdate = userRepository.findAll().size(); + + // Update the user + User updatedUser = userRepository.findById(user.getId()).orElseThrow(); + + AdminUserDTO user = new AdminUserDTO(); + user.setId(updatedUser.getId()); + user.setLogin(updatedUser.getLogin()); + user.setFirstName(UPDATED_FIRSTNAME); + user.setLastName(UPDATED_LASTNAME); + user.setEmail(UPDATED_EMAIL); + user.setActivated(updatedUser.isActivated()); + user.setImageUrl(UPDATED_IMAGEURL); + user.setLangKey(UPDATED_LANGKEY); + user.setCreatedBy(updatedUser.getCreatedBy()); + user.setCreatedDate(updatedUser.getCreatedDate()); + user.setLastModifiedBy(updatedUser.getLastModifiedBy()); + user.setLastModifiedDate(updatedUser.getLastModifiedDate()); + user.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc + .perform(put("/api/admin/users").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(user))) + .andExpect(status().isOk()); + + // Validate the User in the database + assertPersistedUsers(users -> { + assertThat(users).hasSize(databaseSizeBeforeUpdate); + User testUser = users.stream().filter(usr -> usr.getId().equals(updatedUser.getId())).findFirst().orElseThrow(); + assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); + assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); + assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); + assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); + assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); + }); + } + + @Test + @Transactional + void updateUserLogin() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeUpdate = userRepository.findAll().size(); + + // Update the user + User updatedUser = userRepository.findById(user.getId()).orElseThrow(); + + AdminUserDTO user = new AdminUserDTO(); + user.setId(updatedUser.getId()); + user.setLogin(UPDATED_LOGIN); + user.setFirstName(UPDATED_FIRSTNAME); + user.setLastName(UPDATED_LASTNAME); + user.setEmail(UPDATED_EMAIL); + user.setActivated(updatedUser.isActivated()); + user.setImageUrl(UPDATED_IMAGEURL); + user.setLangKey(UPDATED_LANGKEY); + user.setCreatedBy(updatedUser.getCreatedBy()); + user.setCreatedDate(updatedUser.getCreatedDate()); + user.setLastModifiedBy(updatedUser.getLastModifiedBy()); + user.setLastModifiedDate(updatedUser.getLastModifiedDate()); + user.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc + .perform(put("/api/admin/users").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(user))) + .andExpect(status().isOk()); + + // Validate the User in the database + assertPersistedUsers(users -> { + assertThat(users).hasSize(databaseSizeBeforeUpdate); + User testUser = users.stream().filter(usr -> usr.getId().equals(updatedUser.getId())).findFirst().orElseThrow(); + assertThat(testUser.getLogin()).isEqualTo(UPDATED_LOGIN); + assertThat(testUser.getFirstName()).isEqualTo(UPDATED_FIRSTNAME); + assertThat(testUser.getLastName()).isEqualTo(UPDATED_LASTNAME); + assertThat(testUser.getEmail()).isEqualTo(UPDATED_EMAIL); + assertThat(testUser.getImageUrl()).isEqualTo(UPDATED_IMAGEURL); + assertThat(testUser.getLangKey()).isEqualTo(UPDATED_LANGKEY); + }); + } + + @Test + @Transactional + void updateUserExistingEmail() throws Exception { + // Initialize the database with 2 users + userRepository.saveAndFlush(user); + + User anotherUser = new User(); + anotherUser.setLogin("jhipster"); + anotherUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); + anotherUser.setActivated(true); + anotherUser.setEmail("jhipster@localhost"); + anotherUser.setFirstName("java"); + anotherUser.setLastName("hipster"); + anotherUser.setImageUrl(""); + anotherUser.setLangKey("en"); + userRepository.saveAndFlush(anotherUser); + + // Update the user + User updatedUser = userRepository.findById(user.getId()).orElseThrow(); + + AdminUserDTO user = new AdminUserDTO(); + user.setId(updatedUser.getId()); + user.setLogin(updatedUser.getLogin()); + user.setFirstName(updatedUser.getFirstName()); + user.setLastName(updatedUser.getLastName()); + user.setEmail("jhipster@localhost"); // this email should already be used by anotherUser + user.setActivated(updatedUser.isActivated()); + user.setImageUrl(updatedUser.getImageUrl()); + user.setLangKey(updatedUser.getLangKey()); + user.setCreatedBy(updatedUser.getCreatedBy()); + user.setCreatedDate(updatedUser.getCreatedDate()); + user.setLastModifiedBy(updatedUser.getLastModifiedBy()); + user.setLastModifiedDate(updatedUser.getLastModifiedDate()); + user.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc + .perform(put("/api/admin/users").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(user))) + .andExpect(status().isBadRequest()); + } + + @Test + @Transactional + void updateUserExistingLogin() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + + User anotherUser = new User(); + anotherUser.setLogin("jhipster"); + anotherUser.setPassword(RandomStringUtils.randomAlphanumeric(60)); + anotherUser.setActivated(true); + anotherUser.setEmail("jhipster@localhost"); + anotherUser.setFirstName("java"); + anotherUser.setLastName("hipster"); + anotherUser.setImageUrl(""); + anotherUser.setLangKey("en"); + userRepository.saveAndFlush(anotherUser); + + // Update the user + User updatedUser = userRepository.findById(user.getId()).orElseThrow(); + + AdminUserDTO user = new AdminUserDTO(); + user.setId(updatedUser.getId()); + user.setLogin("jhipster"); // this login should already be used by anotherUser + user.setFirstName(updatedUser.getFirstName()); + user.setLastName(updatedUser.getLastName()); + user.setEmail(updatedUser.getEmail()); + user.setActivated(updatedUser.isActivated()); + user.setImageUrl(updatedUser.getImageUrl()); + user.setLangKey(updatedUser.getLangKey()); + user.setCreatedBy(updatedUser.getCreatedBy()); + user.setCreatedDate(updatedUser.getCreatedDate()); + user.setLastModifiedBy(updatedUser.getLastModifiedBy()); + user.setLastModifiedDate(updatedUser.getLastModifiedDate()); + user.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + restUserMockMvc + .perform(put("/api/admin/users").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(user))) + .andExpect(status().isBadRequest()); + } + + @Test + @Transactional + void deleteUser() throws Exception { + // Initialize the database + userRepository.saveAndFlush(user); + int databaseSizeBeforeDelete = userRepository.findAll().size(); + + // Delete the user + restUserMockMvc + .perform(delete("/api/admin/users/{login}", user.getLogin()).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull(); + + // Validate the database is empty + assertPersistedUsers(users -> assertThat(users).hasSize(databaseSizeBeforeDelete - 1)); + } + + @Test + void testUserEquals() throws Exception { + TestUtil.equalsVerifier(User.class); + User user1 = new User(); + user1.setId(DEFAULT_ID); + User user2 = new User(); + user2.setId(user1.getId()); + assertThat(user1).isEqualTo(user2); + user2.setId(2L); + assertThat(user1).isNotEqualTo(user2); + user1.setId(null); + assertThat(user1).isNotEqualTo(user2); + } + + @Test + void testUserDTOtoUser() { + AdminUserDTO userDTO = new AdminUserDTO(); + userDTO.setId(DEFAULT_ID); + userDTO.setLogin(DEFAULT_LOGIN); + userDTO.setFirstName(DEFAULT_FIRSTNAME); + userDTO.setLastName(DEFAULT_LASTNAME); + userDTO.setEmail(DEFAULT_EMAIL); + userDTO.setActivated(true); + userDTO.setImageUrl(DEFAULT_IMAGEURL); + userDTO.setLangKey(DEFAULT_LANGKEY); + userDTO.setCreatedBy(DEFAULT_LOGIN); + userDTO.setLastModifiedBy(DEFAULT_LOGIN); + userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); + + User user = userMapper.userDTOToUser(userDTO); + assertThat(user.getId()).isEqualTo(DEFAULT_ID); + assertThat(user.getLogin()).isEqualTo(DEFAULT_LOGIN); + assertThat(user.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); + assertThat(user.getLastName()).isEqualTo(DEFAULT_LASTNAME); + assertThat(user.getEmail()).isEqualTo(DEFAULT_EMAIL); + assertThat(user.isActivated()).isTrue(); + assertThat(user.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); + assertThat(user.getLangKey()).isEqualTo(DEFAULT_LANGKEY); + assertThat(user.getCreatedBy()).isNull(); + assertThat(user.getCreatedDate()).isNotNull(); + assertThat(user.getLastModifiedBy()).isNull(); + assertThat(user.getLastModifiedDate()).isNotNull(); + assertThat(user.getAuthorities()).extracting("name").containsExactly(AuthoritiesConstants.USER); + } + + @Test + void testUserToUserDTO() { + user.setId(DEFAULT_ID); + user.setCreatedBy(DEFAULT_LOGIN); + user.setCreatedDate(Instant.now()); + user.setLastModifiedBy(DEFAULT_LOGIN); + user.setLastModifiedDate(Instant.now()); + Set authorities = new HashSet<>(); + Authority authority = new Authority(); + authority.setName(AuthoritiesConstants.USER); + authorities.add(authority); + user.setAuthorities(authorities); + + AdminUserDTO userDTO = userMapper.userToAdminUserDTO(user); + + assertThat(userDTO.getId()).isEqualTo(DEFAULT_ID); + assertThat(userDTO.getLogin()).isEqualTo(DEFAULT_LOGIN); + assertThat(userDTO.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME); + assertThat(userDTO.getLastName()).isEqualTo(DEFAULT_LASTNAME); + assertThat(userDTO.getEmail()).isEqualTo(DEFAULT_EMAIL); + assertThat(userDTO.isActivated()).isTrue(); + assertThat(userDTO.getImageUrl()).isEqualTo(DEFAULT_IMAGEURL); + assertThat(userDTO.getLangKey()).isEqualTo(DEFAULT_LANGKEY); + assertThat(userDTO.getCreatedBy()).isEqualTo(DEFAULT_LOGIN); + assertThat(userDTO.getCreatedDate()).isEqualTo(user.getCreatedDate()); + assertThat(userDTO.getLastModifiedBy()).isEqualTo(DEFAULT_LOGIN); + assertThat(userDTO.getLastModifiedDate()).isEqualTo(user.getLastModifiedDate()); + assertThat(userDTO.getAuthorities()).containsExactly(AuthoritiesConstants.USER); + assertThat(userDTO.toString()).isNotNull(); + } + + @Test + void testAuthorityEquals() { + Authority authorityA = new Authority(); + assertThat(authorityA).isNotEqualTo(null).isNotEqualTo(new Object()); + assertThat(authorityA.hashCode()).isZero(); + assertThat(authorityA.toString()).isNotNull(); + + Authority authorityB = new Authority(); + assertThat(authorityA).isEqualTo(authorityB); + + authorityB.setName(AuthoritiesConstants.ADMIN); + assertThat(authorityA).isNotEqualTo(authorityB); + + authorityA.setName(AuthoritiesConstants.USER); + assertThat(authorityA).isNotEqualTo(authorityB); + + authorityB.setName(AuthoritiesConstants.USER); + assertThat(authorityA).isEqualTo(authorityB).hasSameHashCodeAs(authorityB); + } + + private void assertPersistedUsers(Consumer> userAssertion) { + userAssertion.accept(userRepository.findAll()); + } +} diff --git a/src/test/java/de/tum/cit/ase/web/rest/WithUnauthenticatedMockUser.java b/src/test/java/de/tum/cit/ase/web/rest/WithUnauthenticatedMockUser.java new file mode 100644 index 00000000..6ad68974 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/rest/WithUnauthenticatedMockUser.java @@ -0,0 +1,23 @@ +package de.tum.cit.ase.web.rest; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.test.context.support.WithSecurityContext; +import org.springframework.security.test.context.support.WithSecurityContextFactory; + +@Target({ ElementType.METHOD, ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@WithSecurityContext(factory = WithUnauthenticatedMockUser.Factory.class) +public @interface WithUnauthenticatedMockUser { + class Factory implements WithSecurityContextFactory { + + @Override + public SecurityContext createSecurityContext(WithUnauthenticatedMockUser annotation) { + return SecurityContextHolder.createEmptyContext(); + } + } +} diff --git a/src/test/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslatorIT.java b/src/test/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslatorIT.java new file mode 100644 index 00000000..b77dfe86 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslatorIT.java @@ -0,0 +1,117 @@ +package de.tum.cit.ase.web.rest.errors; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import de.tum.cit.ase.IntegrationTest; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.http.MediaType; +import org.springframework.security.test.context.support.WithMockUser; +import org.springframework.test.web.servlet.MockMvc; + +/** + * Integration tests {@link ExceptionTranslator} controller advice. + */ +@WithMockUser +@AutoConfigureMockMvc +@IntegrationTest +class ExceptionTranslatorIT { + + @Autowired + private MockMvc mockMvc; + + @Test + void testConcurrencyFailure() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/concurrency-failure")) + .andExpect(status().isConflict()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE)); + } + + @Test + void testMethodArgumentNotValid() throws Exception { + mockMvc + .perform(post("/api/exception-translator-test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION)) + .andExpect(jsonPath("$.fieldErrors.[0].objectName").value("test")) + .andExpect(jsonPath("$.fieldErrors.[0].field").value("test")) + .andExpect(jsonPath("$.fieldErrors.[0].message").value("must not be null")); + } + + @Test + void testMissingServletRequestPartException() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/missing-servlet-request-part")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + void testMissingServletRequestParameterException() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/missing-servlet-request-parameter")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")); + } + + @Test + void testAccessDenied() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/access-denied")) + .andExpect(status().isForbidden()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.403")) + .andExpect(jsonPath("$.detail").value("test access denied!")); + } + + @Test + void testUnauthorized() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/unauthorized")) + .andExpect(status().isUnauthorized()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.401")) + .andExpect(jsonPath("$.path").value("/api/exception-translator-test/unauthorized")) + .andExpect(jsonPath("$.detail").value("test authentication failed!")); + } + + @Test + void testMethodNotSupported() throws Exception { + mockMvc + .perform(post("/api/exception-translator-test/access-denied")) + .andExpect(status().isMethodNotAllowed()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.405")) + .andExpect(jsonPath("$.detail").value("Request method 'POST' is not supported")); + } + + @Test + void testExceptionWithResponseStatus() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/response-status")) + .andExpect(status().isBadRequest()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.400")) + .andExpect(jsonPath("$.title").value("test response status")); + } + + @Test + void testInternalServerError() throws Exception { + mockMvc + .perform(get("/api/exception-translator-test/internal-server-error")) + .andExpect(status().isInternalServerError()) + .andExpect(content().contentType(MediaType.APPLICATION_PROBLEM_JSON)) + .andExpect(jsonPath("$.message").value("error.http.500")) + .andExpect(jsonPath("$.title").value("Internal Server Error")); + } +} diff --git a/src/test/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslatorTestController.java b/src/test/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslatorTestController.java new file mode 100644 index 00000000..e3af8165 --- /dev/null +++ b/src/test/java/de/tum/cit/ase/web/rest/errors/ExceptionTranslatorTestController.java @@ -0,0 +1,66 @@ +package de.tum.cit.ase.web.rest.errors; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; +import org.springframework.dao.ConcurrencyFailureException; +import org.springframework.http.HttpStatus; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/exception-translator-test") +public class ExceptionTranslatorTestController { + + @GetMapping("/concurrency-failure") + public void concurrencyFailure() { + throw new ConcurrencyFailureException("test concurrency failure"); + } + + @PostMapping("/method-argument") + public void methodArgument(@Valid @RequestBody TestDTO testDTO) {} + + @GetMapping("/missing-servlet-request-part") + public void missingServletRequestPartException(@RequestPart String part) {} + + @GetMapping("/missing-servlet-request-parameter") + public void missingServletRequestParameterException(@RequestParam String param) {} + + @GetMapping("/access-denied") + public void accessdenied() { + throw new AccessDeniedException("test access denied!"); + } + + @GetMapping("/unauthorized") + public void unauthorized() { + throw new BadCredentialsException("test authentication failed!"); + } + + @GetMapping("/response-status") + public void exceptionWithResponseStatus() { + throw new TestResponseStatusException(); + } + + @GetMapping("/internal-server-error") + public void internalServerError() { + throw new RuntimeException(); + } + + public static class TestDTO { + + @NotNull + private String test; + + public String getTest() { + return test; + } + + public void setTest(String test) { + this.test = test; + } + } + + @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "test response status") + @SuppressWarnings("serial") + public static class TestResponseStatusException extends RuntimeException {} +} diff --git a/src/test/resources/META-INF/spring.factories b/src/test/resources/META-INF/spring.factories new file mode 100644 index 00000000..bdee51be --- /dev/null +++ b/src/test/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.test.context.ContextCustomizerFactory = de.tum.cit.ase.\ + config.SqlTestContainersSpringContextCustomizerFactory \ No newline at end of file diff --git a/src/test/resources/config/application-testdev.yml b/src/test/resources/config/application-testdev.yml new file mode 100644 index 00000000..a61e2861 --- /dev/null +++ b/src/test/resources/config/application-testdev.yml @@ -0,0 +1,40 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration is used for unit/integration tests with testcontainers database containers. +# +# To activate this configuration launch integration tests with the 'testcontainers' profile +# +# More information on database containers: https://www.testcontainers.org/modules/databases/ +# =================================================================== + +spring: + datasource: + type: com.zaxxer.hikari.HikariDataSource + hikari: + auto-commit: false + poolName: Hikari + maximum-pool-size: 1 + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 250 + prepStmtCacheSqlLimit: 2048 + useServerPrepStmts: true + jpa: + open-in-view: false + hibernate: + ddl-auto: none + naming: + physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: false + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: false + hibernate.hbm2ddl.auto: none #TODO: temp relief for integration tests, revisit required + hibernate.type.preferred_instant_jdbc_type: TIMESTAMP + hibernate.jdbc.time_zone: UTC + hibernate.timezone.default_storage: NORMALIZE + hibernate.query.fail_on_pagination_over_collection_fetch: true diff --git a/src/test/resources/config/application-testprod.yml b/src/test/resources/config/application-testprod.yml new file mode 100644 index 00000000..60980378 --- /dev/null +++ b/src/test/resources/config/application-testprod.yml @@ -0,0 +1,40 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration is used for unit/integration tests with testcontainers database containers. +# +# To activate this configuration launch integration tests with the 'testcontainers' profile +# +# More information on database containers: https://www.testcontainers.org/modules/databases/ +# =================================================================== + +spring: + datasource: + type: com.zaxxer.hikari.HikariDataSource + hikari: + poolName: Hikari + auto-commit: false + maximum-pool-size: 1 + data-source-properties: + cachePrepStmts: true + prepStmtCacheSize: 250 + prepStmtCacheSqlLimit: 2048 + useServerPrepStmts: true + jpa: + open-in-view: false + hibernate: + ddl-auto: none + naming: + physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy + implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + properties: + hibernate.id.new_generator_mappings: true + hibernate.connection.provider_disables_autocommit: true + hibernate.cache.use_second_level_cache: false + hibernate.cache.use_query_cache: false + hibernate.generate_statistics: false + hibernate.hbm2ddl.auto: none #TODO: temp relief for integration tests, revisit required + hibernate.type.preferred_instant_jdbc_type: TIMESTAMP + hibernate.jdbc.time_zone: UTC + hibernate.timezone.default_storage: NORMALIZE + hibernate.query.fail_on_pagination_over_collection_fetch: true diff --git a/src/test/resources/config/application.yml b/src/test/resources/config/application.yml new file mode 100644 index 00000000..3a7a702a --- /dev/null +++ b/src/test/resources/config/application.yml @@ -0,0 +1,90 @@ +# =================================================================== +# Spring Boot configuration. +# +# This configuration is used for unit/integration tests. +# +# More information on profiles: https://www.jhipster.tech/profiles/ +# More information on configuration properties: https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# =================================================================== +# Standard Spring Boot properties. +# Full reference is available at: +# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +# =================================================================== + +spring: + application: + name: artemis-benchmarking + # Replace by 'prod, faker' to add the faker context and have sample data loaded in production + liquibase: + contexts: test + jackson: + serialization: + write-durations-as-timestamps: false + mail: + host: localhost + main: + allow-bean-definition-overriding: true + messages: + basename: i18n/messages + task: + execution: + thread-name-prefix: artemis-benchmarking-task- + pool: + core-size: 1 + max-size: 50 + queue-capacity: 10000 + scheduling: + thread-name-prefix: artemis-benchmarking-scheduling- + pool: + size: 20 + thymeleaf: + mode: HTML + +server: + port: 10344 + address: localhost + +# =================================================================== +# JHipster specific properties +# +# Full reference is available at: https://www.jhipster.tech/common-application-properties/ +# =================================================================== +jhipster: + clientApp: + name: 'artemisBenchmarkingApp' + mail: + from: artemis-benchmarking@localhost.com + base-url: http://127.0.0.1:8080 + logging: + # To test json console appender + use-json-format: false + logstash: + enabled: false + host: localhost + port: 5000 + ring-buffer-size: 512 + security: + authentication: + jwt: + # This token must be encoded using Base64 (you can type `echo 'secret-key'|base64` on your command line) + base64-secret: YjQzZmE3YzMxODc2NDE1NDY1M2JlYjQxMjhjZWNiOGU1OWM1ZGFhYmY1OWU5ODI0MWMwMDYwY2ZlZDUwZWUzOWY2OGRmY2EwMDJlODY4NGFiNWNmZjhjMWUyZDRjY2IxZTIxOTBlZGI0NzRlMDJjNGNlMTcwZjE2ODRmMjUxNjc= + # Token is valid 24 hours + token-validity-in-seconds: 86400 + token-validity-in-seconds-for-remember-me: 86400 + +# =================================================================== +# Application specific properties +# Add your own application properties here, see the ApplicationProperties class +# to have type-safe configuration, like in the JHipsterProperties above +# +# More documentation is available at: +# https://www.jhipster.tech/common-application-properties/ +# =================================================================== + +# application: +management: + health: + mail: + enabled: false diff --git a/src/test/resources/i18n/messages_en.properties b/src/test/resources/i18n/messages_en.properties new file mode 100644 index 00000000..f19db869 --- /dev/null +++ b/src/test/resources/i18n/messages_en.properties @@ -0,0 +1 @@ +email.test.title=test title diff --git a/src/test/resources/junit-platform.properties b/src/test/resources/junit-platform.properties new file mode 100644 index 00000000..714da79d --- /dev/null +++ b/src/test/resources/junit-platform.properties @@ -0,0 +1,4 @@ +junit.jupiter.execution.timeout.default = 15 s +junit.jupiter.execution.timeout.testable.method.default = 15 s +junit.jupiter.execution.timeout.beforeall.method.default = 60 s +junit.jupiter.testclass.order.default=de.tum.cit.ase.config.SpringBootTestClassOrderer diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml new file mode 100644 index 00000000..897e1c29 --- /dev/null +++ b/src/test/resources/logback.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/resources/templates/mail/activationEmail.html b/src/test/resources/templates/mail/activationEmail.html new file mode 100644 index 00000000..6db87f68 --- /dev/null +++ b/src/test/resources/templates/mail/activationEmail.html @@ -0,0 +1,19 @@ + + + + JHipster activation + + + +

Dear

+

Your JHipster account has been created, please click on the URL below to activate it:

+

+ Activation link +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/src/test/resources/templates/mail/creationEmail.html b/src/test/resources/templates/mail/creationEmail.html new file mode 100644 index 00000000..07075e0e --- /dev/null +++ b/src/test/resources/templates/mail/creationEmail.html @@ -0,0 +1,19 @@ + + + + JHipster creation + + + +

Dear

+

Your JHipster account has been created, please click on the URL below to access it:

+

+ Login link +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/src/test/resources/templates/mail/passwordResetEmail.html b/src/test/resources/templates/mail/passwordResetEmail.html new file mode 100644 index 00000000..6ddc5d29 --- /dev/null +++ b/src/test/resources/templates/mail/passwordResetEmail.html @@ -0,0 +1,21 @@ + + + + JHipster password reset + + + +

Dear

+

+ For your JHipster account a password reset was requested, please click on the URL below to reset it: +

+

+ Login link +

+

+ Regards, +
+ JHipster. +

+ + diff --git a/src/test/resources/templates/mail/testEmail.html b/src/test/resources/templates/mail/testEmail.html new file mode 100644 index 00000000..a4ca16a7 --- /dev/null +++ b/src/test/resources/templates/mail/testEmail.html @@ -0,0 +1 @@ + diff --git a/tsconfig.app.json b/tsconfig.app.json new file mode 100644 index 00000000..489b7f58 --- /dev/null +++ b/tsconfig.app.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./build/out-tsc/app", + "types": ["@angular/localize"] + }, + "files": ["src/main/webapp/sockjs-client.polyfill.ts", "src/main/webapp/main.ts"], + "include": ["src/main/webapp/**/*.d.ts"] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..d44168b5 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "baseUrl": "src/main/webapp/", + "outDir": "./build/out-tsc/root", + "forceConsistentCasingInFileNames": true, + "strict": true, + "strictNullChecks": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "moduleResolution": "node", + "importHelpers": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "useDefineForClassFields": false, + "target": "es2022", + "module": "es2020", + "types": [], + "lib": ["es2018", "es2020", "dom"] + }, + "references": [ + { + "path": "tsconfig.spec.json" + } + ], + "angularCompilerOptions": { + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true, + "preserveWhitespaces": true + } +} diff --git a/tsconfig.spec.json b/tsconfig.spec.json new file mode 100644 index 00000000..eb321380 --- /dev/null +++ b/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/main/webapp/**/*.ts"], + "compilerOptions": { + "composite": true, + "outDir": "build/out-tsc/spec", + "types": ["jest", "node"] + } +} diff --git a/webpack/environment.js b/webpack/environment.js new file mode 100644 index 00000000..d0211776 --- /dev/null +++ b/webpack/environment.js @@ -0,0 +1,6 @@ +module.exports = { + I18N_HASH: 'generated_hash', + SERVER_API_URL: '', + __VERSION__: process.env.hasOwnProperty('APP_VERSION') ? process.env.APP_VERSION : 'DEV', + __DEBUG_INFO_ENABLED__: false, +}; diff --git a/webpack/logo-jhipster.png b/webpack/logo-jhipster.png new file mode 100644 index 0000000000000000000000000000000000000000..e301aa90f75e3ef8b5c5bf053186f3a02e7605d2 GIT binary patch literal 3326 zcmb_ehdY~X7mw<)i`uPGqoo=YQK6`vATg49Yj36KXB9>4lA1M&4q{bHr36i4RW(*6 z+NQf!M2(8^rB+JuMceOv|A6niuk)O9?%#9H@BHrPx}N8H(6%rOK5j{F006)Tu{5;@ z063U?*I`aJ0$qrNvo~jLtr2GItx;H`QACqrL=)Q^Mc@qg?03Eg{>j6CA>mE#sF%>h zZde8dmQIFckZm&d{2%*;{ImTV-%BVq=@hoNOz8TD^S={~!kcVUyJ33;6CvarjvgOZnB7JW7o5Blel)Ha2&hkZw>4McK+M56E>AiI+<($iKCp{m>Xv;ghTjch9m|y~Rb$6N~zhBbS>tXM=MWr8~ zob~*=7QR;WYVsLI9`@G?e6wP9eK}!cTP7-81UcX0(A{i^%NWOJOE2y2?mlkgnw|jw zctjwk7ZA}L3(pS;0^|Sy*^Li7q0jndj4Z?`6vTj8q3i8e#LeZBU2vKxogx3rW}gQqAsoT zGaPX0Q@Wa%j=JcbP;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yOQ=^~T8Tdw`3xP(1}Y-Kt{ zMa_a{)2Gg!)(C5o%(u6p1%jUtqofnSRCVAYpBUU9Ugs%g^vyeUG=MW;#(2h>$NNEh zgvEoKx-$mN?KGpeMQVJHCmX&-N#C%Gfn%F*O0>QJrPinrt))kRdM7lyMJU0+TW52= zwoRSbK3*!UPngrh>4@JB94Y=c*@ZqX5TZR6J{>7|V{nuytIjN&MI)|a;Nv|Pf;ldF81pSTCw=qkA3NUXX1x6D%zew+=iC- zknUgSG7PFm1s~0#9ZY}A5_qMuZ0FlGJQ374Vpy{f&3oAN%1Ysn3XbueI#7JArw?Lg zf|+iAlZj~r2nH;k3zfUwTR!udH3m2Oi~X@P*aV?aUmtuFs5pat7eKDeY^3o>)mlwR z9aak$sc3TQb(hcufpkW|)waC%sVtHxv)~X&DZsx^LmOjA7jpw0%--VRvw!pDke28q z098@jXWJDeR{`yU4O`K6txL#uMCIf8fv)NIC*r{c6F+Hmb@c|`}z85ggK-LW%)ONWtx#9+fhw*x{yBtOr}X1X1S zgZQPaz5{Mn9ZkVU;>^xeR|qtGlheF<6fw$4O{v$Gytv(zX3$yM<&)CJly1fFVq5T$ zP?L-XAN54)*fEB?{9?O0hS#dz~?f2*!k77A+P;evuFsMsJ~X@V&HUcgs(dQ$~YIjeg4^{ zv2)p`UTXqU%+~E`T2o+|!uREMn$fR+&4JxkK?L&uu|)W^*Y7*RsVaNC5Hpx5*4QKY EKQ4Pe { + // PLUGINS + if (config.mode === 'development') { + config.plugins.push( + new ESLintPlugin({ + baseConfig: { + parserOptions: { + project: ['../tsconfig.app.json'], + }, + }, + }), + new WebpackNotifierPlugin({ + title: 'Artemis Benchmarking', + contentImage: path.join(__dirname, 'logo-jhipster.png'), + }), + ); + } + + // configuring proxy for back end service + const tls = Boolean(config.devServer && config.devServer.https); + if (config.devServer) { + config.devServer.proxy = proxyConfig({ tls }); + } + + if (targetOptions.target === 'serve' || config.watch) { + config.plugins.push( + new BrowserSyncPlugin( + { + host: 'localhost', + port: 9000, + https: tls, + proxy: { + target: `http${tls ? 's' : ''}://localhost:${targetOptions.target === 'serve' ? '4200' : '8080'}`, + ws: true, + proxyOptions: { + changeOrigin: false, //pass the Host header to the backend unchanged https://github.com/Browsersync/browser-sync/issues/430 + }, + }, + socket: { + clients: { + heartbeatTimeout: 60000, + }, + }, + /* + ghostMode: { // uncomment this part to disable BrowserSync ghostMode; https://github.com/jhipster/generator-jhipster/issues/11116 + clicks: false, + location: false, + forms: false, + scroll: false, + }, + */ + }, + { + reload: targetOptions.target === 'build', // enabled for build --watch + }, + ), + ); + } + + if (config.mode === 'production') { + config.plugins.push( + new BundleAnalyzerPlugin({ + analyzerMode: 'static', + openAnalyzer: false, + // Webpack statistics in temporary folder + reportFilename: '../../../stats.html', + }), + ); + } + + const patterns = [ + { + // https://github.com/swagger-api/swagger-ui/blob/v4.6.1/swagger-ui-dist-package/README.md + context: require('swagger-ui-dist').getAbsoluteFSPath(), + from: '*.{js,css,html,png}', + to: 'swagger-ui/', + globOptions: { ignore: ['**/index.html'] }, + }, + { + from: path.join(path.dirname(require.resolve('axios/package.json')), 'dist/axios.min.js'), + to: 'swagger-ui/', + }, + { from: './src/main/webapp/swagger-ui/', to: 'swagger-ui/' }, + // jhipster-needle-add-assets-to-webpack - JHipster will add/remove third-party resources in this array + ]; + + if (patterns.length > 0) { + config.plugins.push(new CopyWebpackPlugin({ patterns })); + } + + config.plugins.push( + new webpack.DefinePlugin({ + // APP_VERSION is passed as an environment variable from the Gradle / Maven build tasks. + __VERSION__: JSON.stringify(environment.__VERSION__), + __DEBUG_INFO_ENABLED__: environment.__DEBUG_INFO_ENABLED__ || config.mode === 'development', + // The root URL for API calls, ending with a '/' - for example: `"https://www.jhipster.tech:8081/myservice/"`. + // If this URL is left empty (""), then it will be relative to the current context. + // If you use an API server, in `prod` mode, you will need to enable CORS + // (see the `jhipster.cors` common JHipster property in the `application-*.yml` configurations) + SERVER_API_URL: JSON.stringify(environment.SERVER_API_URL), + }), + ); + + config = merge( + config, + // jhipster-needle-add-webpack-config - JHipster will add custom config + ); + + return config; +}; From 32db25632085baec45cf91d3daf4abece3d2cfe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Bo=CC=88hm?= Date: Fri, 5 Jan 2024 17:32:21 +0100 Subject: [PATCH 2/2] Generated with JHipster 8.1.0 --- .yo-rc.json | 2 +- README.md | 24 +- angular.json | 6 +- build.gradle | 4 +- gradle.properties | 22 +- gradle/wrapper/gradle-wrapper.properties | 2 +- package.json | 76 ++--- sonar-project.properties | 4 +- src/main/docker/monitoring.yml | 4 +- src/main/docker/sonar.yml | 2 +- .../de/tum/cit/ase/GeneratedByJHipster.java | 2 +- .../de/tum/cit/ase/service/MailService.java | 24 +- .../de/tum/cit/ase/web/rest/UserResource.java | 4 +- src/main/resources/config/application.yml | 15 +- .../account/activate/activate.component.html | 20 +- .../password-reset-finish.component.html | 152 +++++----- .../init/password-reset-init.component.html | 87 +++--- .../password-strength-bar.component.ts | 2 +- .../account/password/password.component.html | 176 ++++++------ .../account/register/register.component.html | 264 ++++++++++-------- .../account/settings/settings.component.html | 190 +++++++------ .../webapp/app/admin/admin-routing.module.ts | 48 ---- src/main/webapp/app/admin/admin.routes.ts | 43 +++ .../configuration.component.html | 103 ++++--- .../webapp/app/admin/docs/docs.component.ts | 2 +- .../app/admin/health/health.component.html | 50 ++-- .../health/modal/health-modal.component.html | 48 ++-- .../webapp/app/admin/logs/logs.component.html | 142 +++++----- .../jvm-memory/jvm-memory.component.html | 47 ++-- .../metrics-cache.component.html | 84 +++--- .../metrics-datasource.component.html | 112 ++++---- .../metrics-endpoints-requests.component.html | 46 +-- .../metrics-garbagecollector.component.html | 158 ++++++----- .../metrics-modal-threads.component.html | 116 ++++---- .../metrics-request.component.html | 58 ++-- .../metrics-system.component.html | 100 +++---- .../app/admin/metrics/metrics.component.html | 78 +++--- .../app/admin/tracker/tracker.component.html | 14 +- ...er-management-delete-dialog.component.html | 34 +-- .../user-management-detail.component.html | 101 +++---- .../list/user-management.component.html | 179 ++++++------ .../user-management-update.component.html | 86 +++--- src/main/webapp/app/app-routing.module.ts | 55 ---- src/main/webapp/app/app.component.ts | 36 +++ src/main/webapp/app/app.config.ts | 36 +++ src/main/webapp/app/app.module.ts | 56 ---- src/main/webapp/app/app.routes.ts | 46 +++ .../webapp/app/core/util/data-util.service.ts | 2 +- .../core/util/event-manager.service.spec.ts | 24 +- .../app/entities/entity-routing.module.ts | 11 - src/main/webapp/app/entities/entity.routes.ts | 7 + src/main/webapp/app/home/home.component.html | 44 +-- src/main/webapp/app/home/home.component.ts | 2 +- .../app/layouts/error/error.component.html | 4 +- .../app/layouts/main/main.component.spec.ts | 2 +- .../webapp/app/layouts/main/main.component.ts | 6 +- .../webapp/app/layouts/main/main.module.ts | 13 - .../app/layouts/navbar/navbar.component.html | 169 +++++------ .../app/layouts/navbar/navbar.component.ts | 2 +- .../profiles/page-ribbon.component.scss | 2 +- .../layouts/profiles/page-ribbon.component.ts | 10 +- .../webapp/app/login/login.component.html | 10 +- .../shared/alert/alert-error.component.html | 14 +- .../app/shared/alert/alert.component.html | 14 +- .../app/shared/filter/filter.component.html | 28 +- .../app/shared/filter/filter.model.spec.ts | 2 +- .../app/shared/sort/sort-by.directive.spec.ts | 11 +- src/main/webapp/bootstrap.ts | 8 +- src/main/webapp/content/scss/global.scss | 2 +- src/main/webapp/index.html | 4 +- .../de/tum/cit/ase/service/UserServiceIT.java | 1 + .../ExceptionTranslatorTestController.java | 4 +- 72 files changed, 1782 insertions(+), 1574 deletions(-) delete mode 100644 src/main/webapp/app/admin/admin-routing.module.ts create mode 100644 src/main/webapp/app/admin/admin.routes.ts delete mode 100644 src/main/webapp/app/app-routing.module.ts create mode 100644 src/main/webapp/app/app.component.ts create mode 100644 src/main/webapp/app/app.config.ts delete mode 100644 src/main/webapp/app/app.module.ts create mode 100644 src/main/webapp/app/app.routes.ts delete mode 100644 src/main/webapp/app/entities/entity-routing.module.ts create mode 100644 src/main/webapp/app/entities/entity.routes.ts delete mode 100644 src/main/webapp/app/layouts/main/main.module.ts diff --git a/.yo-rc.json b/.yo-rc.json index 2b590cde..5d353ae9 100644 --- a/.yo-rc.json +++ b/.yo-rc.json @@ -18,7 +18,7 @@ "enableTranslation": false, "entities": [], "gradleEnterpriseHost": null, - "jhipsterVersion": "8.0.0", + "jhipsterVersion": "8.1.0", "jwtSecretKey": "YjQzZmE3YzMxODc2NDE1NDY1M2JlYjQxMjhjZWNiOGU1OWM1ZGFhYmY1OWU5ODI0MWMwMDYwY2ZlZDUwZWUzOWY2OGRmY2EwMDJlODY4NGFiNWNmZjhjMWUyZDRjY2IxZTIxOTBlZGI0NzRlMDJjNGNlMTcwZjE2ODRmMjUxNjc=", "messageBroker": false, "microfrontend": null, diff --git a/README.md b/README.md index e7358980..9933ecf3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # artemis-benchmarking -This application was generated using JHipster 8.0.0, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v8.0.0](https://www.jhipster.tech/documentation-archive/v8.0.0). +This application was generated using JHipster 8.1.0, you can find documentation and help at [https://www.jhipster.tech/documentation-archive/v8.1.0](https://www.jhipster.tech/documentation-archive/v8.1.0). ## Project Structure @@ -74,7 +74,7 @@ The `npm run` command will list all of the scripts available to run for this pro JHipster ships with PWA (Progressive Web App) support, and it's turned off by default. One of the main components of a PWA is a service worker. -The service worker initialization code is disabled by default. To enable it, uncomment the following code in `src/main/webapp/app/app.module.ts`: +The service worker initialization code is disabled by default. To enable it, uncomment the following code in `src/main/webapp/app/app.config.ts`: ```typescript ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }), @@ -95,7 +95,7 @@ npm install --save-dev --save-exact @types/leaflet ``` Then you would import the JS and CSS files specified in library's installation instructions so that [Webpack][] knows about them: -Edit [src/main/webapp/app/app.module.ts](src/main/webapp/app/app.module.ts) file: +Edit [src/main/webapp/app/app.config.ts](src/main/webapp/app/app.config.ts) file: ``` import 'leaflet/dist/leaflet.js'; @@ -126,7 +126,7 @@ will generate few files: ``` create src/main/webapp/app/my-component/my-component.component.html create src/main/webapp/app/my-component/my-component.component.ts -update src/main/webapp/app/app.module.ts +update src/main/webapp/app/app.config.ts ``` ## Building for production @@ -257,18 +257,18 @@ For more information refer to [Using Docker and Docker-Compose][], this page als To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information. [JHipster Homepage and latest documentation]: https://www.jhipster.tech -[JHipster 8.0.0 archive]: https://www.jhipster.tech/documentation-archive/v8.0.0 -[Using JHipster in development]: https://www.jhipster.tech/documentation-archive/v8.0.0/development/ -[Using Docker and Docker-Compose]: https://www.jhipster.tech/documentation-archive/v8.0.0/docker-compose -[Using JHipster in production]: https://www.jhipster.tech/documentation-archive/v8.0.0/production/ -[Running tests page]: https://www.jhipster.tech/documentation-archive/v8.0.0/running-tests/ -[Code quality page]: https://www.jhipster.tech/documentation-archive/v8.0.0/code-quality/ -[Setting up Continuous Integration]: https://www.jhipster.tech/documentation-archive/v8.0.0/setting-up-ci/ +[JHipster 8.1.0 archive]: https://www.jhipster.tech/documentation-archive/v8.1.0 +[Using JHipster in development]: https://www.jhipster.tech/documentation-archive/v8.1.0/development/ +[Using Docker and Docker-Compose]: https://www.jhipster.tech/documentation-archive/v8.1.0/docker-compose +[Using JHipster in production]: https://www.jhipster.tech/documentation-archive/v8.1.0/production/ +[Running tests page]: https://www.jhipster.tech/documentation-archive/v8.1.0/running-tests/ +[Code quality page]: https://www.jhipster.tech/documentation-archive/v8.1.0/code-quality/ +[Setting up Continuous Integration]: https://www.jhipster.tech/documentation-archive/v8.1.0/setting-up-ci/ [Node.js]: https://nodejs.org/ [NPM]: https://www.npmjs.com/ [OpenAPI-Generator]: https://openapi-generator.tech [Swagger-Editor]: https://editor.swagger.io -[Doing API-First development]: https://www.jhipster.tech/documentation-archive/v8.0.0/doing-api-first-development/ +[Doing API-First development]: https://www.jhipster.tech/documentation-archive/v8.1.0/doing-api-first-development/ [Webpack]: https://webpack.github.io/ [BrowserSync]: https://www.browsersync.io/ [Jest]: https://facebook.github.io/jest/ diff --git a/angular.json b/angular.json index 99759295..0770fd9f 100644 --- a/angular.json +++ b/angular.json @@ -76,15 +76,15 @@ "serve": { "builder": "@angular-builders/custom-webpack:dev-server", "options": { - "browserTarget": "artemis-benchmarking:build:development", + "buildTarget": "artemis-benchmarking:build:development", "port": 4200 }, "configurations": { "production": { - "browserTarget": "artemis-benchmarking:build:production" + "buildTarget": "artemis-benchmarking:build:production" }, "development": { - "browserTarget": "artemis-benchmarking:build:development" + "buildTarget": "artemis-benchmarking:build:development" } }, "defaultConfiguration": "development" diff --git a/build.gradle b/build.gradle index 19253437..5871569f 100644 --- a/build.gradle +++ b/build.gradle @@ -232,7 +232,7 @@ task cleanResources(type: Delete) { } wrapper { - gradleVersion = "8.4" + gradleVersion = "8.5" } task webapp_test(type: NpmTask) { @@ -270,7 +270,7 @@ task webapp_test(type: NpmTask) { if (project.hasProperty("nodeInstall")) { node { version = "18.18.2" - npmVersion = "10.2.2" + npmVersion = "10.2.4" download = true } diff --git a/gradle.properties b/gradle.properties index feed280c..1e1edb83 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,17 +2,17 @@ rootProject.name=artemis-benchmarking profile=dev # Dependency versions -jhipsterDependenciesVersion=8.0.0 +jhipsterDependenciesVersion=8.1.0 # The spring-boot version should match the one managed by -# https://mvnrepository.com/artifact/tech.jhipster/jhipster-dependencies/8.0.0 -springBootVersion=3.1.5 +# https://mvnrepository.com/artifact/tech.jhipster/jhipster-dependencies/8.1.0 +springBootVersion=3.2.0 # The hibernate version should match the one managed by -# https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/3.1.5 --> -hibernateVersion=6.2.13.Final +# https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/3.2.0 --> +hibernateVersion=6.3.1.Final mapstructVersion=1.5.5.Final -archunitJunit5Version=1.1.0 +archunitJunit5Version=1.2.1 jacksonDatabindNullableVersion=0.2.6 -hazelcastSpringVersion=5.3.5 +hazelcastSpringVersion=5.3.6 @@ -23,14 +23,14 @@ jibPluginVersion=3.4.0 gitPropertiesPluginVersion=2.4.1 gradleNodePluginVersion=7.0.1 sonarqubePluginVersion=4.4.1.3373 -spotlessPluginVersion=6.22.0 -openapiPluginVersion=7.0.1 +spotlessPluginVersion=6.23.3 +openapiPluginVersion=7.1.0 noHttpCheckstyleVersion=0.0.11 -checkstyleVersion=10.12.4 +checkstyleVersion=10.12.5 modernizerPluginVersion=1.9.0 liquibaseTaskPrefix=liquibase -liquibasePluginVersion=2.2.0 +liquibasePluginVersion=2.2.1 liquibaseVersion=4.24.0 liquibaseHibernate6Version=4.24.0 # jhipster-needle-gradle-property - JHipster will add additional properties here diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e411586a..a5952066 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/package.json b/package.json index 9c3d1dfe..39759cc0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "app:start": "./gradlew", "app:up": "docker compose -f src/main/docker/app.yml up --wait", - "backend:build-cache": "npm run backend:info && npm run backend:nohttp:test && npm run ci:e2e:package", + "backend:build-cache": "npm run backend:info && npm run backend:nohttp:test && npm run ci:e2e:package -- -x webapp -x webapp_test", "backend:doc:test": "./gradlew javadoc -x webapp -x webapp_test", "backend:info": "./gradlew -v", "backend:nohttp:test": "./gradlew checkstyleNohttp -x webapp -x webapp_test", @@ -69,67 +69,67 @@ "packaging": "jar" }, "dependencies": { - "@angular/common": "16.2.11", - "@angular/compiler": "16.2.11", - "@angular/core": "16.2.11", - "@angular/forms": "16.2.11", - "@angular/localize": "16.2.11", - "@angular/platform-browser": "16.2.11", - "@angular/platform-browser-dynamic": "16.2.11", - "@angular/router": "16.2.11", - "@fortawesome/angular-fontawesome": "0.13.0", - "@fortawesome/fontawesome-svg-core": "6.4.2", - "@fortawesome/free-solid-svg-icons": "6.4.2", - "@ng-bootstrap/ng-bootstrap": "15.1.2", + "@angular/common": "17.0.6", + "@angular/compiler": "17.0.6", + "@angular/core": "17.0.6", + "@angular/forms": "17.0.6", + "@angular/localize": "17.0.6", + "@angular/platform-browser": "17.0.6", + "@angular/platform-browser-dynamic": "17.0.6", + "@angular/router": "17.0.6", + "@fortawesome/angular-fontawesome": "0.14.0", + "@fortawesome/fontawesome-svg-core": "6.5.1", + "@fortawesome/free-solid-svg-icons": "6.5.1", + "@ng-bootstrap/ng-bootstrap": "16.0.0", "@popperjs/core": "2.11.8", "@stomp/rx-stomp": "1.2.0", "bootstrap": "5.3.2", "dayjs": "1.11.10", - "ngx-infinite-scroll": "16.0.0", + "ngx-infinite-scroll": "17.0.0", "rxjs": "7.8.1", "sockjs-client": "1.6.1", "tslib": "2.6.2", - "zone.js": "0.13.3" + "zone.js": "0.14.2" }, "devDependencies": { - "@angular-builders/custom-webpack": "16.0.1", - "@angular-builders/jest": "16.0.1", - "@angular-devkit/build-angular": "16.2.9", - "@angular-eslint/eslint-plugin": "16.2.0", - "@angular/cli": "16.2.9", - "@angular/compiler-cli": "16.2.11", - "@angular/service-worker": "16.2.11", - "@types/jest": "29.5.7", - "@types/node": "18.18.8", + "@angular-builders/custom-webpack": "17.0.0", + "@angular-builders/jest": "17.0.0", + "@angular-devkit/build-angular": "17.0.6", + "@angular-eslint/eslint-plugin": "17.1.1", + "@angular/cli": "17.0.6", + "@angular/compiler-cli": "17.0.6", + "@angular/service-worker": "17.0.6", + "@types/jest": "29.5.11", + "@types/node": "18.19.3", "@types/sockjs-client": "1.5.1", - "@typescript-eslint/eslint-plugin": "6.9.1", - "@typescript-eslint/parser": "6.9.1", + "@typescript-eslint/eslint-plugin": "6.13.2", + "@typescript-eslint/parser": "6.13.2", "browser-sync": "2.29.3", "browser-sync-webpack-plugin": "2.3.0", "buffer": "6.0.3", "concurrently": "8.2.2", "copy-webpack-plugin": "11.0.0", - "eslint": "8.52.0", - "eslint-config-prettier": "9.0.0", + "eslint": "8.55.0", + "eslint-config-prettier": "9.1.0", "eslint-webpack-plugin": "4.0.1", - "generator-jhipster": "8.0.0", + "generator-jhipster": "8.1.0", "husky": "8.0.3", "jest": "29.7.0", "jest-date-mock": "1.0.8", "jest-environment-jsdom": "29.7.0", "jest-junit": "16.0.0", - "jest-preset-angular": "13.1.2", + "jest-preset-angular": "13.1.4", "jest-sonar": "0.2.16", - "lint-staged": "15.0.2", - "prettier": "3.0.3", - "prettier-plugin-java": "2.3.1", - "prettier-plugin-packagejson": "2.4.6", + "lint-staged": "15.2.0", + "prettier": "3.1.0", + "prettier-plugin-java": "2.5.0", + "prettier-plugin-packagejson": "2.4.7", "rimraf": "5.0.5", - "swagger-ui-dist": "5.9.1", + "swagger-ui-dist": "5.10.3", "ts-jest": "29.1.1", - "typescript": "5.1.6", - "wait-on": "7.0.1", - "webpack-bundle-analyzer": "4.9.1", + "typescript": "5.2.2", + "wait-on": "7.2.0", + "webpack-bundle-analyzer": "4.10.1", "webpack-merge": "5.10.0", "webpack-notifier": "1.15.0" }, diff --git a/sonar-project.properties b/sonar-project.properties index 725fdc05..de46397e 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,8 +1,8 @@ sonar.projectKey = artemis-benchmarking sonar.projectName = artemis-benchmarking generated by jhipster -# Typescript tests files must be inside sources and tests, othewise `INFO: Test execution data ignored for 80 unknown files, including:` is -# shown. +# Typescript tests files must be inside sources and tests, otherwise `INFO: Test execution data ignored for 80 unknown files, including:` +# is shown. sonar.sources = src sonar.tests = src sonar.host.url = http://localhost:9001 diff --git a/src/main/docker/monitoring.yml b/src/main/docker/monitoring.yml index 36396200..27bf01ca 100644 --- a/src/main/docker/monitoring.yml +++ b/src/main/docker/monitoring.yml @@ -2,7 +2,7 @@ name: artemis-benchmarking services: prometheus: - image: prom/prometheus:v2.47.2 + image: prom/prometheus:v2.48.0 volumes: - ./prometheus/:/etc/prometheus/ command: @@ -15,7 +15,7 @@ services: # grafana/provisioning/datasources/datasource.yml network_mode: 'host' # to test locally running service grafana: - image: grafana/grafana:10.2.0 + image: grafana/grafana:10.2.2 volumes: - ./grafana/provisioning/:/etc/grafana/provisioning/ environment: diff --git a/src/main/docker/sonar.yml b/src/main/docker/sonar.yml index 9e66c6e0..7ce528d6 100644 --- a/src/main/docker/sonar.yml +++ b/src/main/docker/sonar.yml @@ -3,7 +3,7 @@ name: artemis-benchmarking services: sonar: container_name: sonarqube - image: sonarqube:10.2.1-community + image: sonarqube:10.3.0-community # Forced authentication redirect for UI is turned off for out of the box experience while trying out SonarQube # For real use cases delete SONAR_FORCEAUTHENTICATION variable or set SONAR_FORCEAUTHENTICATION=true environment: diff --git a/src/main/java/de/tum/cit/ase/GeneratedByJHipster.java b/src/main/java/de/tum/cit/ase/GeneratedByJHipster.java index 86f4f57b..ca7e782c 100644 --- a/src/main/java/de/tum/cit/ase/GeneratedByJHipster.java +++ b/src/main/java/de/tum/cit/ase/GeneratedByJHipster.java @@ -6,7 +6,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -@Generated(value = "JHipster", comments = "Generated by JHipster 8.0.0") +@Generated(value = "JHipster", comments = "Generated by JHipster 8.1.0") @Retention(RetentionPolicy.SOURCE) @Target({ ElementType.TYPE }) public @interface GeneratedByJHipster { diff --git a/src/main/java/de/tum/cit/ase/service/MailService.java b/src/main/java/de/tum/cit/ase/service/MailService.java index a33b673f..d18b25f7 100644 --- a/src/main/java/de/tum/cit/ase/service/MailService.java +++ b/src/main/java/de/tum/cit/ase/service/MailService.java @@ -7,9 +7,7 @@ import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; -import org.springframework.context.annotation.Lazy; import org.springframework.mail.MailException; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; @@ -20,7 +18,7 @@ import tech.jhipster.config.JHipsterProperties; /** - * Service for sending emails. + * Service for sending emails asynchronously. *

* We use the {@link Async} annotation to send emails asynchronously. */ @@ -41,10 +39,6 @@ public class MailService { private final SpringTemplateEngine templateEngine; - @Autowired - @Lazy - private MailService self; - public MailService( JHipsterProperties jHipsterProperties, JavaMailSender javaMailSender, @@ -59,6 +53,10 @@ public MailService( @Async public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) { + this.sendEmailSync(to, subject, content, isMultipart, isHtml); + } + + private void sendEmailSync(String to, String subject, String content, boolean isMultipart, boolean isHtml) { log.debug( "Send email[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}", isMultipart, @@ -85,6 +83,10 @@ public void sendEmail(String to, String subject, String content, boolean isMulti @Async public void sendEmailFromTemplate(User user, String templateName, String titleKey) { + this.sendEmailFromTemplateSync(user, templateName, titleKey); + } + + private void sendEmailFromTemplateSync(User user, String templateName, String titleKey) { if (user.getEmail() == null) { log.debug("Email doesn't exist for user '{}'", user.getLogin()); return; @@ -95,24 +97,24 @@ public void sendEmailFromTemplate(User user, String templateName, String titleKe context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl()); String content = templateEngine.process(templateName, context); String subject = messageSource.getMessage(titleKey, null, locale); - self.sendEmail(user.getEmail(), subject, content, false, true); + this.sendEmailSync(user.getEmail(), subject, content, false, true); } @Async public void sendActivationEmail(User user) { log.debug("Sending activation email to '{}'", user.getEmail()); - self.sendEmailFromTemplate(user, "mail/activationEmail", "email.activation.title"); + this.sendEmailFromTemplateSync(user, "mail/activationEmail", "email.activation.title"); } @Async public void sendCreationEmail(User user) { log.debug("Sending creation email to '{}'", user.getEmail()); - self.sendEmailFromTemplate(user, "mail/creationEmail", "email.activation.title"); + this.sendEmailFromTemplateSync(user, "mail/creationEmail", "email.activation.title"); } @Async public void sendPasswordResetMail(User user) { log.debug("Sending password reset email to '{}'", user.getEmail()); - self.sendEmailFromTemplate(user, "mail/passwordResetEmail", "email.reset.title"); + this.sendEmailFromTemplateSync(user, "mail/passwordResetEmail", "email.reset.title"); } } diff --git a/src/main/java/de/tum/cit/ase/web/rest/UserResource.java b/src/main/java/de/tum/cit/ase/web/rest/UserResource.java index 218e5fb4..4761d023 100644 --- a/src/main/java/de/tum/cit/ase/web/rest/UserResource.java +++ b/src/main/java/de/tum/cit/ase/web/rest/UserResource.java @@ -188,7 +188,7 @@ private boolean onlyContainsAllowedProperties(Pageable pageable) { */ @GetMapping("/users/{login}") @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") - public ResponseEntity getUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) { + public ResponseEntity getUser(@PathVariable("login") @Pattern(regexp = Constants.LOGIN_REGEX) String login) { log.debug("REST request to get User : {}", login); return ResponseUtil.wrapOrNotFound(userService.getUserWithAuthoritiesByLogin(login).map(AdminUserDTO::new)); } @@ -201,7 +201,7 @@ public ResponseEntity getUser(@PathVariable @Pattern(regexp = Cons */ @DeleteMapping("/users/{login}") @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") - public ResponseEntity deleteUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) { + public ResponseEntity deleteUser(@PathVariable("login") @Pattern(regexp = Constants.LOGIN_REGEX) String login) { log.debug("REST request to delete User: {}", login); userService.deleteUser(login); return ResponseEntity diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 9076ace5..5b157c52 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -68,6 +68,10 @@ management: export: enabled: true step: 60 + observations: + key-values: + application: ${spring.application.name} + metrics: enable: http: true jvm: true @@ -79,13 +83,10 @@ management: all: true percentiles: all: 0, 0.5, 0.75, 0.95, 0.99, 1.0 - tags: - application: ${spring.application.name} - web: - server: - request: - autotime: - enabled: true + data: + repository: + autotime: + enabled: true spring: application: diff --git a/src/main/webapp/app/account/activate/activate.component.html b/src/main/webapp/app/account/activate/activate.component.html index 3175114e..e04382c3 100644 --- a/src/main/webapp/app/account/activate/activate.component.html +++ b/src/main/webapp/app/account/activate/activate.component.html @@ -2,15 +2,17 @@

Activation

- -
- Your user account has been activated. Please - sign in. -
- -
- Your user could not be activated. Please use the registration form to sign up. -
+ @if (success) { +
+ Your user account has been activated. Please + sign in. +
+ } + @if (error) { +
+ Your user could not be activated. Please use the registration form to sign up. +
+ }
diff --git a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html index 286aad32..2e539a11 100644 --- a/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html +++ b/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.html @@ -3,95 +3,107 @@

Reset password

-
The reset key is missing.
+ @if (initialized && !key) { +
The reset key is missing.
+ } -
- Choose a new password -
+ @if (key && !success) { +
+ Choose a new password +
+ } -
- Your password couldn't be reset. Remember a password request is only valid for 24 hours. -
+ @if (error) { +
+ Your password couldn't be reset. Remember a password request is only valid for 24 hours. +
+ } -
- Your password has been reset. Please - sign in. -
+ @if (success) { +
+ Your password has been reset. Please + sign in. +
+ } -
The password and its confirmation do not match!
+ @if (doNotMatch) { +
The password and its confirmation do not match!
+ } -
-
-
- - + @if (key && !success) { +
+ +
+ + -
- Your password is required. + ) { +
+ @if (passwordForm.get('newPassword')?.errors?.required) { + Your password is required. + } - Your password is required to be at least 4 characters. + @if (passwordForm.get('newPassword')?.errors?.minlength) { + Your password is required to be at least 4 characters. + } - Your password cannot be longer than 50 characters. -
+ @if (passwordForm.get('newPassword')?.errors?.maxlength) { + Your password cannot be longer than 50 characters. + } +
+ } - -
+ +
-
- - +
+ + -
- Your confirmation password is required. + ) { +
+ @if (passwordForm.get('confirmPassword')?.errors?.required) { + Your confirmation password is required. + } - Your confirmation password is required to be at least 4 characters. + @if (passwordForm.get('confirmPassword')?.errors?.minlength) { + Your confirmation password is required to be at least 4 characters. + } - Your confirmation password cannot be longer than 50 characters. + @if (passwordForm.get('confirmPassword')?.errors?.maxlength) { + Your confirmation password cannot be longer than 50 characters. + } +
+ }
-
- - -
+ + +
+ }
diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html index 26c9096d..ec93503b 100644 --- a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.html @@ -5,49 +5,56 @@

Reset your password

-
- Enter the email address you used to register -
- -
- Check your email for details on how to reset your password. -
- -
-
- - - -
+ Enter the email address you used to register +
+ } @else { +
+ Check your email for details on how to reset your password. +
+ } + + @if (!success) { + +
+ + + + @if ( resetRequestForm.get('email')!.invalid && (resetRequestForm.get('email')!.dirty || resetRequestForm.get('email')!.touched) - " - > - Your email is required. - - Your email is invalid. - - Your email is required to be at least 5 characters. - - Your email cannot be longer than 50 characters. + ) { +
+ @if (resetRequestForm.get('email')?.errors?.required) { + Your email is required. + } + @if (resetRequestForm.get('email')?.errors?.email) { + Your email is invalid. + } + + @if (resetRequestForm.get('email')?.errors?.minlength) { + Your email is required to be at least 5 characters. + } + + @if (resetRequestForm.get('email')?.errors?.maxlength) { + Your email cannot be longer than 50 characters. + } +
+ }
-
- -
+ + + } diff --git a/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts index 7f703fa6..8039628f 100644 --- a/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts +++ b/src/main/webapp/app/account/password/password-strength-bar/password-strength-bar.component.ts @@ -7,7 +7,7 @@ import SharedModule from 'app/shared/shared.module'; standalone: true, imports: [SharedModule], templateUrl: './password-strength-bar.component.html', - styleUrls: ['./password-strength-bar.component.scss'], + styleUrl: './password-strength-bar.component.scss', }) export default class PasswordStrengthBarComponent { colors = ['#F00', '#F90', '#FF0', '#9F0', '#0F0']; diff --git a/src/main/webapp/app/account/password/password.component.html b/src/main/webapp/app/account/password/password.component.html index 759f4ac3..240059c3 100644 --- a/src/main/webapp/app/account/password/password.component.html +++ b/src/main/webapp/app/account/password/password.component.html @@ -1,110 +1,116 @@
-
-

- Password for [{{ account.login }}] -

+ @if (account$ | async; as account) { +
+

+ Password for [{{ account.login }}] +

-
Password changed!
+ @if (success) { +
Password changed!
+ } + @if (error) { +
An error has occurred! The password could not be changed.
+ } + @if (doNotMatch) { +
The password and its confirmation do not match!
+ } -
An error has occurred! The password could not be changed.
+
+
+ + -
The password and its confirmation do not match!
- - -
- - - -
- Your password is required. + ) { +
+ @if (passwordForm.get('currentPassword')?.errors?.required) { + Your password is required. + } +
+ }
-
-
- - +
+ + -
- Your password is required. + ) { +
+ @if (passwordForm.get('newPassword')?.errors?.required) { + Your password is required. + } - Your password is required to be at least 4 characters. + @if (passwordForm.get('newPassword')?.errors?.minlength) { + Your password is required to be at least 4 characters. + } - Your password cannot be longer than 50 characters. -
+ @if (passwordForm.get('newPassword')?.errors?.maxlength) { + Your password cannot be longer than 50 characters. + } +
+ } - -
+ +
-
- - +
+ + -
- Your confirmation password is required. + ) { +
+ @if (passwordForm.get('confirmPassword')?.errors?.required) { + Your confirmation password is required. + } - Your confirmation password is required to be at least 4 characters. + @if (passwordForm.get('confirmPassword')?.errors?.minlength) { + Your confirmation password is required to be at least 4 characters. + } - Your confirmation password cannot be longer than 50 characters. + @if (passwordForm.get('confirmPassword')?.errors?.maxlength) { + Your confirmation password cannot be longer than 50 characters. + } +
+ }
-
- - -
+ + +
+ }
diff --git a/src/main/webapp/app/account/register/register.component.html b/src/main/webapp/app/account/register/register.component.html index 29384f45..beb2609a 100644 --- a/src/main/webapp/app/account/register/register.component.html +++ b/src/main/webapp/app/account/register/register.component.html @@ -3,148 +3,172 @@

Registration

-
Registration saved! Please check your email for confirmation.
+ @if (success) { +
Registration saved! Please check your email for confirmation.
+ } -
Registration failed! Please try again later.
+ @if (error) { +
Registration failed! Please try again later.
+ } -
- Login name already registered! Please choose another one. -
+ @if (errorUserExists) { +
Login name already registered! Please choose another one.
+ } -
Email is already in use! Please choose another one.
+ @if (errorEmailExists) { +
Email is already in use! Please choose another one.
+ } -
The password and its confirmation do not match!
+ @if (doNotMatch) { +
The password and its confirmation do not match!
+ }
-
-
- - - -
- Your username is required. - - Your username is required to be at least 1 character. - - Your username cannot be longer than 50 characters. - - Your username is invalid. + @if (!success) { + +
+ + + + @if (registerForm.get('login')!.invalid && (registerForm.get('login')!.dirty || registerForm.get('login')!.touched)) { +
+ @if (registerForm.get('login')?.errors?.required) { + Your username is required. + } + + @if (registerForm.get('login')?.errors?.minlength) { + Your username is required to be at least 1 character. + } + + @if (registerForm.get('login')?.errors?.maxlength) { + Your username cannot be longer than 50 characters. + } + + @if (registerForm.get('login')?.errors?.pattern) { + Your username is invalid. + } +
+ }
-
- -
- - - -
- Your email is required. - - Your email is invalid. - - Your email is required to be at least 5 characters. - - Your email cannot be longer than 50 characters. + +
+ + + + @if (registerForm.get('email')!.invalid && (registerForm.get('email')!.dirty || registerForm.get('email')!.touched)) { +
+ @if (registerForm.get('email')?.errors?.required) { + Your email is required. + } + + @if (registerForm.get('email')?.errors?.invalid) { + Your email is invalid. + } + + @if (registerForm.get('email')?.errors?.minlength) { + Your email is required to be at least 5 characters. + } + + @if (registerForm.get('email')?.errors?.maxlength) { + Your email cannot be longer than 50 characters. + } +
+ }
-
- -
- - - -
- Your password is required. - - Your password is required to be at least 4 characters. - - Your password cannot be longer than 50 characters. + +
+ + + + @if (registerForm.get('password')!.invalid && (registerForm.get('password')!.dirty || registerForm.get('password')!.touched)) { +
+ @if (registerForm.get('password')?.errors?.required) { + Your password is required. + } + + @if (registerForm.get('password')?.errors?.minlength) { + Your password is required to be at least 4 characters. + } + + @if (registerForm.get('password')?.errors?.maxlength) { + Your password cannot be longer than 50 characters. + } +
+ } + +
- -
- -
- - - -
+ + + + @if ( registerForm.get('confirmPassword')!.invalid && (registerForm.get('confirmPassword')!.dirty || registerForm.get('confirmPassword')!.touched) - " - > - Your confirmation password is required. - - Your confirmation password is required to be at least 4 characters. - - Your confirmation password cannot be longer than 50 characters. + ) { +
+ @if (registerForm.get('confirmPassword')?.errors?.required) { + Your confirmation password is required. + } + + @if (registerForm.get('confirmPassword')?.errors?.minlength) { + Your confirmation password is required to be at least 4 characters. + } + + @if (registerForm.get('confirmPassword')?.errors?.maxlength) { + Your confirmation password cannot be longer than 50 characters. + } +
+ }
-
- - + + + }
If you want to sign in, you can try the default accounts:
- Administrator (login="admin" and password="admin")
- User (login="user" and - password="user").
, you can try the default accounts:
- Administrator (login="admin" and password="admin")
- User + (login="user" and password="user").
diff --git a/src/main/webapp/app/account/settings/settings.component.html b/src/main/webapp/app/account/settings/settings.component.html index c0d86417..c8159a46 100644 --- a/src/main/webapp/app/account/settings/settings.component.html +++ b/src/main/webapp/app/account/settings/settings.component.html @@ -1,103 +1,117 @@
-

- User settings for [{{ settingsForm.value.login }}] -

+ @if (settingsForm.value.login) { +

+ User settings for [{{ settingsForm.value.login }}] +

+ } -
Settings saved!
+ @if (success) { +
Settings saved!
+ } -
-
- - - -
+
+ + + + @if ( settingsForm.get('firstName')!.invalid && (settingsForm.get('firstName')!.dirty || settingsForm.get('firstName')!.touched) - " - > - Your first name is required. - - Your first name is required to be at least 1 character - - Your first name cannot be longer than 50 characters + ) { +
+ @if (settingsForm.get('firstName')?.errors?.required) { + Your first name is required. + } + + @if (settingsForm.get('firstName')?.errors?.minlength) { + Your first name is required to be at least 1 character + } + + @if (settingsForm.get('firstName')?.errors?.maxlength) { + Your first name cannot be longer than 50 characters + } +
+ }
-
- -
- - - -
- Your last name is required. - - Your last name is required to be at least 1 character - - Your last name cannot be longer than 50 characters + +
+ + + + @if (settingsForm.get('lastName')!.invalid && (settingsForm.get('lastName')!.dirty || settingsForm.get('lastName')!.touched)) { +
+ @if (settingsForm.get('lastName')?.errors?.required) { + Your last name is required. + } + + @if (settingsForm.get('lastName')?.errors?.minlength) { + Your last name is required to be at least 1 character + } + + @if (settingsForm.get('lastName')?.errors?.maxlength) { + Your last name cannot be longer than 50 characters + } +
+ }
-
- -
- - - -
- Your email is required. - - Your email is invalid. - - Your email is required to be at least 5 characters. - - Your email cannot be longer than 50 characters. + +
+ + + + @if (settingsForm.get('email')!.invalid && (settingsForm.get('email')!.dirty || settingsForm.get('email')!.touched)) { +
+ @if (settingsForm.get('email')?.errors?.required) { + Your email is required. + } + + @if (settingsForm.get('email')?.errors?.email) { + Your email is invalid. + } + + @if (settingsForm.get('email')?.errors?.minlength) { + Your email is required to be at least 5 characters. + } + + @if (settingsForm.get('email')?.errors?.maxlength) { + Your email cannot be longer than 50 characters. + } +
+ }
-
- - + + + }
diff --git a/src/main/webapp/app/admin/admin-routing.module.ts b/src/main/webapp/app/admin/admin-routing.module.ts deleted file mode 100644 index dc1eccc7..00000000 --- a/src/main/webapp/app/admin/admin-routing.module.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; -/* jhipster-needle-add-admin-module-import - JHipster will add admin modules imports here */ - -@NgModule({ - imports: [ - /* jhipster-needle-add-admin-module - JHipster will add admin modules here */ - RouterModule.forChild([ - { - path: 'user-management', - loadChildren: () => import('./user-management/user-management.route'), - title: 'Users', - }, - { - path: 'docs', - loadComponent: () => import('./docs/docs.component'), - title: 'API', - }, - { - path: 'configuration', - loadComponent: () => import('./configuration/configuration.component'), - title: 'Configuration', - }, - { - path: 'health', - loadComponent: () => import('./health/health.component'), - title: 'Health Checks', - }, - { - path: 'logs', - loadComponent: () => import('./logs/logs.component'), - title: 'Logs', - }, - { - path: 'metrics', - loadComponent: () => import('./metrics/metrics.component'), - title: 'Application Metrics', - }, - { - path: 'tracker', - loadComponent: () => import('./tracker/tracker.component'), - title: 'Real-time user activities', - }, - /* jhipster-needle-add-admin-route - JHipster will add admin routes here */ - ]), - ], -}) -export default class AdminRoutingModule {} diff --git a/src/main/webapp/app/admin/admin.routes.ts b/src/main/webapp/app/admin/admin.routes.ts new file mode 100644 index 00000000..557c3efd --- /dev/null +++ b/src/main/webapp/app/admin/admin.routes.ts @@ -0,0 +1,43 @@ +import { Routes } from '@angular/router'; +/* jhipster-needle-add-admin-module-import - JHipster will add admin modules imports here */ + +const routes: Routes = [ + { + path: 'user-management', + loadChildren: () => import('./user-management/user-management.route'), + title: 'userManagement.home.title', + }, + { + path: 'docs', + loadComponent: () => import('./docs/docs.component'), + title: 'global.menu.admin.apidocs', + }, + { + path: 'configuration', + loadComponent: () => import('./configuration/configuration.component'), + title: 'configuration.title', + }, + { + path: 'health', + loadComponent: () => import('./health/health.component'), + title: 'health.title', + }, + { + path: 'logs', + loadComponent: () => import('./logs/logs.component'), + title: 'logs.title', + }, + { + path: 'metrics', + loadComponent: () => import('./metrics/metrics.component'), + title: 'metrics.title', + }, + { + path: 'tracker', + loadComponent: () => import('./tracker/tracker.component'), + title: 'tracker.title', + }, + /* jhipster-needle-add-admin-route - JHipster will add admin routes here */ +]; + +export default routes; diff --git a/src/main/webapp/app/admin/configuration/configuration.component.html b/src/main/webapp/app/admin/configuration/configuration.component.html index 1e35c674..39c63788 100644 --- a/src/main/webapp/app/admin/configuration/configuration.component.html +++ b/src/main/webapp/app/admin/configuration/configuration.component.html @@ -1,55 +1,68 @@ -
-

Configuration

+@if (allBeans) { +
+

Configuration

- Filter (by prefix) - + Filter (by prefix) + -

Spring configuration

+

Spring configuration

- - - - - - - - - - - - - -
Prefix Properties
- {{ bean.prefix }} - -
-
{{ property.key }}
-
- {{ property.value | json }} -
-
-
- -
-

- {{ propertySource.name }} -

- - +
- - - + + + - - - - + @for (bean of beans; track $index) { + + + + + }
PropertyValue
Prefix Properties
{{ property.key }} - {{ property.value.value }} -
+ {{ bean.prefix }} + + @for (property of bean.properties | keyvalue; track property.key) { +
+
{{ property.key }}
+
+ {{ property.value | json }} +
+
+ } +
+ + @for (propertySource of propertySources; track i; let i = $index) { +
+

+ {{ propertySource.name }} +

+ + + + + + + + + + @for (property of propertySource.properties | keyvalue; track property.key) { + + + + + } + +
PropertyValue
{{ property.key }} + {{ property.value.value }} +
+
+ }
-
+} diff --git a/src/main/webapp/app/admin/docs/docs.component.ts b/src/main/webapp/app/admin/docs/docs.component.ts index ea418835..150ea5cd 100644 --- a/src/main/webapp/app/admin/docs/docs.component.ts +++ b/src/main/webapp/app/admin/docs/docs.component.ts @@ -4,6 +4,6 @@ import { Component } from '@angular/core'; standalone: true, selector: 'jhi-docs', templateUrl: './docs.component.html', - styleUrls: ['./docs.component.scss'], + styleUrl: './docs.component.scss', }) export default class DocsComponent {} diff --git a/src/main/webapp/app/admin/health/health.component.html b/src/main/webapp/app/admin/health/health.component.html index 6844d9b6..4dbbc43a 100644 --- a/src/main/webapp/app/admin/health/health.component.html +++ b/src/main/webapp/app/admin/health/health.component.html @@ -14,29 +14,33 @@

Details - - - - {{ componentHealth.key }} - - - - {{ - { UNKNOWN: 'UNKNOWN', UP: 'UP', OUT_OF_SERVICE: 'OUT_OF_SERVICE', DOWN: 'DOWN' }[componentHealth.value!.status || 'UNKNOWN'] - }} - - - - - - - - - + @if (health) { + + @for (componentHealth of health.components | keyvalue; track componentHealth.key) { + + + {{ componentHealth.key }} + + + + {{ + { UNKNOWN: 'UNKNOWN', UP: 'UP', OUT_OF_SERVICE: 'OUT_OF_SERVICE', DOWN: 'DOWN' }[ + componentHealth.value!.status || 'UNKNOWN' + ] + }} + + + + @if (componentHealth.value!.details) { + + + + } + + + } + + }

diff --git a/src/main/webapp/app/admin/health/modal/health-modal.component.html b/src/main/webapp/app/admin/health/modal/health-modal.component.html index 95d6687d..f96a9899 100644 --- a/src/main/webapp/app/admin/health/modal/health-modal.component.html +++ b/src/main/webapp/app/admin/health/modal/health-modal.component.html @@ -1,7 +1,9 @@ diff --git a/src/main/webapp/app/layouts/main/main.component.spec.ts b/src/main/webapp/app/layouts/main/main.component.spec.ts index 2d7883b2..3b2d92eb 100644 --- a/src/main/webapp/app/layouts/main/main.component.spec.ts +++ b/src/main/webapp/app/layouts/main/main.component.spec.ts @@ -23,7 +23,7 @@ describe('MainComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - declarations: [MainComponent], + imports: [MainComponent], providers: [Title, AccountService, { provide: TitleStrategy, useClass: AppPageTitleStrategy }], }) .overrideTemplate(MainComponent, '') diff --git a/src/main/webapp/app/layouts/main/main.component.ts b/src/main/webapp/app/layouts/main/main.component.ts index 89a52354..e70d3e07 100644 --- a/src/main/webapp/app/layouts/main/main.component.ts +++ b/src/main/webapp/app/layouts/main/main.component.ts @@ -1,13 +1,17 @@ import { Component, OnInit } from '@angular/core'; +import { RouterOutlet, Router } from '@angular/router'; import { AccountService } from 'app/core/auth/account.service'; import { AppPageTitleStrategy } from 'app/app-page-title-strategy'; -import { Router } from '@angular/router'; +import FooterComponent from '../footer/footer.component'; +import PageRibbonComponent from '../profiles/page-ribbon.component'; @Component({ selector: 'jhi-main', + standalone: true, templateUrl: './main.component.html', providers: [AppPageTitleStrategy], + imports: [RouterOutlet, FooterComponent, PageRibbonComponent], }) export default class MainComponent implements OnInit { constructor( diff --git a/src/main/webapp/app/layouts/main/main.module.ts b/src/main/webapp/app/layouts/main/main.module.ts deleted file mode 100644 index f0335493..00000000 --- a/src/main/webapp/app/layouts/main/main.module.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import SharedModule from 'app/shared/shared.module'; -import FooterComponent from '../footer/footer.component'; -import PageRibbonComponent from '../profiles/page-ribbon.component'; -import MainComponent from './main.component'; - -@NgModule({ - imports: [SharedModule, RouterModule, FooterComponent, PageRibbonComponent], - declarations: [MainComponent], -}) -export default class MainModule {} diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.html b/src/main/webapp/app/layouts/navbar/navbar.component.html index bf198095..3c3b715a 100644 --- a/src/main/webapp/app/layouts/navbar/navbar.component.html +++ b/src/main/webapp/app/layouts/navbar/navbar.component.html @@ -17,7 +17,7 @@ > -