diff --git a/goofy-client/.gitignore b/goofy-client/.gitignore index 44e69969b255cb2b393b6a0b669af4b6d2c95830..ecff0fb3847b76a59863155f20907e1168ae92de 100644 --- a/goofy-client/.gitignore +++ b/goofy-client/.gitignore @@ -6,6 +6,7 @@ /out-tsc junit.xml /apps/goofy-e2e/reports +/apps/goofy-e2e/reports_einheitlicher-ansprechpartner /apps/goofy-e2e/recordings /apps/goofy-e2e/cypress .scannerwork diff --git a/goofy-client/apps/goofy-e2e/ea-ci-config.json b/goofy-client/apps/goofy-e2e/ea-ci-config.json index 68b0df3b80c20ad97e28136a62855bc66287e540..f739e15715f255329404f23b7ac15422232c357e 100644 --- a/goofy-client/apps/goofy-e2e/ea-ci-config.json +++ b/goofy-client/apps/goofy-e2e/ea-ci-config.json @@ -13,8 +13,8 @@ "pluginsFile": "./src/plugins/index", "supportFile": "./src/support/index.ts", "video": true, - "videosFolder": "./reports/videos/einheitlicher-ansprechpartner", - "screenshotsFolder": "./reports/screenshots/einheitlicher-ansprechpartner", + "videosFolder": "./reports_einheitlicher-ansprechpartner/videos", + "screenshotsFolder": "./reports_einheitlicher-ansprechpartner/screenshots", "chromeWebSecurity": false, "reporter": "../../node_modules/cypress-mochawesome-reporter", "defaultCommandTimeout": 10000, @@ -22,8 +22,8 @@ "html": false, "json": true, "quite": true, - "reportDir": "./reports/mochawesome-report", - "reportFilename": "report-einheitlicher-ansprechpartner", + "reportDir": "./reports_einheitlicher-ansprechpartner/mochawesome-report", + "reportFilename": "report", "overwrite": false } } \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/ea-config.json b/goofy-client/apps/goofy-e2e/ea-config.json index ce2ed8be419f70962b76662521a7e7c18c659249..ec8a433ed285dee001dc4df43cb219761dbabc0b 100644 --- a/goofy-client/apps/goofy-e2e/ea-config.json +++ b/goofy-client/apps/goofy-e2e/ea-config.json @@ -13,8 +13,8 @@ "pluginsFile": "./src/plugins/index", "supportFile": "./src/support/index.ts", "video": true, - "videosFolder": "./reports/videos/einheitlicher-ansprechpartner", - "screenshotsFolder": "./reports/screenshots/einheitlicher-ansprechpartner", + "videosFolder": "./reports_einheitlicher-ansprechpartner/videos", + "screenshotsFolder": "./reports_einheitlicher-ansprechpartner/screenshots", "chromeWebSecurity": false, "reporter": "../../node_modules/cypress-mochawesome-reporter", "defaultCommandTimeout": 10000, @@ -22,8 +22,8 @@ "html": false, "json": true, "quite": true, - "reportDir": "./reports/mochawesome-report", - "reportFilename": "report-einheitlicher-ansprechpartner", + "reportDir": "./reports_einheitlicher-ansprechpartner/mochawesome-report", + "reportFilename": "report", "overwrite": false } } \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/login-logout.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/login-logout.e2e-spec.ts index ca57e4a7055ea84c9216b597455decf849da25b5..4707174db99143c5472ec5508bd62bde3f7f7cc8 100644 --- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/login-logout.e2e-spec.ts +++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/login-logout.e2e-spec.ts @@ -1,28 +1,21 @@ +import { UserE2E } from '../model/user'; import { HeaderE2EComponent } from '../page-objects/header.po'; import { MainPage } from '../page-objects/main.po'; import { exist, haveText } from '../support/cypress.util'; -import { DatabaseUser } from '../support/user-util'; +import { getUserSabine } from '../support/user-util'; + +const mainFixture = require('../fixtures/main.json'); +const user: UserE2E = getUserSabine(); describe('Login and Logout', () => { const mainPage: MainPage = new MainPage(); const header: HeaderE2EComponent = mainPage.getHeader(); - let mainJson; - let user; - - before(function () { - cy.fixture('main.json').then(data => { - mainJson = data; - }); - - cy.fixture(DatabaseUser.SABINE).then(userData => { - user = userData; - }) - + before(() => { cy.logout(); }) - it('login as test user', function () { + it('login as test user', () => { cy.visit('') .get('#kc-login').should('exist') .get('#username').type(user.name) @@ -30,11 +23,11 @@ describe('Login and Logout', () => { .get('#kc-login').click(); }) - it('should display Goofy', function () { - haveText(header.getTitle(), mainJson.title); + it('should display Goofy', () => { + haveText(header.getTitle(), mainFixture.title); }) - it('should logout', function () { + it('should logout', () => { header.logout(); exist(cy.get('#kc-login')); diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-icon-in-kommentar-error.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-icon-in-kommentar-error.e2e-spec.ts index 2741c30b984e5202983af1796641610081b7f318..4a9df6125b70ba8f82f5c0e11690e1ef37bdf6d1 100644 --- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-icon-in-kommentar-error.e2e-spec.ts +++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-icon-in-kommentar-error.e2e-spec.ts @@ -51,10 +51,6 @@ describe('Kommentar user profile on backend error', () => { notExist(kommentarContainer.getKommentar(kommentar.text).getUserProfile().getName()); }) - it.skip('should have tooltip', () => { - //TODO OZG-1798 - }) - it('should navigate back to list', () => { vorgangPage.getSubnavigation().clickBackButton(); }) @@ -78,10 +74,6 @@ describe('Kommentar user profile on backend error', () => { notExist(kommentarContainer.getKommentar(kommentar.text).getUserProfile().getName()); }) - it.skip('should have tooltip', () => { - //TODO OZG-1798 - }) - it('should navigate back', () => { vorgangPage.getSubnavigation().clickBackButton(); }) diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-icon-in-postfach-nachricht-error.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-icon-in-postfach-nachricht-error.e2e-spec.ts index c2353e1cb960251d790a5dd3c1ca9a812bcef026..b55b790682151fa2f46b1d49c02d4cc4b6b8c500 100644 --- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-icon-in-postfach-nachricht-error.e2e-spec.ts +++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/user-profile/user-profile-icon-in-postfach-nachricht-error.e2e-spec.ts @@ -60,10 +60,6 @@ describe('Postfach nachricht user profile on backend error', () => { notExist(postfachNachrichtenContainer.getListItem(postfachMailItem.subject).getUserProfile().getName()); }) - it.skip('should have tooltip', () => { - //TODO OZG-1798 - }) - it('should navigate back to list', () => { vorgangPage.getSubnavigation().clickBackButton(); }) @@ -90,10 +86,6 @@ describe('Postfach nachricht user profile on backend error', () => { notExist(postfachNachrichtenContainer.getListItem(postfachMailItem.subject).getUserProfile().getName()); }) - it.skip('should have tooltip', () => { - //TODO OZG-1798 - }) - it('should navigate back', () => { vorgangPage.getSubnavigation().clickBackButton(); }) diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/vorgang-detailansicht/ea/vorgang-abschliessen.ea.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/vorgang-detailansicht/ea/vorgang-abschliessen.ea.e2e-spec.ts index 4f61290b08d920d85b94e241c6ea94090acaa78a..5e93502523cc24a73b5b8a3110578658c9e58b1d 100644 --- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/vorgang-detailansicht/ea/vorgang-abschliessen.ea.e2e-spec.ts +++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/vorgang-detailansicht/ea/vorgang-abschliessen.ea.e2e-spec.ts @@ -40,7 +40,7 @@ describe('Vorgang abschliessen(EA)', () => { describe('by button', () => { - it('should have status Beschieden', () => { + it('should have status Bearbeitung', () => { haveText(vorgangPage.getVorgangDetailHeader().getStatus(), vorgangStatusLabelE2E[vorgangAbschliessen.status]); }) diff --git a/goofy-client/apps/goofy-e2e/src/integration/main-tests/vorgang-detailansicht/vorgang-zurueckstellen.e2e-spec.ts b/goofy-client/apps/goofy-e2e/src/integration/main-tests/vorgang-detailansicht/vorgang-zurueckstellen.e2e-spec.ts index 46e1fdc60fafd241b2ee28b5d31137cfd660069a..3bf0fd20fdd238eaedd07006392c9d1493a96689 100644 --- a/goofy-client/apps/goofy-e2e/src/integration/main-tests/vorgang-detailansicht/vorgang-zurueckstellen.e2e-spec.ts +++ b/goofy-client/apps/goofy-e2e/src/integration/main-tests/vorgang-detailansicht/vorgang-zurueckstellen.e2e-spec.ts @@ -72,11 +72,6 @@ describe('Vorgang Zurueckstellen', () => { notExist(snackBar.getMessage()); }) - it.skip('TODO: OZG-1379 should clear bearbeiter of vorgang', () => { - exist(userContainer.getRoot()); - exist(userContainer.getIconContainer().getUnassignedIcon()); - }) - it('should have status Angenommen', () => { haveText(vorgangPage.getVorgangDetailHeader().getStatus(), vorgangStatusLabelE2E[VorgangStatusE2E.ANGENOMMEN]); }) diff --git a/goofy-client/apps/goofy-e2e/src/support/delete-ea-reports.ts b/goofy-client/apps/goofy-e2e/src/support/delete-ea-reports.ts new file mode 100644 index 0000000000000000000000000000000000000000..0acf06de45ebed9fe7e970b678fbf9b8834cb1ec --- /dev/null +++ b/goofy-client/apps/goofy-e2e/src/support/delete-ea-reports.ts @@ -0,0 +1,3 @@ +const fs = require('fs') + +fs.rmdirSync('apps/goofy-e2e/reports_einheitlicher-ansprechpartner/mochawesome-report', { recursive: true }); \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/src/support/pre-ea-report-merge.ts b/goofy-client/apps/goofy-e2e/src/support/pre-ea-report-merge.ts new file mode 100644 index 0000000000000000000000000000000000000000..1163cc915d92ada2707edfb15f6b5f24850eec79 --- /dev/null +++ b/goofy-client/apps/goofy-e2e/src/support/pre-ea-report-merge.ts @@ -0,0 +1,5 @@ +const fs = require('fs') + +if (fs.existsSync('apps/goofy-e2e/reports_einheitlicher-ansprechpartner/mochawesome-report/.jsons')) { + fs.rename('apps/goofy-e2e/reports_einheitlicher-ansprechpartner/mochawesome-report/.jsons', 'apps/goofy-e2e/reports_einheitlicher-ansprechpartner/mochawesome-report/jsons', () => { }) +} \ No newline at end of file diff --git a/goofy-client/apps/goofy-e2e/src/support/user-util.ts b/goofy-client/apps/goofy-e2e/src/support/user-util.ts index 431b775880f02c551c263f9acee25dc674959510..09a7977c0d1e07ce9f8752a38ae445baaded4861 100644 --- a/goofy-client/apps/goofy-e2e/src/support/user-util.ts +++ b/goofy-client/apps/goofy-e2e/src/support/user-util.ts @@ -12,7 +12,6 @@ export function getUserEmil(): UserE2E { return emilFixture; } -//TODO: remove export -> after refactoring login-logout.e2e-spec.ts export enum DatabaseUser { EMIL = 'user/user_emil.json', KFINDER = 'user/user_kfinder.json', diff --git a/goofy-client/apps/goofy/src/styles/main.scss b/goofy-client/apps/goofy/src/styles/main.scss index f842c2d58da95d1501919c18bc76492bce04d410..c393e866e3cfb01e8659785f40eb4c3a94f12667 100644 --- a/goofy-client/apps/goofy/src/styles/main.scss +++ b/goofy-client/apps/goofy/src/styles/main.scss @@ -1,6 +1,5 @@ @use '~@angular/material' as mat; @import "~material-design-icons-iconfont/dist/material-design-icons.css"; -//@import url("https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined"); @import "~typeface-roboto/index.css"; @import "abstracts/variables"; @@ -8,7 +7,6 @@ @import "layout/main"; @import "~libs/navigation/src/lib/navigation/navigation.theme"; @import "~libs/navigation/src/lib/header-container/header/header.theme"; -@import "~libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.theme"; @import "~libs/ui/src/lib/ui/expansion-panel/expansion-panel.theme"; @import "~libs/ui/src/lib/ui/notification/internal-server-error-dialog/internal-server-error-dialog.theme"; @import "~libs/ui/src/lib/ui/button-with-spinner/button-with-spinner.theme"; @@ -18,14 +16,13 @@ @import "~libs/postfach/src/lib/postfach-mail-form/postfach-mail-form.theme"; @import "~libs/vorgang-shared-ui/src/lib/vorgang-search-container/vorgang-search-container.theme"; @import "~libs/wiedervorlage/src/lib/wiedervorlage-list-in-vorgang-list-container/wiedervorlage-list-in-vorgang-list-container.theme"; -@import "~libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.theme"; +@import "~libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.theme"; @import "~libs/user-profile/src/lib/user-profile-search-container/user-profile-search-container.theme"; @include mat.core(); @mixin custom-components-theme($theme) { @include navigation($theme); - @include vorgang-detail-header($theme); @include expansion-panel($theme); @include button-with-spinner($theme); @include breadcrumb($theme); diff --git a/goofy-client/libs/postfach-shared/src/lib/postfach.service.spec.ts b/goofy-client/libs/postfach-shared/src/lib/postfach.service.spec.ts index 290be95d7281523002987400712ee82aa06d1168..099ea39657d2fbdd0899738d5de59a78ebd47b67 100644 --- a/goofy-client/libs/postfach-shared/src/lib/postfach.service.spec.ts +++ b/goofy-client/libs/postfach-shared/src/lib/postfach.service.spec.ts @@ -284,7 +284,7 @@ describe('PostfachService', () => { }) }) - describe('getPostfachMailsByVorgang', () => { + describe('getPostfachMailListByVorgang', () => { const postfachMailList: PostfachMailListResource = createPostfachMailListResource(); @@ -296,25 +296,25 @@ describe('PostfachService', () => { }) it('should set loading to true', () => { - service.getPostfachMailsByVorgang(); + service.getPostfachMailListByVorgang(); expect(service.setPostfachMailListLoading).toHaveBeenCalled(); }) it('should call vorgang service', () => { - service.getPostfachMailsByVorgang(); + service.getPostfachMailListByVorgang(); expect(vorgangService.getVorgangWithEingang).toHaveBeenCalled(); }) it('should call repository', () => { - service.getPostfachMailsByVorgang().subscribe(); + service.getPostfachMailListByVorgang().subscribe(); expect(repository.loadPostfachMailList).toHaveBeenCalled(); }) it('should set loading to false', () => { - service.getPostfachMailsByVorgang(); + service.getPostfachMailListByVorgang(); expect(service.setPostfachMailList).toHaveBeenCalled(); }) diff --git a/goofy-client/libs/postfach-shared/src/lib/postfach.service.ts b/goofy-client/libs/postfach-shared/src/lib/postfach.service.ts index c1736a95870d075b2e0b6b3d81e05d493dab7e22..c0f2df4a5d32874002b4cb38d563613488b09ac8 100644 --- a/goofy-client/libs/postfach-shared/src/lib/postfach.service.ts +++ b/goofy-client/libs/postfach-shared/src/lib/postfach.service.ts @@ -157,7 +157,7 @@ export class PostfachService { return this.commandService.getEffectedResource<PostfachMailListResource>(updatedStateResource.resource); } - public getPostfachMailsByVorgang(): Observable<StateResource<PostfachMailListResource>> { + public getPostfachMailListByVorgang(): Observable<StateResource<PostfachMailListResource>> { doIfLoadingRequired(this.postfachMailList$.value, () => { this.setPostfachMailListLoading(); this.vorgangSubscription = this.vorgangService.getVorgangWithEingang().subscribe(vorgangWithEingangStateResource => { diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.html b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.html index 4e8ca8dbee51ae6fe551e885f7fad6a40e00051f..5d185b2fc90a8c76837175970648c166718ddac5 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.html +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.html @@ -1,20 +1,9 @@ <ng-container *ngIf="postfachMailListStateResource$ | async as postfachMailListStateResource"> - <ng-container *ngIf="postfachMailListStateResource.resource | hasLink: postfachMailListLinkRel.SEND_POSTFACH_MAIL"> - <ng-container *ngIf="pendingSendPostfachMailCommand$ | async as pendingSendPostfachMailCommand"> - <goofy-client-button-with-spinner *ngIf="!showAsIconButton" data-test-id="send-mail-button" - [showSpinner]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE" - class="create-button" - text="Nachricht" - icon="add" - (clickEmitter)="openPostfachMailDialog()"> - </goofy-client-button-with-spinner> - - <goofy-client-icon-button-with-spinner *ngIf="showAsIconButton" data-test-id="send-mail-icon-button" - [showSpinner]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE" - icon="mail_outline" - toolTip="Neue Nachricht erstellen" - (clickEmitter)="openPostfachMailDialog()"> - </goofy-client-icon-button-with-spinner> - </ng-container> - </ng-container> + + <goofy-client-postfach-mail-button *ngIf="postfachMailListStateResource.resource | hasLink: postfachMailListLinkRel.SEND_POSTFACH_MAIL" + [pendingSendPostfachMailCommand]="pendingSendPostfachMailCommand$ | async" + [postfachMailListStateResource]="postfachMailListStateResource" [showAsIconButton]="showAsIconButton" + (openPostfachNachrichtenDialog)="openPostfachMailDialog()"> + </goofy-client-postfach-mail-button> + </ng-container> \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.scss b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.scss index 36c0c5cce5faed0f30aa60459e0e4fe767f72c97..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.scss +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.scss @@ -1,3 +0,0 @@ -.create-button { - margin-left: 54px; -} diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.spec.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.spec.ts index 01ec8e232c5332286839345eae733082c5dabd44..207d00cd28ac2ff50d533d9344501ac8c99c9c86 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.spec.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.spec.ts @@ -1,24 +1,21 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { PostfachMailListLinkRel, PostfachService } from '@goofy-client/postfach-shared'; -import { createEmptyStateResource, createErrorStateResource, createStateResource, HasLinkPipe } from '@goofy-client/tech-shared'; +import { PostfachService } from '@goofy-client/postfach-shared'; +import { createErrorStateResource, createStateResource, HasLinkPipe } from '@goofy-client/tech-shared'; import { mock } from '@goofy-client/test-utils'; -import { ButtonWithSpinnerComponent, DialogService, IconButtonWithSpinnerComponent } from '@goofy-client/ui'; -import { VorgangResource } from '@goofy-client/vorgang-shared'; +import { DialogService } from '@goofy-client/ui'; +import { VorgangHeaderLinkRel, VorgangWithEingangResource } from '@goofy-client/vorgang-shared'; import { createCommandResource } from 'libs/command-shared/test/command'; -import { createPostfachMailListResource } from 'libs/postfach-shared/test/postfach'; import { createApiError } from 'libs/tech-shared/test/error'; -import { createVorgangResource, createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang'; +import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang'; import { MockComponent } from 'ng-mocks'; import { of } from 'rxjs'; import { PostfachMailButtonContainerComponent } from './postfach-mail-button-container.component'; +import { PostfachMailButtonComponent } from './postfach-mail-button/postfach-mail-button.component'; describe('PostfachMailButtonContainerComponent', () => { let component: PostfachMailButtonContainerComponent; let fixture: ComponentFixture<PostfachMailButtonContainerComponent>; - const sendMailButton: string = '[data-test-id="send-mail-button"]'; - const sendMailIconButton: string = '[data-test-id="send-mail-icon-button"]'; - const postfachService = mock(PostfachService); const dialogService = mock(DialogService); @@ -27,8 +24,7 @@ describe('PostfachMailButtonContainerComponent', () => { declarations: [ PostfachMailButtonContainerComponent, HasLinkPipe, - MockComponent(IconButtonWithSpinnerComponent), - MockComponent(ButtonWithSpinnerComponent) + MockComponent(PostfachMailButtonComponent) ], providers: [ { @@ -46,7 +42,6 @@ describe('PostfachMailButtonContainerComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(PostfachMailButtonContainerComponent); component = fixture.componentInstance; - component.pendingSendPostfachMailCommand$ = of(createEmptyStateResource()); fixture.detectChanges(); }); @@ -56,9 +51,10 @@ describe('PostfachMailButtonContainerComponent', () => { describe('ngOnChanges', () => { - const vorgang: VorgangResource = createVorgangResource(); + const vorgang: VorgangWithEingangResource = createVorgangWithEingangResource([VorgangHeaderLinkRel.POSTFACH_MAILS]); beforeEach(() => { + component.vorgang = vorgang; component.loadPendingSendPostfachMailCommand = jest.fn(); component.loadPostfachMailListStateResource = jest.fn(); }) @@ -101,7 +97,7 @@ describe('PostfachMailButtonContainerComponent', () => { it('should call postfach service', () => { component.loadPostfachMailListStateResource(); - expect(postfachService.getPostfachMailsByVorgang).toHaveBeenCalled(); + expect(postfachService.getPostfachMailListByVorgang).toHaveBeenCalled(); }) }) @@ -122,62 +118,6 @@ describe('PostfachMailButtonContainerComponent', () => { }) }) - describe('send mail button', () => { - - beforeEach(() => { - component.showAsIconButton = false; - fixture.detectChanges(); - }) - - it('should be hidden', () => { - component.vorgang = createVorgangWithEingangResource(); - - fixture.detectChanges(); - const buttonElement = fixture.nativeElement.querySelector(sendMailButton); - - expect(buttonElement).not.toBeInstanceOf(HTMLElement); - }); - - it('should be visible', () => { - component.postfachMailListStateResource$ = of(createStateResource(createPostfachMailListResource([PostfachMailListLinkRel.SEND_POSTFACH_MAIL]))); - component.pendingSendPostfachMailCommand$ = of(createStateResource(createCommandResource())); - component.vorgang = createVorgangWithEingangResource([PostfachMailListLinkRel.SEND_POSTFACH_MAIL]); - - fixture.detectChanges(); - const buttonElement = fixture.nativeElement.querySelector(sendMailButton); - - expect(buttonElement).toBeInstanceOf(HTMLElement); - }); - }) - - describe('send mail icon button', () => { - - beforeEach(() => { - component.showAsIconButton = true; - fixture.detectChanges(); - }) - - it('should be hidden', () => { - component.vorgang = createVorgangWithEingangResource(); - - fixture.detectChanges(); - const buttonElement = fixture.nativeElement.querySelector(sendMailIconButton); - - expect(buttonElement).not.toBeInstanceOf(HTMLElement); - }); - - it('should be visible', () => { - component.postfachMailListStateResource$ = of(createStateResource(createPostfachMailListResource([PostfachMailListLinkRel.SEND_POSTFACH_MAIL]))); - component.pendingSendPostfachMailCommand$ = of(createStateResource(createCommandResource())); - component.vorgang = createVorgangWithEingangResource([PostfachMailListLinkRel.SEND_POSTFACH_MAIL]); - - fixture.detectChanges(); - const buttonElement = fixture.nativeElement.querySelector(sendMailIconButton); - - expect(buttonElement).toBeInstanceOf(HTMLElement); - }); - }) - describe('closeDialog', () => { it('should be called if command has no error and dialogRef is not undefined and resource is loaded', () => { diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.ts index 8ea3967da1f2b7cc6dfea816bed244879dacdca2..8daec716bbd39b4e5f81b238569463d627016963 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button-container.component.ts @@ -4,8 +4,8 @@ import { CommandResource } from '@goofy-client/command-shared'; import { PostfachMailListLinkRel, PostfachMailListResource, PostfachService } from '@goofy-client/postfach-shared'; import { hasError, StateResource } from '@goofy-client/tech-shared'; import { DialogService, FixedDialogComponent } from '@goofy-client/ui'; -import { VorgangWithEingangResource } from '@goofy-client/vorgang-shared'; -import { CommandLinkRel } from 'libs/command-shared/src/lib/command.linkrel'; +import { VorgangHeaderLinkRel, VorgangWithEingangResource } from '@goofy-client/vorgang-shared'; +import { hasLink } from '@ngxp/rest'; import { isNull, isUndefined } from 'lodash-es'; import { Observable } from 'rxjs'; import { tap } from 'rxjs/operators'; @@ -27,17 +27,20 @@ export class PostfachMailButtonContainerComponent implements OnChanges { dialogRef: MatDialogRef<FixedDialogComponent>; readonly postfachMailListLinkRel = PostfachMailListLinkRel; - readonly commandLinkRel = CommandLinkRel; constructor(private dialogService: DialogService, private postfachServie: PostfachService) { } ngOnChanges(simpleChanges: SimpleChanges) { - if (simpleChanges.vorgang && !isNull(this.vorgang)) { - this.loadPendingSendPostfachMailCommand(); + if (simpleChanges.vorgang && !isNull(this.vorgang) && hasLink(this.vorgang, VorgangHeaderLinkRel.POSTFACH_MAILS)) { this.loadPostfachMailListStateResource(); + this.loadPendingSendPostfachMailCommand(); } } + loadPostfachMailListStateResource(): void { + this.postfachMailListStateResource$ = this.postfachServie.getPostfachMailListByVorgang(); + } + loadPendingSendPostfachMailCommand(): void { this.pendingSendPostfachMailCommand$ = this.postfachServie.getPendingSendPostfachMailCommand().pipe( tap(commandStateResource => this.closeDialog(commandStateResource)) @@ -50,10 +53,6 @@ export class PostfachMailButtonContainerComponent implements OnChanges { } } - loadPostfachMailListStateResource(): void { - this.postfachMailListStateResource$ = this.postfachServie.getPostfachMailsByVorgang(); - } - openPostfachMailDialog() { if (!isUndefined(this.dialogRef)) { this.dialogService.closeAll(); diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.html b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.html new file mode 100644 index 0000000000000000000000000000000000000000..d1b463fbab1901cdc3890c8bdb47872d52642685 --- /dev/null +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.html @@ -0,0 +1,18 @@ +<ng-container *ngIf="postfachMailListStateResource.resource | hasLink: postfachMailListLinkRel.SEND_POSTFACH_MAIL"> + + <goofy-client-button-with-spinner *ngIf="!showAsIconButton" data-test-id="send-mail-button" + [showSpinner]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE" + class="create-button" + text="Nachricht" + icon="add" + (clickEmitter)="openPostfachNachrichtenDialog.emit()"> + </goofy-client-button-with-spinner> + + <goofy-client-icon-button-with-spinner *ngIf="showAsIconButton" data-test-id="send-mail-icon-button" + [showSpinner]="pendingSendPostfachMailCommand.resource | hasLink: commandLinkRel.UPDATE" + icon="mail_outline" + toolTip="Neue Nachricht erstellen" + (clickEmitter)="openPostfachNachrichtenDialog.emit()"> + </goofy-client-icon-button-with-spinner> + +</ng-container> \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.scss b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..78e40691d1aad67100e7b83d04487a86cdc58081 --- /dev/null +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.scss @@ -0,0 +1,3 @@ +.create-button { + margin-left: 54px; +} \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.spec.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb8f5ab361725e2a1d4c5979bb46edf9c96ff20e --- /dev/null +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.spec.ts @@ -0,0 +1,92 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { PostfachMailListLinkRel } from '@goofy-client/postfach-shared'; +import { createStateResource, HasLinkPipe } from '@goofy-client/tech-shared'; +import { ButtonWithSpinnerComponent, IconButtonWithSpinnerComponent } from '@goofy-client/ui'; +import { createCommandResource } from 'libs/command-shared/test/command'; +import { createPostfachMailListResource } from 'libs/postfach-shared/test/postfach'; +import { MockComponent } from 'ng-mocks'; +import { PostfachMailButtonComponent } from './postfach-mail-button.component'; + +describe('PostfachMailButtonComponent', () => { + let component: PostfachMailButtonComponent; + let fixture: ComponentFixture<PostfachMailButtonComponent>; + + const sendMailButton: string = '[data-test-id="send-mail-button"]'; + const sendMailIconButton: string = '[data-test-id="send-mail-icon-button"]'; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ + PostfachMailButtonComponent, + HasLinkPipe, + MockComponent(IconButtonWithSpinnerComponent), + MockComponent(ButtonWithSpinnerComponent), + ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PostfachMailButtonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + describe('send mail button', () => { + + beforeEach(() => { + component.showAsIconButton = false; + fixture.detectChanges(); + }) + + it('should be hidden', () => { + component.postfachMailListStateResource = createStateResource(createPostfachMailListResource()); + + fixture.detectChanges(); + const buttonElement = fixture.nativeElement.querySelector(sendMailButton); + + expect(buttonElement).not.toBeInstanceOf(HTMLElement); + }); + + it('should be visible', () => { + component.postfachMailListStateResource = createStateResource(createPostfachMailListResource([PostfachMailListLinkRel.SEND_POSTFACH_MAIL])); + component.pendingSendPostfachMailCommand = createStateResource(createCommandResource()); + + fixture.detectChanges(); + const buttonElement = fixture.nativeElement.querySelector(sendMailButton); + + expect(buttonElement).toBeInstanceOf(HTMLElement); + }); + }) + + describe('send mail icon button', () => { + + beforeEach(() => { + component.showAsIconButton = true; + fixture.detectChanges(); + }) + + it('should be hidden', () => { + component.postfachMailListStateResource = createStateResource(createPostfachMailListResource()); + + fixture.detectChanges(); + const buttonElement = fixture.nativeElement.querySelector(sendMailIconButton); + + expect(buttonElement).not.toBeInstanceOf(HTMLElement); + }); + + it('should be visible', () => { + component.postfachMailListStateResource = createStateResource(createPostfachMailListResource([PostfachMailListLinkRel.SEND_POSTFACH_MAIL])); + component.pendingSendPostfachMailCommand = createStateResource(createCommandResource()); + + fixture.detectChanges(); + const buttonElement = fixture.nativeElement.querySelector(sendMailIconButton); + + expect(buttonElement).toBeInstanceOf(HTMLElement); + }); + }) +}); diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d283b274a3588c946a04d026789e9b260e6b4e9 --- /dev/null +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component.ts @@ -0,0 +1,22 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { CommandResource } from '@goofy-client/command-shared'; +import { PostfachMailListLinkRel, PostfachMailListResource } from '@goofy-client/postfach-shared'; +import { createEmptyStateResource, StateResource } from '@goofy-client/tech-shared'; +import { CommandLinkRel } from 'libs/command-shared/src/lib/command.linkrel'; + +@Component({ + selector: 'goofy-client-postfach-mail-button', + templateUrl: './postfach-mail-button.component.html', + styleUrls: ['./postfach-mail-button.component.scss'] +}) +export class PostfachMailButtonComponent { + + @Input() showAsIconButton: boolean; + @Input() postfachMailListStateResource: StateResource<PostfachMailListResource> = createEmptyStateResource(); + @Input() pendingSendPostfachMailCommand: StateResource<CommandResource> = createEmptyStateResource(); + + @Output() openPostfachNachrichtenDialog: EventEmitter<void> = new EventEmitter(); + + readonly commandLinkRel = CommandLinkRel; + readonly postfachMailListLinkRel = PostfachMailListLinkRel; +} \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.spec.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.spec.ts index 456b70be15e946cd80e13912e0c237732a8c542a..a793162313575b0d6449931043db43f8100e8f88 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.spec.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.spec.ts @@ -1,12 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { PostfachMailResource, PostfachService } from '@goofy-client/postfach-shared'; +import { PostfachService } from '@goofy-client/postfach-shared'; import { mock } from '@goofy-client/test-utils'; import { VorgangWithEingangResource } from '@goofy-client/vorgang-shared'; import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang'; import { MockComponent } from 'ng-mocks'; import { PostfachMailListContainerComponent } from './postfach-mail-list-container.component'; import { PostfachMailListComponent } from './postfach-mail-list/postfach-mail-list.component'; -import { createPostfachMailResource } from '../../../../postfach-shared/test/postfach'; describe('PostfachMailListContainerComponent', () => { let component: PostfachMailListContainerComponent; @@ -47,7 +46,7 @@ describe('PostfachMailListContainerComponent', () => { it('should call postfach service', () => { component.ngOnChanges(); - expect(postfachService.getPostfachMailsByVorgang).toHaveBeenCalled(); + expect(postfachService.getPostfachMailListByVorgang).toHaveBeenCalled(); }) }) }); diff --git a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.ts b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.ts index bb58842880c0bd6b67de29423b21a2484a6fff43..7726fb6ac4e2f18688e38d34cdbe0f2bceb50292 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-mail-list-container/postfach-mail-list-container.component.ts @@ -21,7 +21,7 @@ export class PostfachMailListContainerComponent implements OnChanges { ngOnChanges() { if (!isNull(this.vorgang)) { - this.postfachMailListStateResource$ = this.postfachService.getPostfachMailsByVorgang(); + this.postfachMailListStateResource$ = this.postfachService.getPostfachMailListByVorgang(); } } } diff --git a/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.spec.ts b/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.spec.ts index 504d0df0080ba6f1ecea8d62b285be2510d2320a..1bd9b8f97f238d6f8db3c7d5904e355540e87f9f 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.spec.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.spec.ts @@ -42,7 +42,7 @@ describe('PostfachPageContainerComponent', () => { it('should call postfach service', () => { component.ngOnInit(); - expect(postfachService.getPostfachMailsByVorgang).toHaveBeenCalled(); + expect(postfachService.getPostfachMailListByVorgang).toHaveBeenCalled(); }) }) }); diff --git a/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.ts b/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.ts index 65ba0830c4dad67108953376c16d0f688559e9ed..70ddfc93666667346382e64d3db7851a98b3dc9d 100644 --- a/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.ts +++ b/goofy-client/libs/postfach/src/lib/postfach-page-container/postfach-page-container.component.ts @@ -17,6 +17,6 @@ export class PostfachPageContainerComponent implements OnInit { constructor(private postfachService: PostfachService) { } ngOnInit() { - this.postfachMailListStateResource$ = this.postfachService.getPostfachMailsByVorgang(); + this.postfachMailListStateResource$ = this.postfachService.getPostfachMailListByVorgang(); } } \ No newline at end of file diff --git a/goofy-client/libs/postfach/src/lib/postfach.module.ts b/goofy-client/libs/postfach/src/lib/postfach.module.ts index ba6f00774c115999fa1b744b280d4033027854a3..1f2cbbad35343874eddaa61d65c0eab4530d1a6a 100644 --- a/goofy-client/libs/postfach/src/lib/postfach.module.ts +++ b/goofy-client/libs/postfach/src/lib/postfach.module.ts @@ -8,6 +8,7 @@ import { UserProfileModule } from '@goofy-client/user-profile'; import { VorgangSharedModule } from '@goofy-client/vorgang-shared'; import { VorgangSharedUiModule } from '@goofy-client/vorgang-shared-ui'; import { PostfachMailButtonContainerComponent } from './postfach-mail-button-container/postfach-mail-button-container.component'; +import { PostfachMailButtonComponent } from './postfach-mail-button-container/postfach-mail-button/postfach-mail-button.component'; import { PostfachMailFormComponent } from './postfach-mail-form/postfach-mail-form.component'; import { PostfachMailListContainerComponent } from './postfach-mail-list-container/postfach-mail-list-container.component'; import { PostfachMailListComponent } from './postfach-mail-list-container/postfach-mail-list/postfach-mail-list.component'; @@ -54,7 +55,8 @@ const routes: Routes = [ OutgoingMailErrorComponent, PostfachMailDateComponent, OutgoingMailErrorContainerComponent, - PostfachNachrichtAttachmentsComponent + PostfachNachrichtAttachmentsComponent, + PostfachMailButtonComponent ], exports: [ diff --git a/goofy-client/libs/tech-shared/src/lib/tech.util.ts b/goofy-client/libs/tech-shared/src/lib/tech.util.ts index 4f9f5d4abadc7efaac5f9b320092994844673902..fc8c4f6dc541def165f847471ed6c7727d30e2e2 100644 --- a/goofy-client/libs/tech-shared/src/lib/tech.util.ts +++ b/goofy-client/libs/tech-shared/src/lib/tech.util.ts @@ -30,7 +30,6 @@ export function hasExceptionId(apiError: ApiError): boolean { return !isNil(apiError) && !isNil(apiError.issues) && !isNil(apiError.issues[0].exceptionId); } -//TODO: Umstellen auf async/setTimeout export function sleep(delayInMs: number) { var start = new Date().getTime(); while (new Date().getTime() < start + delayInMs); @@ -38,4 +37,4 @@ export function sleep(delayInMs: number) { export function getFirstLetter(value: string): string { return isNil(value) ? null : value.substr(0, 1); -} \ No newline at end of file +} diff --git a/goofy-client/libs/ui/src/lib/ui/editor/text-editor/text-editor.component.ts b/goofy-client/libs/ui/src/lib/ui/editor/text-editor/text-editor.component.ts index 6966cd147071171e003e64cd2433afe7e5c025ac..e6c63e4189b4caab596dc5d4b76d1884b6bf9bd6 100644 --- a/goofy-client/libs/ui/src/lib/ui/editor/text-editor/text-editor.component.ts +++ b/goofy-client/libs/ui/src/lib/ui/editor/text-editor/text-editor.component.ts @@ -21,7 +21,7 @@ export class TextEditorComponent extends FormControlEditorAbstractComponent impl ngAfterViewInit(): void { window.setTimeout(() => { - if (this.autoFocus) this.inputElement.nativeElement.focus(); // todo prüfen, ob man das im .patch() machen kann + if (this.autoFocus) this.inputElement.nativeElement.focus(); }) } diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.html b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.html index 29dcacdc557da43e165ae51413dd9d238a517948..85ac3084842070e047925be205a3f384bb2034d1 100644 --- a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.html +++ b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.html @@ -1,17 +1 @@ -<ng-container *ngIf="apiRoot$ | async as apiRoot"> - <!-- TODO anders schneiden--> - <ng-container *ngIf="userProfile$ | async as userProfile"> - - <ng-container *ngIf="(apiRoot.resource | hasLink: apiRootLinkRel.SEARCH_USER_PROFILES) && isUserServiceAvailable(userProfile); else iconOnly"> - <goofy-client-user-profile-button-container [userProfile]="userProfile" data-test-id="user-profile-button-container"></goofy-client-user-profile-button-container> - </ng-container> - - <ng-template #iconOnly> - <goofy-client-user-icon data-test-id="vorgang-detail-user-profile-icon" - [userProfileStateResource]="userProfile" - class="user-profile-icon"> - </goofy-client-user-icon> - </ng-template> - - </ng-container> -</ng-container> \ No newline at end of file +<goofy-client-user-profile-in-vorgang [apiRoot]="apiRoot$ | async" [userProfile]="userProfile$ | async"></goofy-client-user-profile-in-vorgang> \ No newline at end of file diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.spec.ts b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.spec.ts index f04b3fb57c47a6716448654527cea1532b867b3c..dc9c05018c6e8fc4229a3ae9d235cfa8428f1bbe 100644 --- a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.spec.ts +++ b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.spec.ts @@ -1,23 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ApiRootLinkRel, ApiRootService } from '@goofy-client/api-root-shared'; -import { createEmptyStateResource, createErrorStateResource, createStateResource, HasLinkPipe, MessageCode, StateResource } from '@goofy-client/tech-shared'; -import { getElementFromFixture, mock } from '@goofy-client/test-utils'; +import { ApiRootService } from '@goofy-client/api-root-shared'; +import { mock } from '@goofy-client/test-utils'; import { UserProfileService } from '@goofy-client/user-profile-shared'; -import { createApiRootResource } from 'libs/api-root-shared/test/api-root'; -import { createApiError } from 'libs/tech-shared/test/error'; -import { createUserProfileResource } from 'libs/user-profile-shared/test/user-profile'; +import { VorgangHeaderLinkRel, VorgangWithEingangResource } from '@goofy-client/vorgang-shared'; +import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorgang'; import { MockComponent } from 'ng-mocks'; -import { BehaviorSubject, of } from 'rxjs'; -import { UserIconComponent } from '../user-icon/user-icon.component'; -import { UserProfileButtonContainerComponent } from './user-profile-button-container/user-profile-button-container.component'; +import { BehaviorSubject } from 'rxjs'; import { UserProfileInVorgangContainerComponent } from './user-profile-in-vorgang-container.component'; +import { UserProfileInVorgangComponent } from './user-profile-in-vorgang/user-profile-in-vorgang.component'; describe('UserProfileInVorgangContainerComponent', () => { let component: UserProfileInVorgangContainerComponent; let fixture: ComponentFixture<UserProfileInVorgangContainerComponent>; - const buttonContainer: string = '[data-test-id="user-profile-button-container"]'; - const visibilitySubj: BehaviorSubject<boolean> = new BehaviorSubject(false); const userProfileService = { ...mock(UserProfileService), isUserProfileSearchVisible: () => visibilitySubj }; const apiRootService = mock(ApiRootService); @@ -26,9 +21,7 @@ describe('UserProfileInVorgangContainerComponent', () => { await TestBed.configureTestingModule({ declarations: [ UserProfileInVorgangContainerComponent, - HasLinkPipe, - MockComponent(UserIconComponent), - MockComponent(UserProfileButtonContainerComponent) + MockComponent(UserProfileInVorgangComponent) ], providers: [ { @@ -53,101 +46,27 @@ describe('UserProfileInVorgangContainerComponent', () => { expect(component).toBeTruthy(); }); - describe('isUserServiceAvailable', () => { - - it('should return false on service unavailable error', () => { - const userProfileStateResource: StateResource<any> = createErrorStateResource({ ...createApiError(), issues: [<any>{ messageCode: MessageCode.SERVICE_UNAVAILABLE }] }); - - const isUserServiceAvailable: boolean = component.isUserServiceAvailable(userProfileStateResource); - - expect(isUserServiceAvailable).toBeFalsy(); - }) - - it('should return true on empty user profile', () => { - const isUserServiceAvailable: boolean = component.isUserServiceAvailable(createEmptyStateResource()); - - expect(isUserServiceAvailable).toBeTruthy(); - }) - - it('should return true on resource not found error', () => { - const userProfileStateResource: StateResource<any> = createErrorStateResource({ ...createApiError(), issues: [<any>{ messageCode: MessageCode.RESOURCE_NOT_FOUND }] }); - - const isUserServiceAvailable: boolean = component.isUserServiceAvailable(userProfileStateResource); - - expect(isUserServiceAvailable).toBeTruthy(); - }) + it('should call apiService', () => { + expect(apiRootService.getApiRoot).toHaveBeenCalled(); }) - describe('search possibility', () => { - - describe('by "search-user-profile" link', () => { - - it('should be included if link is present', () => { - component.apiRoot$ = of(createStateResource(createApiRootResource([ApiRootLinkRel.SEARCH_USER_PROFILES]))); - - fixture.detectChanges(); - const element = getElementFromFixture(fixture, buttonContainer); + describe('ngOnChanges', () => { - expect(element).toBeInstanceOf(HTMLElement); - }) + it('should call userProfileService if link is present', () => { + const vorgang: VorgangWithEingangResource = createVorgangWithEingangResource([VorgangHeaderLinkRel.ASSIGNED_TO]); + component.vorgang = vorgang - it('should NOT be included if link is NOT present', () => { - component.apiRoot$ = of(createStateResource(createApiRootResource())); + component.ngOnChanges({ vorgang: <any>{} }); - fixture.detectChanges(); - const element = getElementFromFixture(fixture, buttonContainer); - - expect(element).not.toBeInstanceOf(HTMLElement); - }) + expect(userProfileService.getAssignedUserProfile).toHaveBeenCalledWith(vorgang, VorgangHeaderLinkRel.ASSIGNED_TO); }) - describe('by service', () => { - - beforeEach(() => { - component.apiRoot$ = of(createStateResource(createApiRootResource([ApiRootLinkRel.SEARCH_USER_PROFILES]))); - }) - - describe('on unavailable service(503)', () => { - - it('should be included if is available(response of userProfile request is valid)', () => { - component.userProfile$ = of(createStateResource(createUserProfileResource())); - - fixture.detectChanges(); - const element = getElementFromFixture(fixture, buttonContainer); - - expect(element).toBeInstanceOf(HTMLElement); - }) - - it('should NOT be included if is unavailable', () => { - component.userProfile$ = of(createErrorStateResource({ ...createApiError(), issues: [<any>{ messageCode: MessageCode.SERVICE_UNAVAILABLE }] })); - - fixture.detectChanges(); - const element = getElementFromFixture(fixture, buttonContainer); - - expect(element).not.toBeInstanceOf(HTMLElement); - }) - }) - - describe('on resource not found(404)', () => { - - it('should be included if is available', () => { - component.userProfile$ = of(createStateResource(createUserProfileResource())); - - fixture.detectChanges(); - const element = getElementFromFixture(fixture, buttonContainer); - - expect(element).toBeInstanceOf(HTMLElement); - }) - - it('should be included if is available but resource not found', () => { - component.userProfile$ = of(createErrorStateResource({ ...createApiError(), issues: [<any>{ messageCode: MessageCode.RESOURCE_NOT_FOUND }] })); + it('should NOT call userProfileService', () => { + component.vorgang = createVorgangWithEingangResource(); - fixture.detectChanges(); - const element = getElementFromFixture(fixture, buttonContainer); + component.ngOnChanges({ vorgang: <any>{} }); - expect(element).toBeInstanceOf(HTMLElement); - }) - }) + expect(userProfileService.getAssignedUserProfile).not.toHaveBeenCalledWith(); }) }) }); diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.ts b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.ts index 6b1df533fdc32660a7415b345beb2df6a54241c2..6244613952e0c2f57ba68f3d444bef8135030a6d 100644 --- a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.ts +++ b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang-container.component.ts @@ -1,6 +1,6 @@ import { Component, Input, SimpleChanges } from '@angular/core'; -import { ApiRootLinkRel, ApiRootResource, ApiRootService } from '@goofy-client/api-root-shared'; -import { createEmptyStateResource, hasError, isServiceUnavailableMessageCode, StateResource } from '@goofy-client/tech-shared'; +import { ApiRootResource, ApiRootService } from '@goofy-client/api-root-shared'; +import { createEmptyStateResource, StateResource } from '@goofy-client/tech-shared'; import { UserProfileResource, UserProfileService } from '@goofy-client/user-profile-shared'; import { VorgangHeaderLinkRel, VorgangWithEingangResource } from '@goofy-client/vorgang-shared'; import { hasLink } from '@ngxp/rest'; @@ -19,8 +19,6 @@ export class UserProfileInVorgangContainerComponent { apiRoot$: Observable<StateResource<ApiRootResource>> = of(createEmptyStateResource()); userProfile$: Observable<StateResource<UserProfileResource>> = of(createEmptyStateResource()); - readonly apiRootLinkRel = ApiRootLinkRel; - constructor(private apiRootService: ApiRootService, public userProfileService: UserProfileService) { this.apiRoot$ = this.apiRootService.getApiRoot(); } @@ -30,11 +28,4 @@ export class UserProfileInVorgangContainerComponent { this.userProfile$ = this.userProfileService.getAssignedUserProfile(this.vorgang, VorgangHeaderLinkRel.ASSIGNED_TO); } } - - isUserServiceAvailable(stateResource: StateResource<any>): boolean { - if (hasError(stateResource) && isServiceUnavailableMessageCode(stateResource.error)) { - return false; - } - return true; - } } \ No newline at end of file diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/_user-profile-in-vorgang-container.theme.scss b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/_user-profile-in-vorgang.theme.scss similarity index 100% rename from goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/_user-profile-in-vorgang-container.theme.scss rename to goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/_user-profile-in-vorgang.theme.scss diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.html b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.html similarity index 100% rename from goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.html rename to goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.html diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.scss b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.scss similarity index 100% rename from goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.scss rename to goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.scss diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.spec.ts b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.spec.ts similarity index 87% rename from goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.spec.ts rename to goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.spec.ts index 71bed432e8842b68efc8bb50ced0543050f440d6..683c3bc6e6686a6329164fdc55f3ec00e53ad3a8 100644 --- a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.spec.ts +++ b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.spec.ts @@ -4,8 +4,8 @@ import { mock } from '@goofy-client/test-utils'; import { UserProfileService } from '@goofy-client/user-profile-shared'; import { MockComponent } from 'ng-mocks'; import { BehaviorSubject } from 'rxjs'; -import { UserIconComponent } from '../../user-icon/user-icon.component'; -import { UserProfileSearchContainerComponent } from '../../user-profile-search-container/user-profile-search-container.component'; +import { UserIconComponent } from '../../../user-icon/user-icon.component'; +import { UserProfileSearchContainerComponent } from '../../../user-profile-search-container/user-profile-search-container.component'; import { UserProfileButtonContainerComponent } from './user-profile-button-container.component'; describe('UserProfileButtonContainerComponent', () => { diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.ts b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.ts similarity index 100% rename from goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component.ts rename to goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component.ts diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.html b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.html new file mode 100644 index 0000000000000000000000000000000000000000..756cad96963bb9ad3cc8023ed6160e4060ffc7f6 --- /dev/null +++ b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.html @@ -0,0 +1,11 @@ + +<ng-container *ngIf="(apiRoot.resource | hasLink: apiRootLinkRel.SEARCH_USER_PROFILES) && isUserServiceAvailable(userProfile); else iconOnly"> + <goofy-client-user-profile-button-container [userProfile]="userProfile" data-test-id="user-profile-button-container"></goofy-client-user-profile-button-container> +</ng-container> + +<ng-template #iconOnly> + <goofy-client-user-icon data-test-id="vorgang-detail-user-profile-icon" + [userProfileStateResource]="userProfile" + class="user-profile-icon"> + </goofy-client-user-icon> +</ng-template> \ No newline at end of file diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.scss b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.spec.ts b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..da9de24389384f58df63b8ba1dbf6944242b698f --- /dev/null +++ b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.spec.ts @@ -0,0 +1,137 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ApiRootLinkRel } from '@goofy-client/api-root-shared'; +import { createEmptyStateResource, createErrorStateResource, createStateResource, HasLinkPipe, MessageCode, StateResource } from '@goofy-client/tech-shared'; +import { getElementFromFixture } from '@goofy-client/test-utils'; +import { createApiRootResource } from 'libs/api-root-shared/test/api-root'; +import { createApiError } from 'libs/tech-shared/test/error'; +import { createUserProfileResource } from 'libs/user-profile-shared/test/user-profile'; +import { MockComponent } from 'ng-mocks'; +import { UserIconComponent } from '../../user-icon/user-icon.component'; +import { UserProfileButtonContainerComponent } from './user-profile-button-container/user-profile-button-container.component'; +import { UserProfileInVorgangComponent } from './user-profile-in-vorgang.component'; + +describe('UserProfileInVorgangComponent', () => { + let component: UserProfileInVorgangComponent; + let fixture: ComponentFixture<UserProfileInVorgangComponent>; + + const buttonContainer: string = '[data-test-id="user-profile-button-container"]'; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ + UserProfileInVorgangComponent, + HasLinkPipe, + MockComponent(UserIconComponent), + MockComponent(UserProfileButtonContainerComponent) + ] + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(UserProfileInVorgangComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + describe('isUserServiceAvailable', () => { + + it('should return false on service unavailable error', () => { + const userProfileStateResource: StateResource<any> = createErrorStateResource({ ...createApiError(), issues: [<any>{ messageCode: MessageCode.SERVICE_UNAVAILABLE }] }); + + const isUserServiceAvailable: boolean = component.isUserServiceAvailable(userProfileStateResource); + + expect(isUserServiceAvailable).toBeFalsy(); + }) + + it('should return true on empty user profile', () => { + const isUserServiceAvailable: boolean = component.isUserServiceAvailable(createEmptyStateResource()); + + expect(isUserServiceAvailable).toBeTruthy(); + }) + + it('should return true on resource not found error', () => { + const userProfileStateResource: StateResource<any> = createErrorStateResource({ ...createApiError(), issues: [<any>{ messageCode: MessageCode.RESOURCE_NOT_FOUND }] }); + + const isUserServiceAvailable: boolean = component.isUserServiceAvailable(userProfileStateResource); + + expect(isUserServiceAvailable).toBeTruthy(); + }) + }) + + describe('search possibility', () => { + + describe('by "search-user-profile" link', () => { + + it('should be included if link is present', () => { + component.apiRoot = createStateResource(createApiRootResource([ApiRootLinkRel.SEARCH_USER_PROFILES])); + + fixture.detectChanges(); + const element = getElementFromFixture(fixture, buttonContainer); + + expect(element).toBeInstanceOf(HTMLElement); + }) + + it('should NOT be included if link is NOT present', () => { + component.apiRoot = createStateResource(createApiRootResource()); + + fixture.detectChanges(); + const element = getElementFromFixture(fixture, buttonContainer); + + expect(element).not.toBeInstanceOf(HTMLElement); + }) + }) + + describe('by service', () => { + + beforeEach(() => { + component.apiRoot = createStateResource(createApiRootResource([ApiRootLinkRel.SEARCH_USER_PROFILES])); + }) + + describe('on unavailable service(503)', () => { + + it('should be included if is available(response of userProfile request is valid)', () => { + component.userProfile = createStateResource(createUserProfileResource()); + + fixture.detectChanges(); + const element = getElementFromFixture(fixture, buttonContainer); + + expect(element).toBeInstanceOf(HTMLElement); + }) + + it('should NOT be included if is unavailable', () => { + component.userProfile = createErrorStateResource({ ...createApiError(), issues: [<any>{ messageCode: MessageCode.SERVICE_UNAVAILABLE }] }); + + fixture.detectChanges(); + const element = getElementFromFixture(fixture, buttonContainer); + + expect(element).not.toBeInstanceOf(HTMLElement); + }) + }) + + describe('on resource not found(404)', () => { + + it('should be included if is available', () => { + component.userProfile = createStateResource(createUserProfileResource()); + + fixture.detectChanges(); + const element = getElementFromFixture(fixture, buttonContainer); + + expect(element).toBeInstanceOf(HTMLElement); + }) + + it('should be included if is available but resource not found', () => { + component.userProfile = createErrorStateResource({ ...createApiError(), issues: [<any>{ messageCode: MessageCode.RESOURCE_NOT_FOUND }] }); + + fixture.detectChanges(); + const element = getElementFromFixture(fixture, buttonContainer); + + expect(element).toBeInstanceOf(HTMLElement); + }) + }) + }) + }) +}); diff --git a/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.ts b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..2dffa1c6a54e5c709742ef2cfc27b7c73bc9a3a6 --- /dev/null +++ b/goofy-client/libs/user-profile/src/lib/user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component.ts @@ -0,0 +1,25 @@ +import { Component, Input } from '@angular/core'; +import { ApiRootLinkRel, ApiRootResource } from '@goofy-client/api-root-shared'; +import { createEmptyStateResource, hasError, isServiceUnavailableMessageCode, StateResource } from '@goofy-client/tech-shared'; +import { UserProfileResource } from '@goofy-client/user-profile-shared'; +import { Resource } from '@ngxp/rest'; + +@Component({ + selector: 'goofy-client-user-profile-in-vorgang', + templateUrl: './user-profile-in-vorgang.component.html', + styleUrls: ['./user-profile-in-vorgang.component.scss'] +}) +export class UserProfileInVorgangComponent { + + @Input() apiRoot: StateResource<ApiRootResource> = createEmptyStateResource(); + @Input() userProfile: StateResource<UserProfileResource> = createEmptyStateResource(); + + readonly apiRootLinkRel = ApiRootLinkRel; + + isUserServiceAvailable(stateResource: StateResource<Resource>): boolean { + if (hasError(stateResource) && isServiceUnavailableMessageCode(stateResource.error)) { + return false; + } + return true; + } +} diff --git a/goofy-client/libs/user-profile/src/lib/user-profile.module.ts b/goofy-client/libs/user-profile/src/lib/user-profile.module.ts index 6802d1c5be4ac6715a11ce1fae82039165dcfe37..5fc1d44b34a6ec7679e6ffce7b7047630143f231 100644 --- a/goofy-client/libs/user-profile/src/lib/user-profile.module.ts +++ b/goofy-client/libs/user-profile/src/lib/user-profile.module.ts @@ -7,8 +7,9 @@ import { AssignUserProfileButtonContainerComponent } from './assign-user-profile import { UserIconComponent } from './user-icon/user-icon.component'; import { UserProfileInKommentarContainerComponent } from './user-profile-in-kommentar-container/user-profile-in-kommentar-container.component'; import { UserProfileInPostfachMailContainerComponent } from './user-profile-in-postfach-mail-container/user-profile-in-postfach-mail-container.component'; -import { UserProfileButtonContainerComponent } from './user-profile-in-vorgang-container/user-profile-button-container/user-profile-button-container.component'; import { UserProfileInVorgangContainerComponent } from './user-profile-in-vorgang-container/user-profile-in-vorgang-container.component'; +import { UserProfileButtonContainerComponent } from './user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-button-container/user-profile-button-container.component'; +import { UserProfileInVorgangComponent } from './user-profile-in-vorgang-container/user-profile-in-vorgang/user-profile-in-vorgang.component'; import { UserProfileInVorgangListItemContainerComponent } from './user-profile-in-vorgang-list-item-container/user-profile-in-vorgang-list-item-container.component'; import { UserProfileSearchContainerComponent } from './user-profile-search-container/user-profile-search-container.component'; import { UserProfileSearchComponent } from './user-profile-search-container/user-profile-search/user-profile-search.component'; @@ -31,7 +32,8 @@ import { UserProfileComponent } from './user-profile/user-profile.component'; UserProfileInVorgangListItemContainerComponent, UserProfileButtonContainerComponent, UserProfileInPostfachMailContainerComponent, - UserProfileComponent + UserProfileComponent, + UserProfileInVorgangComponent ], exports: [ UserProfileInVorgangContainerComponent, diff --git a/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/_vorgang-detail-header.theme.scss b/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/_vorgang-detail-header.theme.scss deleted file mode 100644 index 0e6ed7d7666c8676f5476e542eb70813a638699e..0000000000000000000000000000000000000000 --- a/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/_vorgang-detail-header.theme.scss +++ /dev/null @@ -1,6 +0,0 @@ -@use 'sass:map'; -@use '~@angular/material' as mat; - -@mixin vorgang-detail-header($theme) { - -} diff --git a/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.html b/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.html index 2fe2130d6ab052398eb99cf04215cc96138c0db5..898e748e867e92b537e8b829b08e88b8af79f343 100644 --- a/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.html +++ b/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.html @@ -3,7 +3,7 @@ <div class="initial-date" data-test-id="created-at">{{ vorgangWithEingang.createdAt | date : 'EEEE, d. LLLL y, H:mm'}}</div> <div class="aktenzeichen"> - <mat-icon svgIcon="az"></mat-icon> + <mat-icon svgIcon="az"></mat-icon><!-- TODO: Icon mit in die Componente packen--> <h1 goofy-client-aktenzeichen [vorgang]="vorgangWithEingang"></h1> </div> diff --git a/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.spec.ts b/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.spec.ts index 35767c5db567b01afdb840bf4a208fc21528451f..2cdd78c9d400a630eba9348a0859ff21e8902a0b 100644 --- a/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.spec.ts +++ b/goofy-client/libs/vorgang-detail/src/lib/vorgang-detail-page/vorgang-detail-area/vorgang-detail-header/vorgang-detail-header.component.spec.ts @@ -7,6 +7,7 @@ import { createVorgangWithEingangResource } from 'libs/vorgang-shared/test/vorga import { MockComponent } from 'ng-mocks'; import { VorgangDetailHeaderComponent } from './vorgang-detail-header.component'; import { MatIcon } from '@angular/material/icon'; +import { MatIconTestingModule } from '@angular/material/icon/testing'; describe('VorgangDetailHeaderComponent', () => { let component: VorgangDetailHeaderComponent; @@ -24,7 +25,10 @@ describe('VorgangDetailHeaderComponent', () => { MockComponent(UserProfileInVorgangContainerComponent), MockComponent(StatusDotComponent), MockComponent(AktenzeichenComponent), - ] + ], + imports: [ + MatIconTestingModule, + ], }).compileComponents(); }); diff --git a/goofy-client/libs/vorgang-shared-ui/src/lib/aktenzeichen/aktenzeichen.component.ts b/goofy-client/libs/vorgang-shared-ui/src/lib/aktenzeichen/aktenzeichen.component.ts index eac5e2761d7568fc565732e5c675657e11b6a099..eec9243d611344a0429ca0b0745deb486d2154d2 100644 --- a/goofy-client/libs/vorgang-shared-ui/src/lib/aktenzeichen/aktenzeichen.component.ts +++ b/goofy-client/libs/vorgang-shared-ui/src/lib/aktenzeichen/aktenzeichen.component.ts @@ -10,9 +10,9 @@ export class AktenzeichenComponent { @Input() vorgang: Vorgang; - readonly noAktenzeichenMessage: string = 'kein Aktenzeichen zugewiesen'; + readonly noAktenzeichenMessage: string = 'kein Az. zugewiesen'; getAktenzeichen(): string { return this.vorgang.aktenzeichen ? this.vorgang.aktenzeichen : this.noAktenzeichenMessage; } -} \ No newline at end of file +} diff --git a/goofy-client/libs/vorgang-shared-ui/src/lib/status-dot/status-dot.component.scss b/goofy-client/libs/vorgang-shared-ui/src/lib/status-dot/status-dot.component.scss index 39f85016d2176630bf86d0c6699451414e9dad87..ebb40ed3c76499992675253da9b47b33fae424b9 100644 --- a/goofy-client/libs/vorgang-shared-ui/src/lib/status-dot/status-dot.component.scss +++ b/goofy-client/libs/vorgang-shared-ui/src/lib/status-dot/status-dot.component.scss @@ -15,6 +15,7 @@ border-radius: 50%; background-color: mat.get-color-from-palette($primaryPalette); margin: 0 29px; + flex-shrink: 0; &.angenommen, &.in_bearbeitung, diff --git a/goofy-client/libs/vorgang-shared/src/lib/vorgang.service.ts b/goofy-client/libs/vorgang-shared/src/lib/vorgang.service.ts index 1eb458212ccca3b871d219a56b881b25443861a9..8ee1bd5546f152ef09fc218cf08fc646ef39dcd1 100644 --- a/goofy-client/libs/vorgang-shared/src/lib/vorgang.service.ts +++ b/goofy-client/libs/vorgang-shared/src/lib/vorgang.service.ts @@ -59,7 +59,6 @@ export class VorgangService { updateVorgang(vorgang: VorgangWithEingangResource): void { this.setVorgangWithEingang(createStateResource(vorgang)); - //TODO: nur laden, wenn es notwendig ist -> im HTML anstoßen this.loadPendingCommandsByVorgang(vorgang); } diff --git a/goofy-client/libs/vorgang/src/lib/vorgang-list-container/vorgang-list/vorgang-list-item/vorgang-list-item.component.html b/goofy-client/libs/vorgang/src/lib/vorgang-list-container/vorgang-list/vorgang-list-item/vorgang-list-item.component.html index 1de1d112997ebec8e35b79e43a4a32984a04d41f..d8a0701c0b33d33c5b04bad22306aae4a67ce7b8 100644 --- a/goofy-client/libs/vorgang/src/lib/vorgang-list-container/vorgang-list/vorgang-list-item/vorgang-list-item.component.html +++ b/goofy-client/libs/vorgang/src/lib/vorgang-list-container/vorgang-list/vorgang-list-item/vorgang-list-item.component.html @@ -1,9 +1,9 @@ -<a routerLink="/vorgang/{{ vorgang | toResourceUri: vorgangLinkRel.VORGANG_WITH_EINGANG }}" [attr.data-test-id]="'vorgang-list-item-' + vorgang.name | convertForDataTest"> +<a class="list-item" routerLink="/vorgang/{{ vorgang | toResourceUri: vorgangLinkRel.VORGANG_WITH_EINGANG }}" [attr.data-test-id]="'vorgang-list-item-' + vorgang.name | convertForDataTest"> <goofy-client-status-dot [status]="vorgang.status" diameter="12" data-test-class="status" class="status"></goofy-client-status-dot> <goofy-client-vorgang-next-frist-button *ngIf="vorgang | hasLink: vorgangLinkRel.WIEDERVORLAGEN" [vorgang]="vorgang" class="wiedervorlagen"></goofy-client-vorgang-next-frist-button> - <div class="eingang" matTooltip="Eingang: {{vorgang.createdAt | formatDateWithTimePipe }}"> + <div class="eingang" matTooltip="Eingang: {{vorgang.createdAt | formatDateWithTimePipe }}" [ngClass]="!(vorgang | hasLink: vorgangLinkRel.ASSIGN) ? 'align-right' : ''"> <mat-icon svgIcon="incoming"></mat-icon> <span>{{ vorgang.createdAt | formatToPrettyDate }}</span> </div> @@ -11,7 +11,7 @@ <div class="name"><div class="ellipsis">{{ vorgang.name }}</div></div> <div class="aktenzeichen"> - <mat-icon svgIcon="az"></mat-icon> + <mat-icon svgIcon="az"></mat-icon><!-- TODO: Icon mit in die Componente packen--> <div goofy-client-aktenzeichen [vorgang]="vorgang"></div> </div> diff --git a/goofy-client/libs/vorgang/src/lib/vorgang-list-container/vorgang-list/vorgang-list-item/vorgang-list-item.component.scss b/goofy-client/libs/vorgang/src/lib/vorgang-list-container/vorgang-list/vorgang-list-item/vorgang-list-item.component.scss index 5f9fe88a624cf33bbb04abb52748288bdd081de4..401c862ac8101035900211a467a47b0ac6a3d5ce 100644 --- a/goofy-client/libs/vorgang/src/lib/vorgang-list-container/vorgang-list/vorgang-list-item/vorgang-list-item.component.scss +++ b/goofy-client/libs/vorgang/src/lib/vorgang-list-container/vorgang-list/vorgang-list-item/vorgang-list-item.component.scss @@ -2,7 +2,7 @@ @import "~include-media/dist/include-media"; @import "variables"; -a { +.list-item { display: flex; flex-wrap: wrap; box-shadow: inset 0 -1px 0 0 rgba(0, 0, 0, 0.08); @@ -33,6 +33,14 @@ a { margin-bottom: 0; } } + + ::ng-deep { + .mat-icon { + flex-shrink: 0; + flex-grow: 0; + margin-right: 4px; + } + } } .ellipsis { @@ -40,11 +48,6 @@ a { white-space: nowrap; overflow: hidden; } -.mat-icon { - flex-shrink: 0; - flex-grow: 0; - margin-right: 4px; -} .status { width: 50%; @@ -57,6 +60,7 @@ a { .wiedervorlagen { width: 25%; + position: relative; } .eingang { @@ -183,3 +187,7 @@ a { padding-left: 8px; } } + +.align-right { + justify-content: flex-end; +} diff --git a/goofy-client/package.json b/goofy-client/package.json index ef945e81951926816d567900bd6e38d60a93ca78..f265c6e1b32cbc87804d25209de65949a3e0286b 100644 --- a/goofy-client/package.json +++ b/goofy-client/package.json @@ -9,13 +9,13 @@ "start": "run-s \"nx -- serve --port 4300 --disable-host-check --proxy-config proxy.conf.json\" --", "start:devbe": "run-s \"nx -- serve --port 4300 --disable-host-check --proxy-config proxy.dev.conf.json\" --", "build": "ng build", - "test": "node --expose-gc ./node_modules/.bin/nx run-many --target=test --all --runInBand --logHeapUsage", + "test": "node ./node_modules/.bin/nx run-many --target=test --all --runInBand", "test:cov": "jest --coverage", "test:lib": "run-s \"ng -- test {1} --watchAll\" --", "test:debug:lib": "run-s \"ng -- test {1} --detectOpenHandles --watchAll\" --", "ci-build": "ng build --outputHashing=all", "ci-prodBuild": "ng build --configuration production --outputHashing=all --configuration production", - "ci-test": "node --expose-gc ./node_modules/.bin/nx run-many --target=test --all --runInBand --ci --testResultsProcessor='jest-sonar-reporter' --coverage --logHeapUsage", + "ci-test": "node ./node_modules/.bin/nx run-many --target=test --all --runInBand --ci --testResultsProcessor='jest-sonar-reporter' --coverage", "ci-sonar": "sonar-scanner", "lint": "nx workspace-lint && ng lint", "affected:apps": "nx affected:apps", @@ -33,17 +33,22 @@ "dep-graph": "nx dep-graph", "help": "nx help", "favicon": "real-favicon generate favicon/faviconDescription.json favicon/faviconData.json src/favicon", - "cypress:open": "export CYPRESS_BASE_URL=http://localhost:4300 ; npx cypress open --project apps/goofy-e2e", - "cypress:open-ea": "export CYPRESS_BASE_URL=http://localhost:4300 ; npx cypress open --project apps/goofy-e2e --config-file ./ea-config.json", "cypress:run": "npx cypress run --project apps/goofy-e2e", "cypress:version": "npx cypress version", - "cypress:merge-report": "mochawesome-merge apps/goofy-e2e/reports/mochawesome-report/**/*.json > apps/goofy-e2e/reports/report.json", - "cypress:generate-html": "marge apps/goofy-e2e/reports/report.json -f report -o apps/goofy-e2e/reports/", + "cypress:open": "export CYPRESS_BASE_URL=http://localhost:4300 ; npx cypress open --project apps/goofy-e2e", + "cypress:ci-run": "export CYPRESS_BASE_URL=https://e2e.dev.ozg-sh.de ; npm run cypress:delete-old-reports ; npm run cypress:run -- --config-file ./cypress-ci.json ; test=$(echo \"$?\") ; npm run cypress:pre-merge ; npm run cypress:generate-report ; exit $test", "cypress:delete-old-reports": "node apps/goofy-e2e/src/support/delete-old-reports.ts", "cypress:pre-merge": "node apps/goofy-e2e/src/support/pre-merge.ts", "cypress:generate-report": "npm run cypress:merge-report ; npm run cypress:generate-html", - "cypress:ci-run": "export CYPRESS_BASE_URL=https://e2e.dev.ozg-sh.de ; npm run cypress:delete-old-reports ; npm run cypress:run -- --config-file ./cypress-ci.json ; test=$(echo \"$?\") ; npm run cypress:pre-merge ; npm run cypress:generate-report ; exit $test", - "cypress:ci-ea-run": "export CYPRESS_BASE_URL=$npm_config_BASE_URL ; npm run cypress:delete-old-reports ; npm run cypress:run -- --config-file ./ea-ci-config.json ; test=$(echo \"$?\") ; npm run cypress:pre-merge ; npm run cypress:generate-report ; exit $test", + "cypress:merge-report": "mochawesome-merge apps/goofy-e2e/reports/mochawesome-report/**/*.json > apps/goofy-e2e/reports/report.json", + "cypress:generate-html": "marge apps/goofy-e2e/reports/report.json -f report -o apps/goofy-e2e/reports/", + "cypress:open-ea": "export CYPRESS_BASE_URL=http://localhost:4300 ; npx cypress open --project apps/goofy-e2e --config-file ./ea-config.json", + "cypress:ci-ea-run": "export CYPRESS_BASE_URL=$npm_config_BASE_URL ; npm run cypress:delete-ea-reports ; npm run cypress:run -- --config-file ./ea-ci-config.json ; test=$(echo \"$?\") ; npm run cypress:pre-merge-ea ; npm run cypress:generate-ea-report ; exit $test", + "cypress:delete-ea-reports": "node apps/goofy-e2e/src/support/delete-ea-reports.ts", + "cypress:pre-merge-ea": "node apps/goofy-e2e/src/support/pre-ea-report-merge.ts", + "cypress:generate-ea-report": "npm run cypress:merge-ea-report ; npm run cypress:generate-ea-html", + "cypress:merge-ea-report": "mochawesome-merge apps/goofy-e2e/reports_einheitlicher-ansprechpartner/mochawesome-report/**/*.json > apps/goofy-e2e/reports_einheitlicher-ansprechpartner/report.json", + "cypress:generate-ea-html": "marge apps/goofy-e2e/reports_einheitlicher-ansprechpartner/report.json -f report -o apps/goofy-e2e/reports_einheitlicher-ansprechpartner/", "workspace-generator": "nx workspace-generator", "sonar-scanner": "npm test -- --testResultsProcessor='jest-sonar-reporter' && sonar-scanner -Dsonar.host.url=https://sonarqube.ozg-sh.de/ -Dsonar.login=364c6e09430714838730a83f55d3369a7ffda0e9" }, diff --git a/goofy-client/pom.xml b/goofy-client/pom.xml index f5b696c3e480aaa99325a9640a46a02262535dd8..db548c553e57d0b85e7fefad9ff936e1ba651194 100644 --- a/goofy-client/pom.xml +++ b/goofy-client/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>de.itvsh.ozg</groupId> <artifactId>goofy</artifactId> - <version>0.17.0-SNAPSHOT</version> + <version>0.18.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/goofy-server/pom.xml b/goofy-server/pom.xml index fc2e67d0f1ef3d912b54280b3c3766690f873ede..71de80bd876adc7e323e4bdae12208a506f4da07 100644 --- a/goofy-server/pom.xml +++ b/goofy-server/pom.xml @@ -7,8 +7,7 @@ <parent> <groupId>de.itvsh.ozg</groupId> <artifactId>goofy</artifactId> - <version>0.17.0-SNAPSHOT</version> - <relativePath /> + <version>0.18.0-SNAPSHOT</version> </parent> <artifactId>goofy-server</artifactId> @@ -33,6 +32,7 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> @@ -55,10 +55,6 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> - <dependency> - <groupId>de.codecentric</groupId> - <artifactId>spring-boot-admin-starter-client</artifactId> - </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -132,12 +128,6 @@ </dependency> <!-- Logging/Monitoring --> - <dependency> - <groupId>net.logstash.logback</groupId> - <artifactId>logstash-logback-encoder</artifactId> - <version>6.3</version> - </dependency> - <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-registry-prometheus</artifactId> @@ -145,51 +135,17 @@ </dependency> <!-- Test --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.junit.vintage</groupId> - <artifactId>junit-vintage-engine</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-params</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-junit-jupiter</artifactId> - <scope>test</scope> - </dependency> + <dependency> <groupId>com.thedeanda</groupId> <artifactId>lorem</artifactId> </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-configuration-processor</artifactId> - <optional>true</optional> - </dependency> + </dependencies> <build> @@ -198,59 +154,29 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.0</version> - <configuration> - <source>${java.version}</source> - <target>${java.version}</target> - <fork>true</fork> - <annotationProcessorPaths> - <path> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - </path> - <path> - <groupId>org.mapstruct</groupId> - <artifactId>mapstruct-processor</artifactId> - <version>${mapstruct.version}</version> - </path> - <!-- other annotation processors --> - </annotationProcessorPaths> - - <showWarnings>true</showWarnings> - <compilerArgs> - <compilerArg> - -Amapstruct.defaultComponentModel=spring - </compilerArg> - <compilerArg> - -Amapstruct.unmappedTargetPolicy=WARN - </compilerArg> - </compilerArgs> - </configuration> </plugin> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> - <configuration> - <argLine>${surefire.jacoco.args}</argLine> - </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <argLine>${surefire.jacoco.args}</argLine> - </configuration> </plugin> <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> </plugin> + <plugin> + <groupId>pl.project13.maven</groupId> + <artifactId>git-commit-id-plugin</artifactId> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -273,79 +199,7 @@ </execution> </executions> </plugin> - - <plugin> - <groupId>pl.project13.maven</groupId> - <artifactId>git-commit-id-plugin</artifactId> - <configuration> - <offline>true</offline> - </configuration> - <executions> - <execution> - <id>get-the-git-infos</id> - <goals> - <goal>revision</goal> - </goals> - <phase>initialize</phase> - </execution> - </executions> - </plugin> </plugins> </build> - <repositories> - <repository> - <id>ozg-nexus</id> - <name>ozg nexus</name> - <url>https://nexus.ozg-sh.de/repository/ozg-group/</url> - </repository> - <repository> - <id>projectlombok.org</id> - <url>https://projectlombok.org/edge-releases</url> - </repository> - </repositories> - - - <profiles> - <profile> - <id>docker-build</id> - <build> - <plugins> - <plugin> - <groupId>com.spotify</groupId> - <artifactId>dockerfile-maven-plugin</artifactId> - <version>1.4.13</version> - <configuration> - <username>admin</username> - <password>admin</password> - <repository>docker.ozg-sh.de/goofy</repository> - <tag>${git.branch}-${project.version}</tag> - <useMavenSettingsForAuth>true</useMavenSettingsForAuth> - <buildArgs> - <JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE> - </buildArgs> - </configuration> - <executions> - <execution> - <id>default</id> - <phase>install</phase> - <goals> - <goal>build</goal> - <goal>tag</goal> - <goal>push</goal> - </goals> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - <version>1.1.1</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> - </profile> - </profiles> </project> diff --git a/goofy-server/src/main/java/de/itvsh/goofy/SecurityConfiguration.java b/goofy-server/src/main/java/de/itvsh/goofy/SecurityConfiguration.java index 3774ff785b9a1e4ad4f7ffc6ccf86ad0e63f081c..109df5fa37eda76c06760bde9108be835d468a93 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/SecurityConfiguration.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/SecurityConfiguration.java @@ -1,12 +1,9 @@ package de.itvsh.goofy; -import org.keycloak.adapters.KeycloakConfigResolver; -import org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver; import org.keycloak.adapters.springsecurity.KeycloakConfiguration; import org.keycloak.adapters.springsecurity.authentication.KeycloakAuthenticationProvider; import org.keycloak.adapters.springsecurity.config.KeycloakWebSecurityConfigurerAdapter; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; @@ -61,11 +58,6 @@ public class SecurityConfiguration extends KeycloakWebSecurityConfigurerAdapter auth.authenticationProvider(keyCloakAuthProvider); } - @Bean - public KeycloakConfigResolver keyCloakConfigResolver() { - return new KeycloakSpringBootConfigResolver(); - } - @Override protected SessionAuthenticationStrategy sessionAuthenticationStrategy() { return new NullAuthenticatedSessionStrategy(); diff --git a/goofy-server/src/main/java/de/itvsh/goofy/WebConfig.java b/goofy-server/src/main/java/de/itvsh/goofy/WebConfig.java index 6e304d9c4e5efba74cfb8fcc710ab393e4f542b8..a2974f341f6d462fad778b96e4d566676c3af060 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/WebConfig.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/WebConfig.java @@ -3,6 +3,9 @@ package de.itvsh.goofy; import java.io.IOException; import java.util.concurrent.TimeUnit; +import org.keycloak.adapters.KeycloakConfigResolver; +import org.keycloak.adapters.springboot.KeycloakSpringBootConfigResolver; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; import org.springframework.http.CacheControl; @@ -38,7 +41,11 @@ public class WebConfig implements WebMvcConfigurer { : super.getResource("index.html", location); } }); + } + @Bean + public KeycloakConfigResolver keyCloakConfigResolver() { + return new KeycloakSpringBootConfigResolver(); } } diff --git a/goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileController.java b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileController.java similarity index 98% rename from goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileController.java rename to goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileController.java index a5e9bad3dc9626ebb2bcf1b23686e4b8e4c4eb04..fbfce83de79966c815add6de9dd8d0ae89a8713d 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileController.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileController.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileModelAssembler.java b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileModelAssembler.java similarity index 96% rename from goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileModelAssembler.java rename to goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileModelAssembler.java index 9deb71e4fa75fd189af430805aeb2eae36975b75..68e509d562ca0750de748edefb2fd1fcf4be7ed2 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileModelAssembler.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileModelAssembler.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.*; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileRemoteService.java b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileRemoteService.java similarity index 98% rename from goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileRemoteService.java rename to goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileRemoteService.java index 0aa6e2efa47c16e92856fc7b79b088211122785f..abc09c821a4b0a34c9b6e4f63c37d1ff7cc04e60 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileRemoteService.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileRemoteService.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import java.util.List; import java.util.stream.Collectors; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileService.java b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileService.java similarity index 84% rename from goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileService.java rename to goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileService.java index 275f99454fa81b07dc450e19e73d753b5fa4c71f..a441c1054db995e2a1f231e8258f49487e8c6073 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/binary/BinaryFileService.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/BinaryFileService.java @@ -1,5 +1,4 @@ -package de.itvsh.goofy.binary; -//TODO package kann in ...common.binaryfile umgeannt werden, da es ja ein technisches Querschnits-Modul ist. +package de.itvsh.goofy.common.binaryfile; import java.util.List; import java.util.stream.Stream; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/binary/FileId.java b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/FileId.java similarity index 91% rename from goofy-server/src/main/java/de/itvsh/goofy/binary/FileId.java rename to goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/FileId.java index 2ba15f9690bf64f2e3c87a489e8e3fd68fd7c23d..ee7702928ce028e2c33d363216d067292cd6ef5a 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/binary/FileId.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/FileId.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import java.util.UUID; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/binary/FileIdMapper.java b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/FileIdMapper.java similarity index 84% rename from goofy-server/src/main/java/de/itvsh/goofy/binary/FileIdMapper.java rename to goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/FileIdMapper.java index 7899fe8631ed5f1647dbd5d0bab259c443f911a5..a2e53bba0e36f83ccde7964e5faccf1927f9bb70 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/binary/FileIdMapper.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/binaryfile/FileIdMapper.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import org.mapstruct.Mapper; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFile.java b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFile.java index 6c8a68e27316e17ebfe6caa0fda646bc10daac2c..779a6c7e34048ba37095866aa24adf0422df45bd 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFile.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFile.java @@ -2,7 +2,7 @@ package de.itvsh.goofy.common.file; import com.fasterxml.jackson.annotation.JsonIgnore; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.FileId; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileDataController.java b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileDataController.java index c75594f1c5f59beddeb608f6a89ab3aa41d8c46a..507d5424e3d0a7c5c4bd85170ab7b4ac37ae5403 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileDataController.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileDataController.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.FileId; @RestController @RequestMapping(OzgFileDataController.OZG_FILE_PATH) diff --git a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileMapper.java b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileMapper.java index ea2f6bc88b78711845ccf4ea55596e69427f313b..b7cd72aeb78233d7c86a253b661ea48f8eefa3a3 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileMapper.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileMapper.java @@ -2,7 +2,7 @@ package de.itvsh.goofy.common.file; import org.mapstruct.Mapper; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.FileId; import de.itvsh.ozg.pluto.grpc.file.GrpcOzgFile; @Mapper diff --git a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileRemoteService.java b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileRemoteService.java index 156f32d5d82a6b9eeee267c65d336d666a4dd2fb..09236b7daca6ed9904f7c8891b06943641b11f0e 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileRemoteService.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileRemoteService.java @@ -5,8 +5,8 @@ import java.util.stream.Stream; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import de.itvsh.goofy.binary.FileId; import de.itvsh.goofy.common.ContextService; +import de.itvsh.goofy.common.binaryfile.FileId; import de.itvsh.ozg.pluto.grpc.file.FileServiceGrpc.FileServiceBlockingStub; import de.itvsh.ozg.pluto.grpc.file.GrpcGetAttachmentsRequest; import de.itvsh.ozg.pluto.grpc.file.GrpcGetAttachmentsResponse; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileService.java b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileService.java index 2ea40298a9d1ca90dc92d7b75db4cc66d7c24c6c..4ba01234d017f5c773b799a179248278f15d830e 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileService.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/common/file/OzgFileService.java @@ -5,7 +5,7 @@ import java.util.stream.Stream; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.FileId; @Service public class OzgFileService { diff --git a/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMail.java b/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMail.java index 1d497fdd57abc546357c0ce0db4d4e53b91f2362..fa7bba89f66f8a32dd30a3a88c3ee37f26047f39 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMail.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMail.java @@ -9,8 +9,8 @@ import javax.validation.constraints.NotEmpty; import com.fasterxml.jackson.annotation.JsonIgnore; -import de.itvsh.goofy.binary.FileId; import de.itvsh.goofy.common.LinkedResource; +import de.itvsh.goofy.common.binaryfile.FileId; import de.itvsh.goofy.common.command.CommandBody; import de.itvsh.goofy.common.user.UserId; import de.itvsh.goofy.common.user.UserProfileController; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMailController.java b/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMailController.java index 75b863c67db0819c2a01e440741192ea6baf2847..bb8af09d7439463e9853f52a1998a9b0ddc222c0 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMailController.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMailController.java @@ -18,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import de.itvsh.goofy.binary.BinaryFileController; +import de.itvsh.goofy.common.binaryfile.BinaryFileController; import de.itvsh.goofy.common.command.Command; import de.itvsh.goofy.common.command.CommandController; import de.itvsh.goofy.common.command.CommandController.CommandByRelationController; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMailMapper.java b/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMailMapper.java index 53e7aec9f0a080d98ba620d479ae750dd3978416..44a54a777a6bde18d28a0d913ce11ea42d7e670f 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMailMapper.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/postfach/PostfachMailMapper.java @@ -10,8 +10,8 @@ import org.mapstruct.ValueMapping; import com.google.protobuf.ProtocolStringList; -import de.itvsh.goofy.binary.FileId; import de.itvsh.goofy.common.TimeMapper; +import de.itvsh.goofy.common.binaryfile.FileId; import de.itvsh.goofy.common.user.UserIdMapper; import de.itvsh.ozg.mail.postfach.GrpcPostfachMail; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/Wiedervorlage.java b/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/Wiedervorlage.java index 0fcce6c680f4eba6e3c3af52fe7cb726819ffb0f..8534ee5bc9b6bffca5bfc65355a74b79c34b11d4 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/Wiedervorlage.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/Wiedervorlage.java @@ -22,7 +22,7 @@ import lombok.NoArgsConstructor; import lombok.ToString; import lombok.Singular; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.FileId; @Getter @Builder(toBuilder = true) diff --git a/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageController.java b/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageController.java index 24ade1ccaf66a854d99511e927a5ed24932ae698..8f1f7dfdb8cad81f53fe024365f2e38c4b4d3b20 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageController.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageController.java @@ -16,8 +16,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import de.itvsh.goofy.binary.BinaryFileController; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.BinaryFileController; +import de.itvsh.goofy.common.binaryfile.FileId; import de.itvsh.goofy.common.file.OzgFile; @RestController diff --git a/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageMapper.java b/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageMapper.java index f0278b80eb2bf8a72694a23173f7708bdb3cfdcc..7b2144d289f4052e832b66d1a4af5664578663c6 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageMapper.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageMapper.java @@ -8,8 +8,8 @@ import org.mapstruct.NullValueCheckStrategy; import org.mapstruct.ReportingPolicy; import org.mapstruct.ValueMapping; -import de.itvsh.goofy.binary.FileIdMapper; import de.itvsh.goofy.common.IgnoreGrpcFields; +import de.itvsh.goofy.common.binaryfile.FileIdMapper; import de.itvsh.ozg.pluto.grpc.command.GrpcCommand; import de.itvsh.ozg.pluto.wiedervorlage.GrpcWiedervorlage; diff --git a/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageModelAssembler.java b/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageModelAssembler.java index 3c5bd1957d1e806ef49e6f30fad5fd3e67bf89c1..14cf1838a8a0e8a2c3760b41c6db1a64df99245a 100644 --- a/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageModelAssembler.java +++ b/goofy-server/src/main/java/de/itvsh/goofy/wiedervorlage/WiedervorlageModelAssembler.java @@ -11,8 +11,8 @@ import org.springframework.hateoas.EntityModel; import org.springframework.hateoas.server.RepresentationModelAssembler; import org.springframework.stereotype.Component; -import de.itvsh.goofy.binary.BinaryFileController; import de.itvsh.goofy.common.ModelBuilder; +import de.itvsh.goofy.common.binaryfile.BinaryFileController; import de.itvsh.goofy.wiedervorlage.WiedervorlageCommandController.WiedervorlageCommandByVorgangController; import de.itvsh.goofy.wiedervorlage.WiedervorlageController.AttachmentsByWiedervorlageController; diff --git a/goofy-server/src/main/resources/application-local.yml b/goofy-server/src/main/resources/application-local.yml index 0e51dbf66dfbdf52911b9609a4a8bd76214aa241..54990e7796b76d12f77c2957e88d9c85a4f33e3a 100644 --- a/goofy-server/src/main/resources/application-local.yml +++ b/goofy-server/src/main/resources/application-local.yml @@ -1,7 +1,7 @@ logging: level: - ROOT: WARN '[de.itvsh]': INFO + config: classpath:log4j2-local.xml goofy: production: false diff --git a/goofy-server/src/main/resources/application-oc.yml b/goofy-server/src/main/resources/application-oc.yml index d1be537e89280df11230956265f685baec65170b..2f098ef2b675bca901ca675c70d5dc71915fff86 100644 --- a/goofy-server/src/main/resources/application-oc.yml +++ b/goofy-server/src/main/resources/application-oc.yml @@ -8,4 +8,7 @@ spring: grpc: client: pluto: - address: static://172.30.125.177:9090 \ No newline at end of file + address: static://172.30.125.177:9090 + +logging: + config: classpath:log4j2.xml \ No newline at end of file diff --git a/goofy-server/src/main/resources/application-remotekc.yml b/goofy-server/src/main/resources/application-remotekc.yml index e5ba5a9413375fe0280d9d7dd6e3c1de66cb7b02..e14e26cd6c0c7e11c2030d7f982214573146b871 100644 --- a/goofy-server/src/main/resources/application-remotekc.yml +++ b/goofy-server/src/main/resources/application-remotekc.yml @@ -1,2 +1,8 @@ keycloak: - auth-server-url: https://sso.dev.ozg-sh.de/auth \ No newline at end of file + auth-server-url: https://sso.dev.ozg-sh.de/auth + +goofy: + keycloak: + api: + user: goofyApiUser + password: \ No newline at end of file diff --git a/goofy-server/src/main/resources/application.yml b/goofy-server/src/main/resources/application.yml index ee75e0ec5011c589ad2e477d7f080b275dead1eb..a8cf2c4b0c8da765056e6b496b87d71139939d41 100644 --- a/goofy-server/src/main/resources/application.yml +++ b/goofy-server/src/main/resources/application.yml @@ -6,6 +6,9 @@ logging: '[org.keycloak.adapters]': WARN spring: + mvc: + pathmatch: + matching-strategy: ant-path-matcher application: name: Goofy jackson: diff --git a/goofy-server/src/main/resources/logback-spring.xml b/goofy-server/src/main/resources/logback-spring.xml deleted file mode 100644 index ac9706e95c282256f752bd433446e6c92488431b..0000000000000000000000000000000000000000 --- a/goofy-server/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,20 +0,0 @@ -<configuration> - <include resource="org/springframework/boot/logging/logback/defaults.xml"/> - <include resource="org/springframework/boot/logging/logback/console-appender.xml"/> - - <springProfile name="!oc"> - <root> - <appender-ref ref="CONSOLE"/> - </root> - </springProfile> - - <springProfile name="oc"> - <appender name="LOGSTASH" class="ch.qos.logback.core.ConsoleAppender"> - <encoder class="net.logstash.logback.encoder.LogstashEncoder"/> - </appender> - <root> - <appender-ref ref="LOGSTASH"/> - </root> - </springProfile> - -</configuration> diff --git a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileControllerTest.java b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileControllerTest.java similarity index 99% rename from goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileControllerTest.java rename to goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileControllerTest.java index d93133bc67277b2d12863c28a487e49bb8a0290b..2a1cd09aa9ebd933f93a71ab6e6b033aecba16bc 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileControllerTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileControllerTest.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; diff --git a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileModelAssemblerTest.java b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileModelAssemblerTest.java similarity index 88% rename from goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileModelAssemblerTest.java rename to goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileModelAssemblerTest.java index f9bf7af4521fdc8ab1b1640bdbfec1b3838ba065..0eca622869b90ca6dc0800c12901acd82b211a5f 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileModelAssemblerTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileModelAssemblerTest.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import static org.assertj.core.api.Assertions.*; @@ -9,6 +9,8 @@ import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; import org.springframework.hateoas.IanaLinkRelations; +import de.itvsh.goofy.common.binaryfile.BinaryFileController; +import de.itvsh.goofy.common.binaryfile.BinaryFileModelAssembler; import de.itvsh.goofy.common.file.OzgFileTestFactory; class BinaryFileModelAssemblerTest { diff --git a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileRemoteServiceTest.java b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileRemoteServiceTest.java similarity index 99% rename from goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileRemoteServiceTest.java rename to goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileRemoteServiceTest.java index 2f733a2ccd618b71341ee13d43d2ff819e94bbfc..0838f183c97feaef38ea42be6e9b6cfd8edd8f61 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileRemoteServiceTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileRemoteServiceTest.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; diff --git a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileServiceTest.java b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileServiceTest.java similarity index 88% rename from goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileServiceTest.java rename to goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileServiceTest.java index e7fdd6f9c385170aab07398b585d0e770aa4692d..39bb349d00c6d64e8f315ad4efe6d71376fa422f 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileServiceTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileServiceTest.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import static org.mockito.Mockito.*; @@ -9,6 +9,8 @@ import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; import org.mockito.Mock; +import de.itvsh.goofy.common.binaryfile.BinaryFileRemoteService; +import de.itvsh.goofy.common.binaryfile.BinaryFileService; import de.itvsh.goofy.common.file.OzgFileData; import de.itvsh.goofy.common.file.OzgFileDataTestFactory; import de.itvsh.goofy.vorgang.VorgangHeaderTestFactory; diff --git a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileTestFactory.java b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileTestFactory.java similarity index 97% rename from goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileTestFactory.java rename to goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileTestFactory.java index a994daf3ea9a8df58b01a92077018cbc051e6fed..bf985e0ebc3fed3d0f9b89e7a55eed38c4d94d4b 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/binary/BinaryFileTestFactory.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/common/binaryfile/BinaryFileTestFactory.java @@ -1,4 +1,4 @@ -package de.itvsh.goofy.binary; +package de.itvsh.goofy.common.binaryfile; import java.util.UUID; diff --git a/goofy-server/src/test/java/de/itvsh/goofy/common/file/OzgFileTestFactory.java b/goofy-server/src/test/java/de/itvsh/goofy/common/file/OzgFileTestFactory.java index b795f4da5f4edc2da0edc0d2658f911493c1dcf2..4c1fd990379a9b5564a35e876f336d5722147ff4 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/common/file/OzgFileTestFactory.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/common/file/OzgFileTestFactory.java @@ -4,7 +4,7 @@ import java.util.UUID; import com.thedeanda.lorem.LoremIpsum; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.FileId; public class OzgFileTestFactory { diff --git a/goofy-server/src/test/java/de/itvsh/goofy/common/user/keycloak/KeycloakApiFunctionalITCase.java b/goofy-server/src/test/java/de/itvsh/goofy/common/user/keycloak/KeycloakApiFunctionalITCase.java index 5262344b75bf1e79f9dae918988537fdb0e2543e..49177e28c0e017028209106d7dfb4b287bbd9386 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/common/user/keycloak/KeycloakApiFunctionalITCase.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/common/user/keycloak/KeycloakApiFunctionalITCase.java @@ -11,12 +11,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; +//TODO start keycloak by docker to become independen from external keycloak @SpringBootTest -@ActiveProfiles("remotekc") +@ActiveProfiles({ "local", "itcase", "remotekc" }) class KeycloakApiFunctionalITCase { private static final String REALM = "sh-kiel-dev"; - private static final String TEST_USER_NAME = "beate"; + private static final String TEST_USER_NAME = "sabine"; @Autowired private Keycloak keycloak; diff --git a/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailControllerTest.java b/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailControllerTest.java index 1e01b75080d32fa4baf7aaf3caa730cd1fbbe0da..804ffb1a6586148d96de38798ab34b808352700b 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailControllerTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailControllerTest.java @@ -21,7 +21,7 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import de.itvsh.goofy.binary.BinaryFileController; +import de.itvsh.goofy.common.binaryfile.BinaryFileController; import de.itvsh.goofy.common.command.CommandTestFactory; import de.itvsh.goofy.vorgang.Antragsteller; import de.itvsh.goofy.vorgang.EingangTestFactory; diff --git a/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailServiceTest.java b/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailServiceTest.java index dd92ed3b4bdaca0a7dcfff071599b27f6f57914c..5690e5c2819effd6bd3cc76ba1aeb034e40fb96d 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailServiceTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailServiceTest.java @@ -8,6 +8,7 @@ import static org.mockito.Mockito.*; import java.util.Optional; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; @@ -101,7 +102,20 @@ class PostfachMailServiceTest { verify(remoteService).isPostfachConfigured(); } - // TODO test for checking if already configuration loaded - } + @DisplayName("if property is already set, no remoteservice call should be done") + @Test + void shouldNotCallRemoteService() throws Exception { + setIsConfigured(); + + service.isPostfachConfigured(); + verifyNoInteractions(remoteService); + } + + private void setIsConfigured() throws Exception { + var isPostfachConfigured = PostfachMailService.class.getDeclaredField("isPostfachConfigured"); + isPostfachConfigured.setAccessible(true); + isPostfachConfigured.set(service, true); + } + } } \ No newline at end of file diff --git a/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailTestFactory.java b/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailTestFactory.java index 2d5cd6434c2319e947c54bf27de10afa31805c5f..804953464a9522c20b9583d0ed6adee3a99dbfcf 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailTestFactory.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/postfach/PostfachMailTestFactory.java @@ -9,7 +9,7 @@ import java.util.UUID; import com.thedeanda.lorem.LoremIpsum; import de.itvsh.goofy.TestUtils; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.FileId; import de.itvsh.goofy.common.command.CommandOrder; import de.itvsh.goofy.common.user.UserId; import de.itvsh.goofy.common.user.UserTestFactory; diff --git a/goofy-server/src/test/java/de/itvsh/goofy/wiedervorlage/AttachmentsByWiedervorlageControllerTest.java b/goofy-server/src/test/java/de/itvsh/goofy/wiedervorlage/AttachmentsByWiedervorlageControllerTest.java index a4376aaa20a7e2863499c2be9fbaeb0e088e1694..d1f6c001d37e6f8467ad371afcc4d7b1f117de07 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/wiedervorlage/AttachmentsByWiedervorlageControllerTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/wiedervorlage/AttachmentsByWiedervorlageControllerTest.java @@ -16,8 +16,8 @@ import org.mockito.Spy; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import de.itvsh.goofy.binary.BinaryFileController; -import de.itvsh.goofy.binary.FileId; +import de.itvsh.goofy.common.binaryfile.BinaryFileController; +import de.itvsh.goofy.common.binaryfile.FileId; import de.itvsh.goofy.wiedervorlage.WiedervorlageController.AttachmentsByWiedervorlageController; class AttachmentsByWiedervorlageControllerTest { diff --git a/goofy-server/src/test/java/de/itvsh/goofy/wiedervorlage/WiedervorlageControllerTest.java b/goofy-server/src/test/java/de/itvsh/goofy/wiedervorlage/WiedervorlageControllerTest.java index 2d266dc84210c4f716ac421553c204a714c6cff8..49e6a999e1b07b0e99d2838b2b7c2ef5b70ce2d1 100644 --- a/goofy-server/src/test/java/de/itvsh/goofy/wiedervorlage/WiedervorlageControllerTest.java +++ b/goofy-server/src/test/java/de/itvsh/goofy/wiedervorlage/WiedervorlageControllerTest.java @@ -19,7 +19,7 @@ import org.mockito.Spy; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import de.itvsh.goofy.binary.BinaryFileController; +import de.itvsh.goofy.common.binaryfile.BinaryFileController; import de.itvsh.goofy.vorgang.VorgangHeaderTestFactory; class WiedervorlageControllerTest { diff --git a/goofy-server/src/test/resources/application-itcase.yml b/goofy-server/src/test/resources/application-itcase.yml new file mode 100644 index 0000000000000000000000000000000000000000..f17842543f7b79206a4007a7b90e3fe531579c4c --- /dev/null +++ b/goofy-server/src/test/resources/application-itcase.yml @@ -0,0 +1,3 @@ +logging: + level: + ROOT: ERROR diff --git a/goofy-server/src/test/resources/application.yml b/goofy-server/src/test/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..e65ed990d2f376bcef8ebf8a86b9ca574f91d83e --- /dev/null +++ b/goofy-server/src/test/resources/application.yml @@ -0,0 +1,21 @@ +spring: + profiles: + active: + - itcase + - local + mvc: + pathmatch: + matching-strategy: ant-path-matcher + +kop: + auth: + token: + secret: quatsch + validity: 60000 + +goofy: + production: false + keycloak: + api: + user: goofyApiUser + password: quatsch \ No newline at end of file diff --git a/pom.xml b/pom.xml index aa5c8ac44dfcaa4b683f9b5f41d9dc5698439c31..96afcf5a773f68b6675131a36eb2f99740cd376d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,18 +3,18 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <!-- <parent> --> - <!-- <groupId>de.itvsh.kop</groupId> --> - <!-- <artifactId>kop-common-parent</artifactId> --> - <!-- <version>0.0.1-SNAPSHOT</version> --> - <!-- </parent> --> - <groupId>de.itvsh.ozg</groupId> <artifactId>goofy</artifactId> - <version>0.17.0-SNAPSHOT</version> + <version>0.18.0-SNAPSHOT</version> <name>Goofy Parent</name> <packaging>pom</packaging> + <parent> + <groupId>de.itvsh.kop.common</groupId> + <artifactId>kop-common-parent</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <modules> <module>goofy-client</module> <module>goofy-server</module> @@ -23,240 +23,20 @@ <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <java.version>17</java.version> - - <pluto.version>${project.version}</pluto.version> - - <spring.boot.version>2.4.12</spring.boot.version> - - <grpc.spring-boot-starter.version>2.12.0.RELEASE</grpc.spring-boot-starter.version> - <spring-admin.version>2.3.1</spring-admin.version> - <mapstruct.version>1.4.2.Final</mapstruct.version> - <commons-io.version>2.11.0</commons-io.version> - <commons-beanutils.version>1.9.4</commons-beanutils.version> - <keycloak-adapter.version>15.0.2</keycloak-adapter.version> - <lombok.version>1.18.22</lombok.version> - <!-- <lombok.version>edge-SNAPSHOT</lombok.version> --> - - <lorem.version>2.1</lorem.version> - <java-jwt.version>3.18.2</java-jwt.version> - <jjwt.version>0.9.1</jjwt.version> - - <!-- plugins --> - <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version> - <resources.plugin.version>3.1.0</resources.plugin.version> - <maven.surefire.version>3.0.0-M5</maven.surefire.version> - <maven.failsafe.version>3.0.0-M5</maven.failsafe.version> - <git-comit-id.plugin.version>4.0.3</git-comit-id.plugin.version> - <sonarqube.version>3.8.2</sonarqube.version> - <jacoco.plugin.version>0.8.7</jacoco.plugin.version> + <pluto.version>0.18.0-SNAPSHOT</pluto.version> </properties> <dependencyManagement> <dependencies> - <!-- spring --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-dependencies</artifactId> - <version>${spring.boot.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - - <!-- keycloak --> - <dependency> - <groupId>org.keycloak.bom</groupId> - <artifactId>keycloak-adapter-bom</artifactId> - <version>${keycloak-adapter.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - <dependency> - <groupId>org.keycloak</groupId> - <artifactId>keycloak-admin-client</artifactId> - <version>${keycloak-adapter.version}</version> - </dependency> - - <dependency> - <groupId>de.codecentric</groupId> - <artifactId>spring-boot-admin-starter-client</artifactId> - <version>${spring-admin.version}</version> - </dependency> - - <!-- commons --> - <dependency> - <groupId>commons-io</groupId> - <artifactId>commons-io</artifactId> - <version>${commons-io.version}</version> - </dependency> - <dependency> - <groupId>commons-beanutils</groupId> - <artifactId>commons-beanutils</artifactId> - <version>${commons-beanutils.version}</version> - </dependency> - - <!-- tools --> - <dependency> - <groupId>org.mapstruct</groupId> - <artifactId>mapstruct</artifactId> - <version>${mapstruct.version}</version> - </dependency> - <dependency> - <groupId>net.devh</groupId> - <artifactId>grpc-client-spring-boot-starter</artifactId> - <version>${grpc.spring-boot-starter.version}</version> - </dependency> - <dependency> <groupId>de.itvsh.ozg.pluto</groupId> <artifactId>pluto-interface</artifactId> <version>${pluto.version}</version> </dependency> - - <dependency> - <groupId>com.thedeanda</groupId> - <artifactId>lorem</artifactId> - <version>${lorem.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <version>${lombok.version}</version> - </dependency> - - <!-- jwt --> - <dependency> - <groupId>com.auth0</groupId> - <artifactId>java-jwt</artifactId> - <version>${java-jwt.version}</version> - </dependency> - <dependency> - <groupId>io.jsonwebtoken</groupId> - <artifactId>jjwt</artifactId> - <version>${jjwt.version}</version> - </dependency> </dependencies> </dependencyManagement> - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>${resources.plugin.version}</version> - </plugin> - - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <version>${spring.boot.version}</version> - <executions> - <execution> - <id>repackage</id> - <goals> - <goal>repackage</goal> - </goals> - </execution> - - <execution> - <id>build info</id> - <goals> - <goal>build-info</goal> - </goals> - <!-- <configuration> <additionalProperties> <jenkins.build.number>${buildnumber}</jenkins.build.number> - </additionalProperties> </configuration> --> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <version>${maven-jar-plugin.version}</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${maven.surefire.version}</version> - <configuration> - <argLine> - --illegal-access=permit - </argLine> - </configuration> - </plugin> - - <plugin> - <groupId>org.sonarsource.scanner.maven</groupId> - <artifactId>sonar-maven-plugin</artifactId> - <version>${sonarqube.version}</version> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <version>${maven.failsafe.version}</version> - <configuration> - <argLine> - --illegal-access=permit - </argLine> - <classesDirectory>${project.build.outputDirectory}</classesDirectory> - </configuration> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>pl.project13.maven</groupId> - <artifactId>git-commit-id-plugin</artifactId> - <version>${git-comit-id.plugin.version}</version> - <configuration> - <offline>true</offline> - </configuration> - <executions> - <execution> - <id>get-the-git-infos</id> - <goals> - <goal>revision</goal> - </goals> - <phase>initialize</phase> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>${jacoco.plugin.version}</version> - <executions> - <execution> - <id>start-agent</id> - <goals> - <goal>prepare-agent</goal> - </goals> - <configuration> - <propertyName>surefire.jacoco.args</propertyName> - </configuration> - </execution> - <execution> - <id>generate-report</id> - <phase>package</phase> - <goals> - <goal>report</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </pluginManagement> - </build> - <distributionManagement> <repository> <id>ozg-nexus</id> @@ -264,7 +44,7 @@ <url>https://nexus.ozg-sh.de/repository/ozg-releases/</url> </repository> <snapshotRepository> - <id>ozg-nexus</id> + <id>ozg-snapshots-nexus</id> <name>ozg-snapshots</name> <url>https://nexus.ozg-sh.de/repository/ozg-snapshots/</url> </snapshotRepository>