From 38a493d18145bbaaffa4a1f5a91e1deb41ec5e28 Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 24 Oct 2024 19:18:32 +0300 Subject: [PATCH 01/17] Remove VK and Yandex links and labels on the login and register pages. --- resources/view/login.html | 8 -------- resources/view/unauth/register.html | 9 +-------- src/main/resources/application.yaml | 24 ------------------------ 3 files changed, 1 insertion(+), 40 deletions(-) diff --git a/resources/view/login.html b/resources/view/login.html index 8765ca8ff..d49ce5691 100644 --- a/resources/view/login.html +++ b/resources/view/login.html @@ -48,14 +48,6 @@

Sign in

type="button"> - - - - - - diff --git a/resources/view/unauth/register.html b/resources/view/unauth/register.html index 2ba955045..63c5c8bc3 100644 --- a/resources/view/unauth/register.html +++ b/resources/view/unauth/register.html @@ -77,14 +77,7 @@

Registration

type="button"> - - - - - - + diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 7fcba1570..d9660eb05 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -61,20 +61,6 @@ spring: scope: - email - profile - vk: - client-id: 51562377 - client-secret: jNM1YHQy1362Mqs49wUN - client-name: Vkontakte - redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" - client-authentication-method: client_secret_post - authorization-grant-type: authorization_code - scope: email - yandex: - client-id: 2f3395214ba84075956b76a34b231985 - client-secret: ed236c501e444a609b0f419e5e88f1e1 - client-name: Yandex - redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" - authorization-grant-type: authorization_code gitlab: client-id: b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494 client-secret: e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004 @@ -83,16 +69,6 @@ spring: authorization-grant-type: authorization_code scope: read_user provider: - vk: - authorization-uri: https://oauth.vk.com/authorize - token-uri: https://oauth.vk.com/access_token - user-info-uri: https://api.vk.com/method/users.get?v=8.1 - user-name-attribute: response - yandex: - authorization-uri: https://oauth.yandex.ru/authorize - token-uri: https://oauth.yandex.ru/token - user-info-uri: https://login.yandex.ru/info - user-name-attribute: login gitlab: authorization-uri: https://gitlab.com/oauth/authorize token-uri: https://gitlab.com/oauth/token From f2e706ae5868bcefa989e6139af476ecd3089b12 Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 24 Oct 2024 20:30:07 +0300 Subject: [PATCH 02/17] Remove VK and Yandex links and labels on the login and register pages. --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index f6c152c68..0e23fb071 100644 --- a/pom.xml +++ b/pom.xml @@ -97,6 +97,7 @@ org.projectlombok lombok true + 1.18.30 org.mapstruct From abec27c7686e8b39e5b58703fd75681889ee25da Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 24 Oct 2024 20:34:22 +0300 Subject: [PATCH 03/17] Remove sensitive DB, OAuth2 and mail settings information --- src/main/resources/application.yaml | 46 ++--------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index d9660eb05..be8319782 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -8,6 +8,8 @@ app: max-pool-size: 100 spring: + config: + import: optional:application-secrets.yaml init: mode: never jpa: @@ -25,10 +27,6 @@ spring: default_batch_fetch_size: 20 # https://stackoverflow.com/questions/21257819/what-is-the-difference-between-hibernate-jdbc-fetch-size-and-hibernate-jdbc-batc jdbc.batch_size: 20 - datasource: - url: jdbc:postgresql://localhost:5432/jira - username: jira - password: JiraRush liquibase: changeLog: "classpath:db/changelog.sql" @@ -46,50 +44,10 @@ spring: cache-names: users caffeine.spec: maximumSize=10000,expireAfterAccess=5m - security: - oauth2: - client: - registration: - github: - client-id: 3d0d8738e65881fff266 - client-secret: 0f97031ce6178b7dfb67a6af587f37e222a16120 - scope: - - email - google: - client-id: 329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com - client-secret: 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 - scope: - - email - - profile - gitlab: - client-id: b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494 - client-secret: e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004 - client-name: GitLab - redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" - authorization-grant-type: authorization_code - scope: read_user - provider: - gitlab: - authorization-uri: https://gitlab.com/oauth/authorize - token-uri: https://gitlab.com/oauth/token - user-info-uri: https://gitlab.com/api/v4/user - user-name-attribute: email - sql: init: mode: always - mail: - properties: - mail: - smtp: - starttls: - enable: true - auth: true - host: smtp.gmail.com - username: jira4jr@gmail.com - password: zdfzsrqvgimldzyj - port: 587 thymeleaf.check-template-location: false mvc.throw-exception-if-no-handler-found: true From c1d2d3b85c3e71d985ae5fb144e8a85567a07403 Mon Sep 17 00:00:00 2001 From: Kirill Date: Thu, 24 Oct 2024 20:35:00 +0300 Subject: [PATCH 04/17] Create file. Transfer sensitive DB, OAuth2 and mail settings information from "application.yaml". --- src/main/resources/application-secrets.yaml | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/main/resources/application-secrets.yaml diff --git a/src/main/resources/application-secrets.yaml b/src/main/resources/application-secrets.yaml new file mode 100644 index 000000000..beaf7793d --- /dev/null +++ b/src/main/resources/application-secrets.yaml @@ -0,0 +1,46 @@ +spring: + datasource: + url: jdbc:postgresql://localhost:5432/jira + username: jira + password: JiraRush + + security: + oauth2: + client: + registration: + github: + client-id: 3d0d8738e65881fff266 + client-secret: 0f97031ce6178b7dfb67a6af587f37e222a16120 + scope: + - email + google: + client-id: 329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com + client-secret: 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 + scope: + - email + - profile + gitlab: + client-id: b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494 + client-secret: e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004 + client-name: GitLab + redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" + authorization-grant-type: authorization_code + scope: read_user + provider: + gitlab: + authorization-uri: https://gitlab.com/oauth/authorize + token-uri: https://gitlab.com/oauth/token + user-info-uri: https://gitlab.com/api/v4/user + user-name-attribute: email + + mail: + properties: + mail: + smtp: + starttls: + enable: true + auth: true + host: smtp.gmail.com + username: jira4jr@gmail.com + password: zdfzsrqvgimldzyj + port: 587 From b41543e2b762ee910ebe6e33fb6247c1a791a0f2 Mon Sep 17 00:00:00 2001 From: Kirill Date: Sat, 26 Oct 2024 14:16:16 +0300 Subject: [PATCH 05/17] Change and create settings for H2 DB tests. --- pom.xml | 6 + .../javarush/jira/AbstractControllerTest.java | 2 +- .../jira/JiraRushApplicationTests.java | 2 + src/test/resources/application-test.yaml | 13 +- src/test/resources/db/changelog-test.sql | 327 ++++++++++++++++++ src/test/resources/db/data-test.sql | 327 ++++++++++++++++++ 6 files changed, 670 insertions(+), 7 deletions(-) create mode 100644 src/test/resources/db/changelog-test.sql create mode 100644 src/test/resources/db/data-test.sql diff --git a/pom.xml b/pom.xml index 0e23fb071..bb2052755 100644 --- a/pom.xml +++ b/pom.xml @@ -143,6 +143,12 @@ junit-platform-launcher test + + + com.h2database + h2 + runtime + diff --git a/src/test/java/com/javarush/jira/AbstractControllerTest.java b/src/test/java/com/javarush/jira/AbstractControllerTest.java index 5981bae53..bd58ac46f 100644 --- a/src/test/java/com/javarush/jira/AbstractControllerTest.java +++ b/src/test/java/com/javarush/jira/AbstractControllerTest.java @@ -9,7 +9,7 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; //https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications -@Sql(scripts = {"classpath:db/changelog.sql", "classpath:data.sql"}, config = @SqlConfig(encoding = "UTF-8")) +@Sql(scripts = {"classpath:db/changelog-test.sql", "classpath:data-test.sql"}, config = @SqlConfig(encoding = "UTF-8")) @AutoConfigureMockMvc //https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications-testing-with-mock-environment public abstract class AbstractControllerTest extends BaseTests { diff --git a/src/test/java/com/javarush/jira/JiraRushApplicationTests.java b/src/test/java/com/javarush/jira/JiraRushApplicationTests.java index 287178598..f821163f8 100644 --- a/src/test/java/com/javarush/jira/JiraRushApplicationTests.java +++ b/src/test/java/com/javarush/jira/JiraRushApplicationTests.java @@ -1,7 +1,9 @@ package com.javarush.jira; import org.junit.jupiter.api.Test; +import org.springframework.test.context.ActiveProfiles; +@ActiveProfiles("test") class JiraRushApplicationTests extends BaseTests { @Test void contextLoads() { diff --git a/src/test/resources/application-test.yaml b/src/test/resources/application-test.yaml index 51137fd06..e6e1f0a6f 100644 --- a/src/test/resources/application-test.yaml +++ b/src/test/resources/application-test.yaml @@ -1,8 +1,9 @@ -spring.cache.type: none spring: - init: - mode: always datasource: - url: jdbc:postgresql://localhost:5433/jira-test - username: jira - password: JiraRush \ No newline at end of file + url: jdbc:h2:/src/test/resources/db/data-test.sql;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: + driver-class-name: org.h2.Driver + + liquibase: + changeLog: "classpath:db/changelog-test.sql" \ No newline at end of file diff --git a/src/test/resources/db/changelog-test.sql b/src/test/resources/db/changelog-test.sql new file mode 100644 index 000000000..05b0e6b62 --- /dev/null +++ b/src/test/resources/db/changelog-test.sql @@ -0,0 +1,327 @@ +--liquibase formatted sql + +--changeset kmpk:init_schema +DROP TABLE IF EXISTS USER_ROLE; +DROP TABLE IF EXISTS CONTACT; +DROP TABLE IF EXISTS MAIL_CASE; +DROP + SEQUENCE IF EXISTS MAIL_CASE_ID_SEQ; +DROP TABLE IF EXISTS PROFILE; +DROP TABLE IF EXISTS TASK_TAG; +DROP TABLE IF EXISTS USER_BELONG; +DROP + SEQUENCE IF EXISTS USER_BELONG_ID_SEQ; +DROP TABLE IF EXISTS ACTIVITY; +DROP + SEQUENCE IF EXISTS ACTIVITY_ID_SEQ; +DROP TABLE IF EXISTS TASK; +DROP + SEQUENCE IF EXISTS TASK_ID_SEQ; +DROP TABLE IF EXISTS SPRINT; +DROP + SEQUENCE IF EXISTS SPRINT_ID_SEQ; +DROP TABLE IF EXISTS PROJECT; +DROP + SEQUENCE IF EXISTS PROJECT_ID_SEQ; +DROP TABLE IF EXISTS REFERENCE; +DROP + SEQUENCE IF EXISTS REFERENCE_ID_SEQ; +DROP TABLE IF EXISTS ATTACHMENT; +DROP + SEQUENCE IF EXISTS ATTACHMENT_ID_SEQ; +DROP TABLE IF EXISTS USERS; +DROP + SEQUENCE IF EXISTS USERS_ID_SEQ; + +create table PROJECT +( + ID bigserial primary key, + CODE varchar(32) not null + constraint UK_PROJECT_CODE unique, + TITLE varchar(1024) not null, + DESCRIPTION varchar(4096) not null, + TYPE_CODE varchar(32) not null, + STARTPOINT timestamp, + ENDPOINT timestamp, + PARENT_ID bigint, + constraint FK_PROJECT_PARENT foreign key (PARENT_ID) references PROJECT (ID) on delete cascade +); + +create table MAIL_CASE +( + ID bigserial primary key, + EMAIL varchar(255) not null, + NAME varchar(255) not null, + DATE_TIME timestamp not null, + RESULT varchar(255) not null, + TEMPLATE varchar(255) not null +); + +create table SPRINT +( + ID bigserial primary key, + STATUS_CODE varchar(32) not null, + STARTPOINT timestamp, + ENDPOINT timestamp, + TITLE varchar(1024) not null, + PROJECT_ID bigint not null, + constraint FK_SPRINT_PROJECT foreign key (PROJECT_ID) references PROJECT (ID) on delete cascade +); + +create table REFERENCE +( + ID bigserial primary key, + CODE varchar(32) not null, + REF_TYPE smallint not null, + ENDPOINT timestamp, + STARTPOINT timestamp, + TITLE varchar(1024) not null, + AUX varchar, + constraint UK_REFERENCE_REF_TYPE_CODE unique (REF_TYPE, CODE) +); + +create table USERS +( + ID bigserial primary key, + DISPLAY_NAME varchar(32) not null + constraint UK_USERS_DISPLAY_NAME unique, + EMAIL varchar(128) not null + constraint UK_USERS_EMAIL unique, + FIRST_NAME varchar(32) not null, + LAST_NAME varchar(32), + PASSWORD varchar(128) not null, + ENDPOINT timestamp, + STARTPOINT timestamp +); + +create table PROFILE +( + ID bigint primary key, + LAST_LOGIN timestamp, + LAST_FAILED_LOGIN timestamp, + MAIL_NOTIFICATIONS bigint, + constraint FK_PROFILE_USERS foreign key (ID) references USERS (ID) on delete cascade +); + +CREATE TABLE CONTACT ( + ID BIGINT NOT NULL, + CODE VARCHAR(32) NOT NULL, + "VALUE" VARCHAR(256) NOT NULL, + PRIMARY KEY (ID, CODE), + CONSTRAINT FK_CONTACT_PROFILE FOREIGN KEY (ID) REFERENCES PROFILE (ID) ON DELETE CASCADE +); + +create table TASK +( + ID bigserial primary key, + TITLE varchar(1024) not null, + DESCRIPTION varchar(4096) not null, + TYPE_CODE varchar(32) not null, + STATUS_CODE varchar(32) not null, + PRIORITY_CODE varchar(32) not null, + ESTIMATE integer, + UPDATED timestamp, + PROJECT_ID bigint not null, + SPRINT_ID bigint, + PARENT_ID bigint, + STARTPOINT timestamp, + ENDPOINT timestamp, + constraint FK_TASK_SPRINT foreign key (SPRINT_ID) references SPRINT (ID) on delete set null, + constraint FK_TASK_PROJECT foreign key (PROJECT_ID) references PROJECT (ID) on delete cascade, + constraint FK_TASK_PARENT_TASK foreign key (PARENT_ID) references TASK (ID) on delete cascade +); + +create table ACTIVITY +( + ID bigserial primary key, + AUTHOR_ID bigint not null, + TASK_ID bigint not null, + UPDATED timestamp, + COMMENT varchar(4096), +-- history of task field change + TITLE varchar(1024), + DESCRIPTION varchar(4096), + ESTIMATE integer, + TYPE_CODE varchar(32), + STATUS_CODE varchar(32), + PRIORITY_CODE varchar(32), + constraint FK_ACTIVITY_USERS foreign key (AUTHOR_ID) references USERS (ID), + constraint FK_ACTIVITY_TASK foreign key (TASK_ID) references TASK (ID) on delete cascade +); + +create table TASK_TAG +( + TASK_ID bigint not null, + TAG varchar(32) not null, + constraint UK_TASK_TAG unique (TASK_ID, TAG), + constraint FK_TASK_TAG foreign key (TASK_ID) references TASK (ID) on delete cascade +); + +create table USER_BELONG +( + ID bigserial primary key, + OBJECT_ID bigint not null, + OBJECT_TYPE smallint not null, + USER_ID bigint not null, + USER_TYPE_CODE varchar(32) not null, + STARTPOINT timestamp, + ENDPOINT timestamp, + constraint FK_USER_BELONG foreign key (USER_ID) references USERS (ID) +); +create unique index UK_USER_BELONG on USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE); +create index IX_USER_BELONG_USER_ID on USER_BELONG (USER_ID); + +create table ATTACHMENT +( + ID bigserial primary key, + NAME varchar(128) not null, + FILE_LINK varchar(2048) not null, + OBJECT_ID bigint not null, + OBJECT_TYPE smallint not null, + USER_ID bigint not null, + DATE_TIME timestamp, + constraint FK_ATTACHMENT foreign key (USER_ID) references USERS (ID) +); + +create table USER_ROLE +( + USER_ID bigint not null, + ROLE smallint not null, + constraint UK_USER_ROLE unique (USER_ID, ROLE), + constraint FK_USER_ROLE foreign key (USER_ID) references USERS (ID) on delete cascade +); + +--changeset kmpk:populate_data +--============ References ================= +insert into REFERENCE (CODE, TITLE, REF_TYPE) +-- TASK +values ('task', 'Task', 2), + ('story', 'Story', 2), + ('bug', 'Bug', 2), + ('epic', 'Epic', 2), +-- SPRINT_STATUS + ('planning', 'Planning', 4), + ('active', 'Active', 4), + ('finished', 'Finished', 4), +-- USER_TYPE + ('author', 'Author', 5), + ('developer', 'Developer', 5), + ('reviewer', 'Reviewer', 5), + ('tester', 'Tester', 5), +-- PROJECT + ('scrum', 'Scrum', 1), + ('task_tracker', 'Task tracker', 1), +-- CONTACT + ('skype', 'Skype', 0), + ('tg', 'Telegram', 0), + ('mobile', 'Mobile', 0), + ('phone', 'Phone', 0), + ('website', 'Website', 0), + ('vk', 'VK', 0), + ('linkedin', 'LinkedIn', 0), + ('github', 'GitHub', 0), +-- PRIORITY + ('critical', 'Critical', 7), + ('high', 'High', 7), + ('normal', 'Normal', 7), + ('low', 'Low', 7), + ('neutral', 'Neutral', 7); + +insert into REFERENCE (CODE, TITLE, REF_TYPE, AUX) +-- MAIL_NOTIFICATION +values ('assigned', 'Assigned', 6, '1'), + ('three_days_before_deadline', 'Three days before deadline', 6, '2'), + ('two_days_before_deadline', 'Two days before deadline', 6, '4'), + ('one_day_before_deadline', 'One day before deadline', 6, '8'), + ('deadline', 'Deadline', 6, '16'), + ('overdue', 'Overdue', 6, '32'), +-- TASK_STATUS + ('todo', 'ToDo', 3, 'in_progress,canceled'), + ('in_progress', 'In progress', 3, 'ready_for_review,canceled'), + ('ready_for_review', 'Ready for review', 3, 'review,canceled'), + ('review', 'Review', 3, 'in_progress,ready_for_test,canceled'), + ('ready_for_test', 'Ready for test', 3, 'test,canceled'), + ('test', 'Test', 3, 'done,in_progress,canceled'), + ('done', 'Done', 3, 'canceled'), + ('canceled', 'Canceled', 3, null); + +--changeset gkislin:change_backtracking_tables + +alter table SPRINT rename COLUMN TITLE to CODE; +alter table SPRINT + alter column CODE type varchar (32); +alter table SPRINT + alter column CODE set not null; +create unique index UK_SPRINT_PROJECT_CODE on SPRINT (PROJECT_ID, CODE); + +ALTER TABLE TASK + DROP COLUMN DESCRIPTION; +ALTER TABLE TASK + DROP COLUMN PRIORITY_CODE; +ALTER TABLE TASK + DROP COLUMN ESTIMATE; +ALTER TABLE TASK + DROP COLUMN UPDATED; + +--changeset ishlyakhtenkov:change_task_status_reference + +delete +from REFERENCE +where REF_TYPE = 3; +insert into REFERENCE (CODE, TITLE, REF_TYPE, AUX) +values ('todo', 'ToDo', 3, 'in_progress,canceled'), + ('in_progress', 'In progress', 3, 'ready_for_review,canceled'), + ('ready_for_review', 'Ready for review', 3, 'in_progress,review,canceled'), + ('review', 'Review', 3, 'in_progress,ready_for_test,canceled'), + ('ready_for_test', 'Ready for test', 3, 'review,test,canceled'), + ('test', 'Test', 3, 'done,in_progress,canceled'), + ('done', 'Done', 3, 'canceled'), + ('canceled', 'Canceled', 3, null); + +--changeset gkislin:users_add_on_delete_cascade + +ALTER TABLE ACTIVITY DROP CONSTRAINT IF EXISTS FK_ACTIVITY_USERS; +ALTER TABLE ACTIVITY ADD CONSTRAINT FK_ACTIVITY_USERS FOREIGN KEY (AUTHOR_ID) REFERENCES USERS (ID) ON DELETE CASCADE; + +ALTER TABLE USER_BELONG DROP CONSTRAINT IF EXISTS FK_USER_BELONG; +ALTER TABLE USER_BELONG ADD CONSTRAINT FK_USER_BELONG FOREIGN KEY (USER_ID) REFERENCES USERS (ID) ON DELETE CASCADE; + +ALTER TABLE ATTACHMENT DROP CONSTRAINT IF EXISTS FK_ATTACHMENT; +ALTER TABLE ATTACHMENT ADD CONSTRAINT FK_ATTACHMENT FOREIGN KEY (USER_ID) REFERENCES USERS (ID) ON DELETE CASCADE; + +--changeset valeriyemelyanov:change_user_type_reference + +delete +from REFERENCE +where REF_TYPE = 5; +insert into REFERENCE (CODE, TITLE, REF_TYPE) +-- USER_TYPE +values ('project_author', 'Author', 5), + ('project_manager', 'Manager', 5), + ('sprint_author', 'Author', 5), + ('sprint_manager', 'Manager', 5), + ('task_author', 'Author', 5), + ('task_developer', 'Developer', 5), + ('task_reviewer', 'Reviewer', 5), + ('task_tester', 'Tester', 5); + +--changeset apolik:refactor_reference_aux + +-- TASK_TYPE +delete +from REFERENCE +where REF_TYPE = 3; +insert into REFERENCE (CODE, TITLE, REF_TYPE, AUX) +values ('todo', 'ToDo', 3, 'in_progress,canceled|'), + ('in_progress', 'In progress', 3, 'ready_for_review,canceled|task_developer'), + ('ready_for_review', 'Ready for review', 3, 'in_progress,review,canceled|'), + ('review', 'Review', 3, 'in_progress,ready_for_test,canceled|task_reviewer'), + ('ready_for_test', 'Ready for test', 3, 'review,test,canceled|'), + ('test', 'Test', 3, 'done,in_progress,canceled|task_tester'), + ('done', 'Done', 3, 'canceled|'), + ('canceled', 'Canceled', 3, null); + +--changeset ishlyakhtenkov:change_UK_USER_BELONG + +DROP INDEX IF EXISTS UK_USER_BELONG; +CREATE UNIQUE INDEX UK_USER_BELONG ON USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE); diff --git a/src/test/resources/db/data-test.sql b/src/test/resources/db/data-test.sql new file mode 100644 index 000000000..90d4e5475 --- /dev/null +++ b/src/test/resources/db/data-test.sql @@ -0,0 +1,327 @@ +-- populate users +DELETE +FROM USERS; +alter + sequence USERS_ID_SEQ restart with 1; +insert into USERS (EMAIL, PASSWORD, FIRST_NAME, LAST_NAME, DISPLAY_NAME) +values ('user@gmail.com', '{noop}password', 'userFirstName', 'userLastName', 'userDisplayName'), + ('admin@gmail.com', '{noop}admin', 'adminFirstName', 'adminLastName', 'adminDisplayName'), + ('guest@gmail.com', '{noop}guest', 'guestFirstName', 'guestLastName', 'guestDisplayName'), + ('manager@gmail.com', '{noop}manager', 'managerFirstName', 'managerLastName', 'managerDisplayName'), + ('taras@gmail.com', '{noop}password', 'Тарас', 'Шевченко', '@taras'), + ('petlura@gmail.com', '{noop}password', 'Симон', 'Петлюра', '@epetl'), + ('moroz_a@gmail.com', '{noop}password', 'Александр', 'Мороз', '@Moroz93'), + ('antonio.nest@gmail.com', '{noop}password', 'Антон', 'Нестеров', '@antonio_nest'), + ('i.franko@gmail.com', '{noop}password', 'Иван', 'Франко', '@ifranko'), + ('g.skovoroda@gmail.com', '{noop}password', 'Григорий', 'Сковорода', '@Gregory24'), + ('arsh.and@gmail.com', '{noop}password', 'Андрей', 'Арш', '@arsh01'), + ('squirrel2011@gmail.com', '{noop}password', 'Леся', 'Иванюк', '@SmallSquirrel'), + ('nikk24@gmail.com', '{noop}password', 'Николай', 'Никулин', '@nikk'), + ('artem711@gmail.com', '{noop}password', 'Артем', 'Запорожец', '@Artt'), + ('max.pain@gmail.com', '{noop}password', 'Максим', 'Дудник', '@MaxPain'), + ('admin@aws.co', '{noop}password', 'test', 'admin', '@testAdmin'); + +-- 0 DEV +-- 1 ADMIN +-- 2 MANAGER +DELETE +FROM USER_ROLE; +insert into USER_ROLE (USER_ID, ROLE) +values (1, 0), + (2, 0), + (2, 1), + (4, 2), + (5, 0), + (6, 0), + (7, 0), + (8, 0), + (9, 0), + (10, 0), + (11, 0), + (12, 0), + (13, 0), + (14, 0), + (15, 1), + (16, 1); + + +insert into PROFILE (ID, LAST_FAILED_LOGIN, LAST_LOGIN, MAIL_NOTIFICATIONS) +values (1, null, null, 49), + (2, null, null, 14); + +insert into CONTACT (ID, CODE, VALUE) +values (1, 'skype', 'userSkype'), + (1, 'mobile', '+01234567890'), + (1, 'website', 'user.com'), + (2, 'github', 'adminGitHub'), + (2, 'tg', 'adminTg'), + (2, 'vk', 'adminVk'); + +delete +from ATTACHMENT; +alter + sequence ATTACHMENT_ID_SEQ restart with 1; +insert into ATTACHMENT (name, file_link, object_id, object_type, user_id, date_time) +values ('Снимок экрана 1.png', './attachments/project/1_Снимок экрана 1.png', 2, 0, 4, '2023-05-04 22:28:50.215429'), + ('Снимок экрана 2.png', './attachments/project/2_Снимок экрана 2.png', 2, 0, 4, '2023-05-04 22:28:53.687600'), + ('Ежедневный-чеклист.xlsx', './attachments/project/3_Ежедневный-чеклист.xlsx', 2, 0, 4, + '2023-05-04 22:31:15.166547'), + ('Снимок экрана 1.png', './attachments/task/1_Снимок экрана 1.png', 41, 2, 4, '2023-05-04 22:28:53.687600'), + ('Снимок экрана 2.png', './attachments/task/2_Снимок экрана 2.png', 41, 2, 4, '2023-05-04 22:28:50.215429'), + ('Ежедневный-чеклист.xlsx', './attachments/task/3_Ежедневный-чеклист.xlsx', 38, 2, 4, + '2023-05-04 22:28:50.215429'); +alter + sequence ATTACHMENT_ID_SEQ restart with 1000; + + +-- populate tasks +delete +from TASK; +alter + sequence TASK_ID_SEQ restart with 1; +delete +from SPRINT; +alter + sequence SPRINT_ID_SEQ restart with 1; +delete +from PROJECT; +alter + sequence PROJECT_ID_SEQ restart with 1; +delete +from ACTIVITY; +alter + sequence ACTIVITY_ID_SEQ restart with 1; + +insert into PROJECT (code, title, description, type_code, parent_id) +values ('JiraRush', 'JiraRush', '«Mini-JIRA» app : project management system tutorial app', 'task_tracker', null), + ('Test_Project', 'Test Project', 'Just test project', 'task_tracker', null), + ('Test_Project_2', 'Test Project 2', 'Just test project 2', 'task_tracker', null), + ('JiraRush sub', 'JiraRush subproject', 'subproject', 'task_tracker', 1); +alter + sequence PROJECT_ID_SEQ restart with 1000; + +insert into SPRINT (status_code, startpoint, endpoint, code, project_id) +values ('active', null, null, 'Sprint-2', 1), + ('finished', '2023-04-09 08:05:10', '2023-04-29 16:48:34', 'Sprint-1', 2), + ('finished', '2023-04-03 12:14:11', '2023-04-18 17:03:41', 'Sprint-2', 2), + ('active', '2023-04-05 14:25:43', '2023-06-10 13:00:00', 'Sprint-3', 2), + ('active', null, null, 'Sprint-1', 4); +alter + sequence SPRINT_ID_SEQ restart with 1000; + +---- project 1 ------------- +INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, STARTPOINT) +values ('Data', 'epic', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Trees', 'epic', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI', 'epic', 'in_progress', 1, 1, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Sprint', 'epic', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Project', 'epic', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Task', 'epic', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Attachments', 'story', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Dashboard', 'epic', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Report of Sprint (UI)', 'story', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Organizational-architectural', 'epic', 'in_progress', 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), ---- project 2 ------------- + ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'canceled', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_test', 2, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_test', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_test', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'story', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'bug', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'epic', 'in_progress', 2, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_review', 2, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_review', 2, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'story', 'ready_for_test', 2, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'bug', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'epic', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'story', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'bug', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'canceled', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'canceled', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_test', 2, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'in_progress', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_test', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_test', 2, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'story', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'bug', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'epic', 'in_progress', 2, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_review', 2, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'ready_for_review', 2, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'story', 'ready_for_test', 2, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'bug', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'epic', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'story', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'bug', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Title', 'task', 'canceled', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('subproject sprint task', 'epic', 'in_progress', 4, 5, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('subproject backlog task', 'epic', 'in_progress', 4, null, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'); + +INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, PARENT_ID, STARTPOINT) +values ('Add role manager and filters in security', 'task', 'done', 1, 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Add users from task-timing', 'task', 'ready_for_review', 1, 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Add tasks-2 in DB', 'task', 'in_progress', 1, 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Remove reference with USER_TYPE IN (3,4,5)', 'task', 'in_progress', 1, 1, 1, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('REST API for trees', 'task', 'in_progress', 1, 1, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Drawing in trees', 'task', 'in_progress', 1, 1, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Context menu', 'task', 'in_progress', 1, 1, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Reassignment sprint', 'task', 'in_progress', 1, 1, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Add task, subtask, sprint, subsprint', 'task', 'in_progress', 1, 1, 2, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Make layout for view TitleTo', 'task', 'in_progress', 1, 1, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Make layout for edit TitleTo', 'task', 'in_progress', 1, 1, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Fix header-fragment', 'task', 'ready_for_review', 1, 1, 3, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('REST API', 'task', 'in_progress', 1, 1, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Tests', 'task', 'in_progress', 1, 1, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI edit', 'task', 'in_progress', 1, 1, 4, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('REST API', 'task', 'in_progress', 1, 1, 5, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Tests', 'task', 'in_progress', 1, 1, 5, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 5, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI edit', 'task', 'in_progress', 1, 1, 5, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('REST API', 'task', 'in_progress', 1, 1, 6, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Tests', 'task', 'in_progress', 1, 1, 6, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI edit', 'task', 'in_progress', 1, 1, 6, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI view add to Task, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI edit add to Task', 'task', 'in_progress', 1, 1, 6, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Edit changelog with changes of Task model', 'task', 'in_progress', 1, 1, 6, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('REST API: changeStatus', 'task', 'in_progress', 1, 1, 6, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Make columns with tasks', 'task', 'in_progress', 1, 1, 8, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('UI tab of tasks', 'task', 'in_progress', 1, 1, 8, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Context mune', 'task', 'in_progress', 1, 1, 8, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Duration, count of tasks, elapsed time', 'task', 'in_progress', 1, 1, 9, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Meeting, dividing tasks', 'task', 'in_progress', 1, 1, 10, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Refactoring packages', 'task', 'in_progress', 1, 1, 10, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Refactoring tasks', 'task', 'in_progress', 1, 1, 10, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Subproject sprint subtask', 'task', 'in_progress', 4, 5, 87, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + ('Subproject backlog subtask', 'task', 'in_progress', 4, null, 88, + now() + random() * interval '5 minutes' + random() * interval '20 seconds'); +alter + sequence TASK_ID_SEQ restart with 1000; + +---task 1------ +INSERT INTO ACTIVITY(AUTHOR_ID, TASK_ID, UPDATED, COMMENT, TITLE, DESCRIPTION, ESTIMATE, TYPE_CODE, STATUS_CODE, + PRIORITY_CODE) +values (6, 1, '2023-05-15 09:05:10', null, 'Data', null, 3, 'epic', 'in_progress', 'low'), + (5, 1, '2023-05-15 12:25:10', null, 'Data', null, null, null, null, 'normal'), + (6, 1, '2023-05-15 14:05:10', null, 'Data', null, 4, null, null, null), ---task 118---- + (11, 118, '2023-05-16 10:05:10', null, 'UI tab of tasks', null, 4, 'task', 'in_progress', 'normal'), + (5, 118, '2023-05-16 11:10:10', null, 'UI tab of tasks', null, null, null, null, 'high'), + (11, 118, '2023-05-16 12:30:10', null, 'UI tab of tasks', null, 2, null, null, null); + From f2a3afe752eb28df7956333b72ecf3f190c3da9e Mon Sep 17 00:00:00 2001 From: Kirill Date: Sat, 26 Oct 2024 14:17:18 +0300 Subject: [PATCH 06/17] Change and create settings for H2 DB tests. --- src/test/resources/data.sql | 98 ------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 src/test/resources/data.sql diff --git a/src/test/resources/data.sql b/src/test/resources/data.sql deleted file mode 100644 index 5087dbddc..000000000 --- a/src/test/resources/data.sql +++ /dev/null @@ -1,98 +0,0 @@ ---------- users ---------------------- -delete -from USER_ROLE; -delete -from CONTACT; -delete -from PROFILE; - -delete -from ACTIVITY; -alter -sequence ACTIVITY_ID_SEQ restart with 1; -delete -from TASK; -alter -sequence TASK_ID_SEQ restart with 1; -delete -from SPRINT; -alter -sequence SPRINT_ID_SEQ restart with 1; -delete -from PROJECT; -alter -sequence PROJECT_ID_SEQ restart with 1; - -delete -from USERS; -alter -sequence USERS_ID_SEQ restart with 1; - -insert into USERS (EMAIL, PASSWORD, FIRST_NAME, LAST_NAME, DISPLAY_NAME) -values ('user@gmail.com', '{noop}password', 'userFirstName', 'userLastName', 'userDisplayName'), - ('admin@gmail.com', '{noop}admin', 'adminFirstName', 'adminLastName', 'adminDisplayName'), - ('guest@gmail.com', '{noop}guest', 'guestFirstName', 'guestLastName', 'guestDisplayName'), - ('manager@gmail.com', '{noop}manager', 'managerFirstName', 'managerLastName', 'managerDisplayName'); - --- 0 DEV --- 1 ADMIN --- 2 MANAGER - -insert into USER_ROLE (USER_ID, ROLE) -values (1, 0), - (2, 0), - (2, 1), - (4, 2); - -insert into PROFILE (ID, LAST_FAILED_LOGIN, LAST_LOGIN, MAIL_NOTIFICATIONS) -values (1, null, null, 49), - (2, null, null, 14); - -insert into CONTACT (ID, CODE, VALUE) -values (1, 'skype', 'userSkype'), - (1, 'mobile', '+01234567890'), - (1, 'website', 'user.com'), - (2, 'github', 'adminGitHub'), - (2, 'tg', 'adminTg'), - (2, 'vk', 'adminVk'); - - -insert into PROJECT (code, title, description, type_code, parent_id) -values ('PR1', 'PROJECT-1', 'test project 1', 'task_tracker', null), - ('PR2', 'PROJECT-2', 'test project 2', 'task_tracker', 1); - -insert into SPRINT (status_code, startpoint, endpoint, code, project_id) -values ('finished', '2023-05-01 08:05:10', '2023-05-07 17:10:01', 'SP-1.001', 1), - ('active', '2023-05-01 08:06:00', null, 'SP-1.002', 1), - ('active', '2023-05-01 08:07:00', null, 'SP-1.003', 1), - ('planning', '2023-05-01 08:08:00', null, 'SP-1.004', 1), - ('active', '2023-05-10 08:06:00', null, 'SP-2.001', 2), - ('planning', '2023-05-10 08:07:00', null, 'SP-2.002', 2), - ('planning', '2023-05-10 08:08:00', null, 'SP-2.003', 2); - -insert into TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, STARTPOINT) -values ('Data', 'epic', 'in_progress', 1, 1, '2023-05-15 09:05:10'), - ('Trees', 'epic', 'in_progress', 1, 1, '2023-05-15 12:05:10'), - ('task-3', 'task', 'ready_for_test', 2, 5, '2023-06-14 09:28:10'), - ('task-4', 'task', 'ready_for_review', 2, 5, '2023-06-14 09:28:10'), - ('task-5', 'task', 'todo', 2, 5, '2023-06-14 09:28:10'), - ('task-6', 'task', 'done', 2, 5, '2023-06-14 09:28:10'), - ('task-7', 'task', 'canceled', 2, 5, '2023-06-14 09:28:10'); - - -insert into ACTIVITY(AUTHOR_ID, TASK_ID, UPDATED, COMMENT, TITLE, DESCRIPTION, ESTIMATE, TYPE_CODE, STATUS_CODE, - PRIORITY_CODE) -values (1, 1, '2023-05-15 09:05:10', null, 'Data', null, 3, 'epic', 'in_progress', 'low'), - (2, 1, '2023-05-15 12:25:10', null, 'Data', null, null, null, null, 'normal'), - (1, 1, '2023-05-15 14:05:10', null, 'Data', null, 4, null, null, null), - (1, 2, '2023-05-15 12:05:10', null, 'Trees', 'Trees desc', 4, 'epic', 'in_progress', 'normal'); - -insert into USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE, STARTPOINT, ENDPOINT) -values (1, 2, 2, 'task_developer', '2023-06-14 08:35:10', '2023-06-14 08:55:00'), - (1, 2, 2, 'task_reviewer', '2023-06-14 09:35:10', null), - (1, 2, 1, 'task_developer', '2023-06-12 11:40:00', '2023-06-12 12:35:00'), - (1, 2, 1, 'task_developer', '2023-06-13 12:35:00', null), - (1, 2, 1, 'task_tester', '2023-06-14 15:20:00', null), - (2, 2, 2, 'task_developer', '2023-06-08 07:10:00', null), - (2, 2, 1, 'task_developer', '2023-06-09 14:48:00', null), - (2, 2, 1, 'task_tester', '2023-06-10 16:37:00', null); From f1918cb7da17545c847857986a3ac97e2edfe0ff Mon Sep 17 00:00:00 2001 From: Kirill Date: Sat, 26 Oct 2024 15:29:48 +0300 Subject: [PATCH 07/17] Try to fix original tests. --- .../javarush/jira/AbstractControllerTest.java | 2 +- src/test/resources/db/data-test.sql | 258 +++++++++--------- 2 files changed, 133 insertions(+), 127 deletions(-) diff --git a/src/test/java/com/javarush/jira/AbstractControllerTest.java b/src/test/java/com/javarush/jira/AbstractControllerTest.java index bd58ac46f..0f2481e00 100644 --- a/src/test/java/com/javarush/jira/AbstractControllerTest.java +++ b/src/test/java/com/javarush/jira/AbstractControllerTest.java @@ -9,7 +9,7 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; //https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications -@Sql(scripts = {"classpath:db/changelog-test.sql", "classpath:data-test.sql"}, config = @SqlConfig(encoding = "UTF-8")) +@Sql(scripts = {"classpath:db/changelog-test.sql", "classpath:db/data-test.sql"}, config = @SqlConfig(encoding = "UTF-8")) @AutoConfigureMockMvc //https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications-testing-with-mock-environment public abstract class AbstractControllerTest extends BaseTests { diff --git a/src/test/resources/db/data-test.sql b/src/test/resources/db/data-test.sql index 90d4e5475..0d540121c 100644 --- a/src/test/resources/db/data-test.sql +++ b/src/test/resources/db/data-test.sql @@ -1,6 +1,7 @@ -- populate users DELETE FROM USERS; +create sequence if not exists USERS_ID_SEQ start with 1; alter sequence USERS_ID_SEQ restart with 1; insert into USERS (EMAIL, PASSWORD, FIRST_NAME, LAST_NAME, DISPLAY_NAME) @@ -49,7 +50,7 @@ insert into PROFILE (ID, LAST_FAILED_LOGIN, LAST_LOGIN, MAIL_NOTIFICATIONS) values (1, null, null, 49), (2, null, null, 14); -insert into CONTACT (ID, CODE, VALUE) +insert into CONTACT (ID, CODE, "VALUE") values (1, 'skype', 'userSkype'), (1, 'mobile', '+01234567890'), (1, 'website', 'user.com'), @@ -59,6 +60,7 @@ values (1, 'skype', 'userSkype'), delete from ATTACHMENT; +create sequence if not exists ATTACHMENT_ID_SEQ start with 1; alter sequence ATTACHMENT_ID_SEQ restart with 1; insert into ATTACHMENT (name, file_link, object_id, object_type, user_id, date_time) @@ -77,18 +79,22 @@ alter -- populate tasks delete from TASK; +create sequence if not exists TASK_ID_SEQ start with 1; alter sequence TASK_ID_SEQ restart with 1; delete from SPRINT; +create sequence if not exists SPRINT_ID_SEQ start with 1; alter sequence SPRINT_ID_SEQ restart with 1; delete from PROJECT; +create sequence if not exists PROJECT_ID_SEQ start with 1; alter sequence PROJECT_ID_SEQ restart with 1; delete from ACTIVITY; +create sequence if not exists ACTIVITY_ID_SEQ start with 1; alter sequence ACTIVITY_ID_SEQ restart with 1; @@ -112,206 +118,206 @@ alter ---- project 1 ------------- INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, STARTPOINT) values ('Data', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Trees', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('UI', 'epic', 'in_progress', 1, 1, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('UI', 'epic', 'in_progress', 1, 1, now() + random() * 300 + random() * 20), ('Sprint', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Project', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Task', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Attachments', 'story', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Dashboard', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Report of Sprint (UI)', 'story', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Organizational-architectural', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), ---- project 2 ------------- - ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ---- project 2 ------------- + ('Title', 'task', 'todo', 2, 2, now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'canceled', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 2, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 300 + random() * 20), + ('Title', 'task', 'canceled', 2, 2, now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'story', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'story', 'todo', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'bug', 'todo', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), ('Title', 'epic', 'in_progress', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'story', 'ready_for_test', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'epic', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'story', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'canceled', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('Title', 'task', 'review', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'bug', 'review', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'epic', 'test', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'story', 'done', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'bug', 'done', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'canceled', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'canceled', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 2, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 300 + random() * 20), + ('Title', 'task', 'canceled', 2, 2, now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'story', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'story', 'todo', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'bug', 'todo', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), ('Title', 'epic', 'in_progress', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Title', 'story', 'ready_for_test', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'epic', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'story', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'canceled', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), + ('Title', 'task', 'review', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'bug', 'review', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'test', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'epic', 'test', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'story', 'done', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'bug', 'done', 2, 4, now() + random() * 300 + random() * 20), + ('Title', 'task', 'canceled', 2, 4, now() + random() * 300 + random() * 20), ('subproject sprint task', 'epic', 'in_progress', 4, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('subproject backlog task', 'epic', 'in_progress', 4, null, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'); + now() + random() * 300 + random() * 20); INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, PARENT_ID, STARTPOINT) values ('Add role manager and filters in security', 'task', 'done', 1, 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Add users from task-timing', 'task', 'ready_for_review', 1, 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Add tasks-2 in DB', 'task', 'in_progress', 1, 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Remove reference with USER_TYPE IN (3,4,5)', 'task', 'in_progress', 1, 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('REST API for trees', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Drawing in trees', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Context menu', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Reassignment sprint', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Add task, subtask, sprint, subsprint', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Make layout for view TitleTo', 'task', 'in_progress', 1, 1, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Make layout for edit TitleTo', 'task', 'in_progress', 1, 1, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Fix header-fragment', 'task', 'ready_for_review', 1, 1, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI view add to Task, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI edit add to Task', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Edit changelog with changes of Task model', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('REST API: changeStatus', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Make columns with tasks', 'task', 'in_progress', 1, 1, 8, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('UI tab of tasks', 'task', 'in_progress', 1, 1, 8, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Context mune', 'task', 'in_progress', 1, 1, 8, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Duration, count of tasks, elapsed time', 'task', 'in_progress', 1, 1, 9, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Meeting, dividing tasks', 'task', 'in_progress', 1, 1, 10, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Refactoring packages', 'task', 'in_progress', 1, 1, 10, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Refactoring tasks', 'task', 'in_progress', 1, 1, 10, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Subproject sprint subtask', 'task', 'in_progress', 4, 5, 87, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 300 + random() * 20), ('Subproject backlog subtask', 'task', 'in_progress', 4, null, 88, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'); + now() + random() * 300 + random() * 20); alter sequence TASK_ID_SEQ restart with 1000; From 7b973359c7e7960adf9ee7871875b44608a68aa5 Mon Sep 17 00:00:00 2001 From: Kirill Date: Sat, 26 Oct 2024 18:26:21 +0300 Subject: [PATCH 08/17] Change IO to NIO API in upload method of FileUtil class. --- .../jira/bugtracking/attachment/FileUtil.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/javarush/jira/bugtracking/attachment/FileUtil.java b/src/main/java/com/javarush/jira/bugtracking/attachment/FileUtil.java index 6cffbe175..2b79ce414 100644 --- a/src/main/java/com/javarush/jira/bugtracking/attachment/FileUtil.java +++ b/src/main/java/com/javarush/jira/bugtracking/attachment/FileUtil.java @@ -25,14 +25,18 @@ public static void upload(MultipartFile multipartFile, String directoryPath, Str throw new IllegalRequestDataException("Select a file to upload."); } - File dir = new File(directoryPath); - if (dir.exists() || dir.mkdirs()) { - File file = new File(directoryPath + fileName); - try (OutputStream outStream = new FileOutputStream(file)) { - outStream.write(multipartFile.getBytes()); - } catch (IOException ex) { - throw new IllegalRequestDataException("Failed to upload file" + multipartFile.getOriginalFilename()); + try { + Path dir = Paths.get(directoryPath); + if (Files.notExists(dir)) { + Files.createDirectories(dir); } + + Path filePath = dir.resolve(fileName); + + Files.write(filePath, multipartFile.getBytes()); + + } catch (IOException ex) { + throw new IllegalRequestDataException("Failed to upload file " + multipartFile.getOriginalFilename()); } } From 92cfc538410c993f843d6af34f5aad09c152669a Mon Sep 17 00:00:00 2001 From: Kirill Date: Sun, 27 Oct 2024 14:12:29 +0300 Subject: [PATCH 09/17] Create additional sql scripts, "test" and "prod" profiles for H2 test using. --- .../common/internal/config/AppConfig.java | 14 + .../javarush/jira/AbstractControllerTest.java | 2 +- src/test/resources/application-test.yaml | 8 +- src/test/resources/db/changelog-test.sql | 67 ++--- src/test/resources/db/data-test.sql | 279 +++++++++--------- 5 files changed, 193 insertions(+), 177 deletions(-) diff --git a/src/main/java/com/javarush/jira/common/internal/config/AppConfig.java b/src/main/java/com/javarush/jira/common/internal/config/AppConfig.java index fbc6ef804..2a6b94de0 100644 --- a/src/main/java/com/javarush/jira/common/internal/config/AppConfig.java +++ b/src/main/java/com/javarush/jira/common/internal/config/AppConfig.java @@ -5,18 +5,22 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.hibernate5.jakarta.Hibernate5JakartaModule; import com.javarush.jira.common.util.JsonUtil; +import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; import org.springframework.core.env.Environment; import org.springframework.core.env.Profiles; import org.springframework.http.ProblemDetail; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import javax.sql.DataSource; import java.util.Map; import java.util.concurrent.Executor; @@ -52,6 +56,16 @@ public boolean isTest() { return env.acceptsProfiles(Profiles.of("test")); } + @Profile("prod") + public DataSource prodDataSource() { + return DataSourceBuilder.create().build(); + } + + @Profile("test") + public DataSource testDataSource() { + return DataSourceBuilder.create().build(); + } + @Autowired void configureAndStoreObjectMapper(ObjectMapper objectMapper) { objectMapper.registerModule(new Hibernate5JakartaModule()); diff --git a/src/test/java/com/javarush/jira/AbstractControllerTest.java b/src/test/java/com/javarush/jira/AbstractControllerTest.java index bd58ac46f..0f2481e00 100644 --- a/src/test/java/com/javarush/jira/AbstractControllerTest.java +++ b/src/test/java/com/javarush/jira/AbstractControllerTest.java @@ -9,7 +9,7 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; //https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications -@Sql(scripts = {"classpath:db/changelog-test.sql", "classpath:data-test.sql"}, config = @SqlConfig(encoding = "UTF-8")) +@Sql(scripts = {"classpath:db/changelog-test.sql", "classpath:db/data-test.sql"}, config = @SqlConfig(encoding = "UTF-8")) @AutoConfigureMockMvc //https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications-testing-with-mock-environment public abstract class AbstractControllerTest extends BaseTests { diff --git a/src/test/resources/application-test.yaml b/src/test/resources/application-test.yaml index e6e1f0a6f..b0a8f7989 100644 --- a/src/test/resources/application-test.yaml +++ b/src/test/resources/application-test.yaml @@ -1,9 +1,13 @@ spring: datasource: - url: jdbc:h2:/src/test/resources/db/data-test.sql;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE username: sa password: driver-class-name: org.h2.Driver liquibase: - changeLog: "classpath:db/changelog-test.sql" \ No newline at end of file + change-log: "classpath:db/changelog-test.sql" + + sql: + init: + data-locations: "classpath:db/data-test.sql" \ No newline at end of file diff --git a/src/test/resources/db/changelog-test.sql b/src/test/resources/db/changelog-test.sql index 05b0e6b62..839e860e4 100644 --- a/src/test/resources/db/changelog-test.sql +++ b/src/test/resources/db/changelog-test.sql @@ -4,34 +4,25 @@ DROP TABLE IF EXISTS USER_ROLE; DROP TABLE IF EXISTS CONTACT; DROP TABLE IF EXISTS MAIL_CASE; -DROP - SEQUENCE IF EXISTS MAIL_CASE_ID_SEQ; +DROP SEQUENCE IF EXISTS MAIL_CASE_ID_SEQ; DROP TABLE IF EXISTS PROFILE; DROP TABLE IF EXISTS TASK_TAG; DROP TABLE IF EXISTS USER_BELONG; -DROP - SEQUENCE IF EXISTS USER_BELONG_ID_SEQ; +DROP SEQUENCE IF EXISTS USER_BELONG_ID_SEQ; DROP TABLE IF EXISTS ACTIVITY; -DROP - SEQUENCE IF EXISTS ACTIVITY_ID_SEQ; +DROP SEQUENCE IF EXISTS ACTIVITY_ID_SEQ; DROP TABLE IF EXISTS TASK; -DROP - SEQUENCE IF EXISTS TASK_ID_SEQ; +DROP SEQUENCE IF EXISTS TASK_ID_SEQ; DROP TABLE IF EXISTS SPRINT; -DROP - SEQUENCE IF EXISTS SPRINT_ID_SEQ; +DROP SEQUENCE IF EXISTS SPRINT_ID_SEQ; DROP TABLE IF EXISTS PROJECT; -DROP - SEQUENCE IF EXISTS PROJECT_ID_SEQ; +DROP SEQUENCE IF EXISTS PROJECT_ID_SEQ; DROP TABLE IF EXISTS REFERENCE; -DROP - SEQUENCE IF EXISTS REFERENCE_ID_SEQ; +DROP SEQUENCE IF EXISTS REFERENCE_ID_SEQ; DROP TABLE IF EXISTS ATTACHMENT; -DROP - SEQUENCE IF EXISTS ATTACHMENT_ID_SEQ; +DROP SEQUENCE IF EXISTS ATTACHMENT_ID_SEQ; DROP TABLE IF EXISTS USERS; -DROP - SEQUENCE IF EXISTS USERS_ID_SEQ; +DROP SEQUENCE IF EXISTS USERS_ID_SEQ; create table PROJECT ( @@ -103,12 +94,13 @@ create table PROFILE constraint FK_PROFILE_USERS foreign key (ID) references USERS (ID) on delete cascade ); -CREATE TABLE CONTACT ( - ID BIGINT NOT NULL, - CODE VARCHAR(32) NOT NULL, - "VALUE" VARCHAR(256) NOT NULL, - PRIMARY KEY (ID, CODE), - CONSTRAINT FK_CONTACT_PROFILE FOREIGN KEY (ID) REFERENCES PROFILE (ID) ON DELETE CASCADE +create table CONTACT +( + ID bigint not null, + CODE varchar(32) not null, + "VALUE" varchar(256) not null, + primary key (ID, CODE), + constraint FK_CONTACT_PROFILE foreign key (ID) references PROFILE (ID) on delete cascade ); create table TASK @@ -249,19 +241,19 @@ values ('assigned', 'Assigned', 6, '1'), alter table SPRINT rename COLUMN TITLE to CODE; alter table SPRINT - alter column CODE type varchar (32); +alter column CODE type varchar (32); alter table SPRINT alter column CODE set not null; create unique index UK_SPRINT_PROJECT_CODE on SPRINT (PROJECT_ID, CODE); ALTER TABLE TASK - DROP COLUMN DESCRIPTION; +DROP COLUMN DESCRIPTION; ALTER TABLE TASK - DROP COLUMN PRIORITY_CODE; +DROP COLUMN PRIORITY_CODE; ALTER TABLE TASK - DROP COLUMN ESTIMATE; +DROP COLUMN ESTIMATE; ALTER TABLE TASK - DROP COLUMN UPDATED; +DROP COLUMN UPDATED; --changeset ishlyakhtenkov:change_task_status_reference @@ -280,14 +272,14 @@ values ('todo', 'ToDo', 3, 'in_progress,canceled'), --changeset gkislin:users_add_on_delete_cascade -ALTER TABLE ACTIVITY DROP CONSTRAINT IF EXISTS FK_ACTIVITY_USERS; -ALTER TABLE ACTIVITY ADD CONSTRAINT FK_ACTIVITY_USERS FOREIGN KEY (AUTHOR_ID) REFERENCES USERS (ID) ON DELETE CASCADE; +alter table ACTIVITY drop constraint FK_ACTIVITY_USERS; +alter table ACTIVITY add constraint FK_ACTIVITY_USERS foreign key (AUTHOR_ID) references USERS (ID) on delete cascade; -ALTER TABLE USER_BELONG DROP CONSTRAINT IF EXISTS FK_USER_BELONG; -ALTER TABLE USER_BELONG ADD CONSTRAINT FK_USER_BELONG FOREIGN KEY (USER_ID) REFERENCES USERS (ID) ON DELETE CASCADE; +alter table USER_BELONG drop constraint FK_USER_BELONG; +alter table USER_BELONG add constraint FK_USER_BELONG foreign key (USER_ID) references USERS (ID) on delete cascade; -ALTER TABLE ATTACHMENT DROP CONSTRAINT IF EXISTS FK_ATTACHMENT; -ALTER TABLE ATTACHMENT ADD CONSTRAINT FK_ATTACHMENT FOREIGN KEY (USER_ID) REFERENCES USERS (ID) ON DELETE CASCADE; +alter table ATTACHMENT drop constraint FK_ATTACHMENT; +alter table ATTACHMENT add constraint FK_ATTACHMENT foreign key (USER_ID) references USERS (ID) on delete cascade; --changeset valeriyemelyanov:change_user_type_reference @@ -323,5 +315,6 @@ values ('todo', 'ToDo', 3, 'in_progress,canceled|'), --changeset ishlyakhtenkov:change_UK_USER_BELONG -DROP INDEX IF EXISTS UK_USER_BELONG; -CREATE UNIQUE INDEX UK_USER_BELONG ON USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE); +drop index UK_USER_BELONG; +-- create unique index UK_USER_BELONG on USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE) where ENDPOINT is null; +create unique index UK_USER_BELONG on USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE); diff --git a/src/test/resources/db/data-test.sql b/src/test/resources/db/data-test.sql index 90d4e5475..7a4dd2ed1 100644 --- a/src/test/resources/db/data-test.sql +++ b/src/test/resources/db/data-test.sql @@ -1,8 +1,8 @@ -- populate users DELETE FROM USERS; -alter - sequence USERS_ID_SEQ restart with 1; +create sequence USERS_ID_SEQ INCREMENT BY 1; +alter sequence USERS_ID_SEQ restart with 1; insert into USERS (EMAIL, PASSWORD, FIRST_NAME, LAST_NAME, DISPLAY_NAME) values ('user@gmail.com', '{noop}password', 'userFirstName', 'userLastName', 'userDisplayName'), ('admin@gmail.com', '{noop}admin', 'adminFirstName', 'adminLastName', 'adminDisplayName'), @@ -49,7 +49,7 @@ insert into PROFILE (ID, LAST_FAILED_LOGIN, LAST_LOGIN, MAIL_NOTIFICATIONS) values (1, null, null, 49), (2, null, null, 14); -insert into CONTACT (ID, CODE, VALUE) +insert into CONTACT (ID, CODE, "VALUE") values (1, 'skype', 'userSkype'), (1, 'mobile', '+01234567890'), (1, 'website', 'user.com'), @@ -59,8 +59,9 @@ values (1, 'skype', 'userSkype'), delete from ATTACHMENT; +create sequence ATTACHMENT_ID_SEQ INCREMENT BY 1; alter - sequence ATTACHMENT_ID_SEQ restart with 1; +sequence ATTACHMENT_ID_SEQ restart with 1; insert into ATTACHMENT (name, file_link, object_id, object_type, user_id, date_time) values ('Снимок экрана 1.png', './attachments/project/1_Снимок экрана 1.png', 2, 0, 4, '2023-05-04 22:28:50.215429'), ('Снимок экрана 2.png', './attachments/project/2_Снимок экрана 2.png', 2, 0, 4, '2023-05-04 22:28:53.687600'), @@ -71,26 +72,30 @@ values ('Снимок экрана 1.png', './attachments/project/1_Снимок ('Ежедневный-чеклист.xlsx', './attachments/task/3_Ежедневный-чеклист.xlsx', 38, 2, 4, '2023-05-04 22:28:50.215429'); alter - sequence ATTACHMENT_ID_SEQ restart with 1000; +sequence ATTACHMENT_ID_SEQ restart with 1000; -- populate tasks delete from TASK; +create sequence TASK_ID_SEQ INCREMENT BY 1; alter - sequence TASK_ID_SEQ restart with 1; +sequence TASK_ID_SEQ restart with 1; delete from SPRINT; +create sequence SPRINT_ID_SEQ INCREMENT BY 1; alter - sequence SPRINT_ID_SEQ restart with 1; +sequence SPRINT_ID_SEQ restart with 1; delete from PROJECT; +create sequence PROJECT_ID_SEQ INCREMENT BY 1; alter - sequence PROJECT_ID_SEQ restart with 1; +sequence PROJECT_ID_SEQ restart with 1; delete from ACTIVITY; +create sequence ACTIVITY_ID_SEQ INCREMENT BY 1; alter - sequence ACTIVITY_ID_SEQ restart with 1; +sequence ACTIVITY_ID_SEQ restart with 1; insert into PROJECT (code, title, description, type_code, parent_id) values ('JiraRush', 'JiraRush', '«Mini-JIRA» app : project management system tutorial app', 'task_tracker', null), @@ -98,7 +103,7 @@ values ('JiraRush', 'JiraRush', '«Mini-JIRA» app : project management system t ('Test_Project_2', 'Test Project 2', 'Just test project 2', 'task_tracker', null), ('JiraRush sub', 'JiraRush subproject', 'subproject', 'task_tracker', 1); alter - sequence PROJECT_ID_SEQ restart with 1000; +sequence PROJECT_ID_SEQ restart with 1000; insert into SPRINT (status_code, startpoint, endpoint, code, project_id) values ('active', null, null, 'Sprint-2', 1), @@ -107,213 +112,213 @@ values ('active', null, null, 'Sprint-2', 1), ('active', '2023-04-05 14:25:43', '2023-06-10 13:00:00', 'Sprint-3', 2), ('active', null, null, 'Sprint-1', 4); alter - sequence SPRINT_ID_SEQ restart with 1000; +sequence SPRINT_ID_SEQ restart with 1000; ---- project 1 ------------- INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, STARTPOINT) values ('Data', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Trees', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('UI', 'epic', 'in_progress', 1, 1, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('UI', 'epic', 'in_progress', 1, 1, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Sprint', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Project', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Task', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Attachments', 'story', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Dashboard', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Report of Sprint (UI)', 'story', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Organizational-architectural', 'epic', 'in_progress', 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), ---- project 2 ------------- - ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ---- project 2 ------------- + ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'canceled', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'canceled', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'story', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'story', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'epic', 'in_progress', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'story', 'ready_for_test', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'epic', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'story', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'canceled', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'epic', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'story', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'canceled', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'canceled', 2, 2, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'canceled', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 3, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'story', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'todo', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'story', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'epic', 'in_progress', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'story', 'ready_for_test', 2, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'review', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'epic', 'test', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'story', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'bug', 'done', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), - ('Title', 'task', 'canceled', 2, 4, now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'epic', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'story', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'canceled', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('subproject sprint task', 'epic', 'in_progress', 4, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('subproject backlog task', 'epic', 'in_progress', 4, null, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'); + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20); INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, PARENT_ID, STARTPOINT) values ('Add role manager and filters in security', 'task', 'done', 1, 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Add users from task-timing', 'task', 'ready_for_review', 1, 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Add tasks-2 in DB', 'task', 'in_progress', 1, 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Remove reference with USER_TYPE IN (3,4,5)', 'task', 'in_progress', 1, 1, 1, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API for trees', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Drawing in trees', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Context menu', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Reassignment sprint', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Add task, subtask, sprint, subsprint', 'task', 'in_progress', 1, 1, 2, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Make layout for view TitleTo', 'task', 'in_progress', 1, 1, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Make layout for edit TitleTo', 'task', 'in_progress', 1, 1, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Fix header-fragment', 'task', 'ready_for_review', 1, 1, 3, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 4, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 5, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI view add to Task, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI edit add to Task', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Edit changelog with changes of Task model', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API: changeStatus', 'task', 'in_progress', 1, 1, 6, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Make columns with tasks', 'task', 'in_progress', 1, 1, 8, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI tab of tasks', 'task', 'in_progress', 1, 1, 8, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Context mune', 'task', 'in_progress', 1, 1, 8, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Duration, count of tasks, elapsed time', 'task', 'in_progress', 1, 1, 9, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Meeting, dividing tasks', 'task', 'in_progress', 1, 1, 10, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Refactoring packages', 'task', 'in_progress', 1, 1, 10, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Refactoring tasks', 'task', 'in_progress', 1, 1, 10, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Subproject sprint subtask', 'task', 'in_progress', 4, 5, 87, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Subproject backlog subtask', 'task', 'in_progress', 4, null, 88, - now() + random() * interval '5 minutes' + random() * interval '20 seconds'); + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20); alter - sequence TASK_ID_SEQ restart with 1000; +sequence TASK_ID_SEQ restart with 1000; ---task 1------ INSERT INTO ACTIVITY(AUTHOR_ID, TASK_ID, UPDATED, COMMENT, TITLE, DESCRIPTION, ESTIMATE, TYPE_CODE, STATUS_CODE, From e086c3252bd5848fab57c2025907044aa0bd0fe8 Mon Sep 17 00:00:00 2001 From: Xba1337 <155010942+Xba1337@users.noreply.github.com> Date: Sun, 27 Oct 2024 14:55:22 +0300 Subject: [PATCH 10/17] Update data-test.sql --- src/test/resources/db/data-test.sql | 283 ++++++++++++++-------------- 1 file changed, 141 insertions(+), 142 deletions(-) diff --git a/src/test/resources/db/data-test.sql b/src/test/resources/db/data-test.sql index 0d540121c..7a4dd2ed1 100644 --- a/src/test/resources/db/data-test.sql +++ b/src/test/resources/db/data-test.sql @@ -1,9 +1,8 @@ -- populate users DELETE FROM USERS; -create sequence if not exists USERS_ID_SEQ start with 1; -alter - sequence USERS_ID_SEQ restart with 1; +create sequence USERS_ID_SEQ INCREMENT BY 1; +alter sequence USERS_ID_SEQ restart with 1; insert into USERS (EMAIL, PASSWORD, FIRST_NAME, LAST_NAME, DISPLAY_NAME) values ('user@gmail.com', '{noop}password', 'userFirstName', 'userLastName', 'userDisplayName'), ('admin@gmail.com', '{noop}admin', 'adminFirstName', 'adminLastName', 'adminDisplayName'), @@ -60,9 +59,9 @@ values (1, 'skype', 'userSkype'), delete from ATTACHMENT; -create sequence if not exists ATTACHMENT_ID_SEQ start with 1; +create sequence ATTACHMENT_ID_SEQ INCREMENT BY 1; alter - sequence ATTACHMENT_ID_SEQ restart with 1; +sequence ATTACHMENT_ID_SEQ restart with 1; insert into ATTACHMENT (name, file_link, object_id, object_type, user_id, date_time) values ('Снимок экрана 1.png', './attachments/project/1_Снимок экрана 1.png', 2, 0, 4, '2023-05-04 22:28:50.215429'), ('Снимок экрана 2.png', './attachments/project/2_Снимок экрана 2.png', 2, 0, 4, '2023-05-04 22:28:53.687600'), @@ -73,30 +72,30 @@ values ('Снимок экрана 1.png', './attachments/project/1_Снимок ('Ежедневный-чеклист.xlsx', './attachments/task/3_Ежедневный-чеклист.xlsx', 38, 2, 4, '2023-05-04 22:28:50.215429'); alter - sequence ATTACHMENT_ID_SEQ restart with 1000; +sequence ATTACHMENT_ID_SEQ restart with 1000; -- populate tasks delete from TASK; -create sequence if not exists TASK_ID_SEQ start with 1; +create sequence TASK_ID_SEQ INCREMENT BY 1; alter - sequence TASK_ID_SEQ restart with 1; +sequence TASK_ID_SEQ restart with 1; delete from SPRINT; -create sequence if not exists SPRINT_ID_SEQ start with 1; +create sequence SPRINT_ID_SEQ INCREMENT BY 1; alter - sequence SPRINT_ID_SEQ restart with 1; +sequence SPRINT_ID_SEQ restart with 1; delete from PROJECT; -create sequence if not exists PROJECT_ID_SEQ start with 1; +create sequence PROJECT_ID_SEQ INCREMENT BY 1; alter - sequence PROJECT_ID_SEQ restart with 1; +sequence PROJECT_ID_SEQ restart with 1; delete from ACTIVITY; -create sequence if not exists ACTIVITY_ID_SEQ start with 1; +create sequence ACTIVITY_ID_SEQ INCREMENT BY 1; alter - sequence ACTIVITY_ID_SEQ restart with 1; +sequence ACTIVITY_ID_SEQ restart with 1; insert into PROJECT (code, title, description, type_code, parent_id) values ('JiraRush', 'JiraRush', '«Mini-JIRA» app : project management system tutorial app', 'task_tracker', null), @@ -104,7 +103,7 @@ values ('JiraRush', 'JiraRush', '«Mini-JIRA» app : project management system t ('Test_Project_2', 'Test Project 2', 'Just test project 2', 'task_tracker', null), ('JiraRush sub', 'JiraRush subproject', 'subproject', 'task_tracker', 1); alter - sequence PROJECT_ID_SEQ restart with 1000; +sequence PROJECT_ID_SEQ restart with 1000; insert into SPRINT (status_code, startpoint, endpoint, code, project_id) values ('active', null, null, 'Sprint-2', 1), @@ -113,213 +112,213 @@ values ('active', null, null, 'Sprint-2', 1), ('active', '2023-04-05 14:25:43', '2023-06-10 13:00:00', 'Sprint-3', 2), ('active', null, null, 'Sprint-1', 4); alter - sequence SPRINT_ID_SEQ restart with 1000; +sequence SPRINT_ID_SEQ restart with 1000; ---- project 1 ------------- INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, STARTPOINT) values ('Data', 'epic', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Trees', 'epic', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), - ('UI', 'epic', 'in_progress', 1, 1, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('UI', 'epic', 'in_progress', 1, 1, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Sprint', 'epic', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Project', 'epic', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Task', 'epic', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Attachments', 'story', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Dashboard', 'epic', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Report of Sprint (UI)', 'story', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Organizational-architectural', 'epic', 'in_progress', 1, 1, - now() + random() * 300 + random() * 20), ---- project 2 ------------- - ('Title', 'task', 'todo', 2, 2, now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 2, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ---- project 2 ------------- + ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 2, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 2, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 2, now() + random() * 300 + random() * 20), - ('Title', 'task', 'canceled', 2, 2, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'canceled', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 3, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 3, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'story', 'todo', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'bug', 'todo', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'story', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'epic', 'in_progress', 2, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'story', 'ready_for_test', 2, 4, - now() + random() * 300 + random() * 20), - ('Title', 'task', 'review', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'bug', 'review', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'epic', 'test', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'story', 'done', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'bug', 'done', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'canceled', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 2, now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 2, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'epic', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'story', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'canceled', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 2, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 2, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 2, now() + random() * 300 + random() * 20), - ('Title', 'task', 'canceled', 2, 2, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'canceled', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 3, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 3, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'story', 'todo', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'bug', 'todo', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'story', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'epic', 'in_progress', 2, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Title', 'story', 'ready_for_test', 2, 4, - now() + random() * 300 + random() * 20), - ('Title', 'task', 'review', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'bug', 'review', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'test', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'epic', 'test', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'done', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'story', 'done', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'bug', 'done', 2, 4, now() + random() * 300 + random() * 20), - ('Title', 'task', 'canceled', 2, 4, now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'epic', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'story', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'bug', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), + ('Title', 'task', 'canceled', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('subproject sprint task', 'epic', 'in_progress', 4, 5, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('subproject backlog task', 'epic', 'in_progress', 4, null, - now() + random() * 300 + random() * 20); + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20); INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, PARENT_ID, STARTPOINT) values ('Add role manager and filters in security', 'task', 'done', 1, 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Add users from task-timing', 'task', 'ready_for_review', 1, 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Add tasks-2 in DB', 'task', 'in_progress', 1, 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Remove reference with USER_TYPE IN (3,4,5)', 'task', 'in_progress', 1, 1, 1, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API for trees', 'task', 'in_progress', 1, 1, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Drawing in trees', 'task', 'in_progress', 1, 1, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Context menu', 'task', 'in_progress', 1, 1, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Reassignment sprint', 'task', 'in_progress', 1, 1, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Add task, subtask, sprint, subsprint', 'task', 'in_progress', 1, 1, 2, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Make layout for view TitleTo', 'task', 'in_progress', 1, 1, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Make layout for edit TitleTo', 'task', 'in_progress', 1, 1, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Fix header-fragment', 'task', 'ready_for_review', 1, 1, 3, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 4, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 5, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 5, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 5, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 5, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API', 'task', 'in_progress', 1, 1, 6, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Tests', 'task', 'in_progress', 1, 1, 6, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI edit', 'task', 'in_progress', 1, 1, 6, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI view add to Task, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI edit add to Task', 'task', 'in_progress', 1, 1, 6, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Edit changelog with changes of Task model', 'task', 'in_progress', 1, 1, 6, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('REST API: changeStatus', 'task', 'in_progress', 1, 1, 6, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Make columns with tasks', 'task', 'in_progress', 1, 1, 8, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('UI tab of tasks', 'task', 'in_progress', 1, 1, 8, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Context mune', 'task', 'in_progress', 1, 1, 8, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Duration, count of tasks, elapsed time', 'task', 'in_progress', 1, 1, 9, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Meeting, dividing tasks', 'task', 'in_progress', 1, 1, 10, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Refactoring packages', 'task', 'in_progress', 1, 1, 10, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Refactoring tasks', 'task', 'in_progress', 1, 1, 10, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Subproject sprint subtask', 'task', 'in_progress', 4, 5, 87, - now() + random() * 300 + random() * 20), + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ('Subproject backlog subtask', 'task', 'in_progress', 4, null, 88, - now() + random() * 300 + random() * 20); + now() + random() * 100 + random() * 100 + random() * 100 + random() * 20); alter - sequence TASK_ID_SEQ restart with 1000; +sequence TASK_ID_SEQ restart with 1000; ---task 1------ INSERT INTO ACTIVITY(AUTHOR_ID, TASK_ID, UPDATED, COMMENT, TITLE, DESCRIPTION, ESTIMATE, TYPE_CODE, STATUS_CODE, From 08d0d92694de8deafbae472b0e6cc300a538ad55 Mon Sep 17 00:00:00 2001 From: Kirill Date: Mon, 28 Oct 2024 20:40:55 +0300 Subject: [PATCH 11/17] TASK-11. Create two messages.properties for RU and EN. In index.html was added two language buttons (links) for choosing between one of them. In email-confirmation.html was added links messages.properties. In MvcConfig.java was added additional Beans for interlocalization. In MailService.java was added Locale acceptor and were changed setting parameters classes for additional local parameters. Conclusion: Language on index.html is changing by button, for emails by language settings in browser. --- resources/mails/email-confirmation.html | 11 ++++--- resources/view/index.html | 14 +++++---- .../common/internal/config/MvcConfig.java | 30 +++++++++++++++++++ .../com/javarush/jira/mail/MailService.java | 25 ++++++++++++---- src/main/resources/messages_en.properties | 8 +++++ src/main/resources/messages_ru.properties | 8 +++++ 6 files changed, 78 insertions(+), 18 deletions(-) create mode 100644 src/main/resources/messages_en.properties create mode 100644 src/main/resources/messages_ru.properties diff --git a/resources/mails/email-confirmation.html b/resources/mails/email-confirmation.html index 106e6129a..687157cd9 100644 --- a/resources/mails/email-confirmation.html +++ b/resources/mails/email-confirmation.html @@ -1,13 +1,12 @@ - + - JiraRush - подтверждение почты + -

-

Чтобы завершить настройку учетной записи и начать пользоваться JiraRush, подтвердите, что вы правильно указали вашу - электронную почту.

-Подтвердить почту +

+

+ \ No newline at end of file diff --git a/resources/view/index.html b/resources/view/index.html index e8656ef96..bc32596ff 100644 --- a/resources/view/index.html +++ b/resources/view/index.html @@ -1,13 +1,15 @@ - - - - + + -

JiraRush Home page

+

JiraRush Home page

+
- +
diff --git a/src/main/java/com/javarush/jira/common/internal/config/MvcConfig.java b/src/main/java/com/javarush/jira/common/internal/config/MvcConfig.java index 8a434a807..2803fc2ce 100644 --- a/src/main/java/com/javarush/jira/common/internal/config/MvcConfig.java +++ b/src/main/java/com/javarush/jira/common/internal/config/MvcConfig.java @@ -7,21 +7,26 @@ import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.ui.ModelMap; import org.springframework.web.client.RestTemplate; import org.springframework.web.context.request.WebRequest; import org.springframework.web.context.request.WebRequestInterceptor; import org.springframework.web.filter.ForwardedHeaderFilter; import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.LocaleResolver; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping; import org.springframework.web.servlet.handler.WebRequestHandlerInterceptorAdapter; +import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; +import org.springframework.web.servlet.i18n.SessionLocaleResolver; import org.springframework.web.servlet.mvc.UrlFilenameViewController; import java.time.Duration; +import java.util.Locale; import java.util.Properties; //@EnableWebMvc : http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-spring-mvc-auto-configuration @@ -32,6 +37,29 @@ public class MvcConfig implements WebMvcConfigurer { private final AppProperties appProperties; + + @Bean + public LocaleResolver localeResolver() { + SessionLocaleResolver localeResolver = new SessionLocaleResolver(); + localeResolver.setDefaultLocale(Locale.ENGLISH); + return localeResolver; + } + + @Bean + public ReloadableResourceBundleMessageSource messageSource() { + ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); + messageSource.setBasename("classpath:messages"); + messageSource.setDefaultEncoding("UTF-8"); + return messageSource; + } + + @Bean + public LocaleChangeInterceptor localeChangeInterceptor() { + LocaleChangeInterceptor interceptor = new LocaleChangeInterceptor(); + interceptor.setParamName("lang"); + return interceptor; + } + // Add authUser to view model private final HandlerInterceptor authInterceptor = new WebRequestHandlerInterceptorAdapter(new WebRequestInterceptor() { @Override @@ -56,6 +84,7 @@ public void preHandle(WebRequest request) { @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(authInterceptor).excludePathPatterns("/api/**"); + registry.addInterceptor(localeChangeInterceptor()); } // http://www.codejava.net/frameworks/spring/spring-mvc-url-based-view-resolution-with-urlfilenameviewcontroller-example @@ -79,6 +108,7 @@ ForwardedHeaderFilter forwardedHeaderFilter() { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("index"); + } @Override diff --git a/src/main/java/com/javarush/jira/mail/MailService.java b/src/main/java/com/javarush/jira/mail/MailService.java index 1b1623138..b224ba2b9 100644 --- a/src/main/java/com/javarush/jira/mail/MailService.java +++ b/src/main/java/com/javarush/jira/mail/MailService.java @@ -10,6 +10,7 @@ import com.javarush.jira.mail.internal.MailCaseRepository; import jakarta.mail.internet.InternetAddress; import jakarta.mail.internet.MimeMessage; +import jakarta.servlet.http.HttpServletRequest; import lombok.NonNull; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -19,6 +20,8 @@ import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import org.thymeleaf.context.Context; import org.thymeleaf.spring6.SpringTemplateEngine; @@ -29,7 +32,6 @@ @Service @RequiredArgsConstructor public class MailService { - private static final Locale LOCALE_RU = Locale.forLanguageTag("ru"); private static final String OK = "OK"; private final MailCaseRepository mailCaseRepository; @@ -50,20 +52,31 @@ public static boolean isOk(String result) { return OK.equals(result); } + private Locale determineUserLocale() { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String acceptLanguage = request.getHeader("Accept-Language"); + if (acceptLanguage != null && !acceptLanguage.isEmpty()) { + return Locale.forLanguageTag(acceptLanguage.split(",")[0]); + } + + return Locale.ENGLISH; + } + public String sendToUserWithParams(@NonNull String template, @NonNull User user, @NonNull Map params) { String email = Objects.requireNonNull(user.getEmail()); Map extParams = Util.mergeMap(params, Map.of("user", user)); - return send(appConfig.isProd() ? email : appProperties.getTestMail(), user.getFirstName(), template, extParams); + Locale locale = determineUserLocale(); + return send(appConfig.isProd() ? email : appProperties.getTestMail(), user.getFirstName(), template, extParams, locale); } - public String send(String toEmail, String toName, String template, Map params) { + public String send(String toEmail, String toName, String template, Map params, Locale locale) { log.debug("Send email to {}, {} with template {}", toEmail, toName, template); String result = OK; try { MimeMessage mimeMessage = javaMailSender.createMimeMessage(); MimeMessageHelper message = new MimeMessageHelper(mimeMessage, "UTF-8"); message.setFrom(email, "JiraRush"); - String content = getContent(template, params); + String content = getContent(template, params, locale); message.setText(content, true); message.setSubject(Util.getTitle(content)); // TODO calculate title for group emailing only once message.setTo(new InternetAddress(toEmail, toName, "UTF-8")); @@ -78,8 +91,8 @@ public String send(String toEmail, String toName, String template, Map params) { - Context context = new Context(LOCALE_RU, params); + private String getContent(String template, Map params, Locale locale) { + Context context = new Context(locale, params); return templateEngine.process(template, context); } diff --git a/src/main/resources/messages_en.properties b/src/main/resources/messages_en.properties new file mode 100644 index 000000000..7ba8dd948 --- /dev/null +++ b/src/main/resources/messages_en.properties @@ -0,0 +1,8 @@ +email.confirmation.subject=JiraRush - Email Confirmation +email.confirmation.greeting=Hello, {0}. +email.confirmation.body=To complete setting up your account and start using JiraRush, please confirm your email. +email.confirmation.link=Confirm Email +home.title=JiraRush: mini bugtracking system +home.logout=Logout +home.language.en=English +home.language.ru=Russian \ No newline at end of file diff --git a/src/main/resources/messages_ru.properties b/src/main/resources/messages_ru.properties new file mode 100644 index 000000000..5cb75f163 --- /dev/null +++ b/src/main/resources/messages_ru.properties @@ -0,0 +1,8 @@ +email.confirmation.subject=JiraRush - \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u0447\u0442\u044b +email.confirmation.greeting=\u041f\u0440\u0438\u0432\u0435\u0442, {0}. +email.confirmation.body=\u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f JiraRush, \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0432\u0430\u0448\u0443 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0443\u044e \u043f\u043e\u0447\u0442\u0443. +email.confirmation.link=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u043f\u043e\u0447\u0442\u0443 +home.title=JiraRush: \u043c\u0438\u043d\u0438 \u0431\u0430\u0433\u0442\u0440\u0435\u043a\u0435\u0440 +home.logout=\u0412\u044b\u0439\u0442\u0438 +home.language.en=\u0410\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439 +home.language.ru=\u0420\u0443\u0441\u0441\u043a\u0438\u0439 \ No newline at end of file From f6290cdc29f0a15665cf00ce0539044d206578c2 Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 29 Oct 2024 19:36:22 +0300 Subject: [PATCH 12/17] Change paths in annotation for AbstractControllerTest.java --- src/test/java/com/javarush/jira/AbstractControllerTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/javarush/jira/AbstractControllerTest.java b/src/test/java/com/javarush/jira/AbstractControllerTest.java index 0f2481e00..8fa9264de 100644 --- a/src/test/java/com/javarush/jira/AbstractControllerTest.java +++ b/src/test/java/com/javarush/jira/AbstractControllerTest.java @@ -9,7 +9,7 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; //https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications -@Sql(scripts = {"classpath:db/changelog-test.sql", "classpath:db/data-test.sql"}, config = @SqlConfig(encoding = "UTF-8")) +@Sql(scripts = {"classpath:changelog-test.sql", "classpath:data.sql"}, config = @SqlConfig(encoding = "UTF-8")) @AutoConfigureMockMvc //https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-testing-spring-boot-applications-testing-with-mock-environment public abstract class AbstractControllerTest extends BaseTests { From bf69ae7777f0bcfd7445738e5ce2812f1671af43 Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 29 Oct 2024 19:38:08 +0300 Subject: [PATCH 13/17] Delete excess information --- src/test/resources/application-test.yaml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/test/resources/application-test.yaml b/src/test/resources/application-test.yaml index b0a8f7989..056d63a5d 100644 --- a/src/test/resources/application-test.yaml +++ b/src/test/resources/application-test.yaml @@ -1,13 +1,7 @@ +spring.cache.type: none spring: datasource: - url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - username: sa - password: + url: jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE driver-class-name: org.h2.Driver - liquibase: - change-log: "classpath:db/changelog-test.sql" - - sql: - init: - data-locations: "classpath:db/data-test.sql" \ No newline at end of file + changeLog: "classpath:changelog-test.sql" \ No newline at end of file From 443d8d3f14ee017c1dbdb23fd50b204e9252c8ac Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 29 Oct 2024 19:40:21 +0300 Subject: [PATCH 14/17] Was changed name and removed. --- src/test/resources/db/data-test.sql | 332 ---------------------------- 1 file changed, 332 deletions(-) delete mode 100644 src/test/resources/db/data-test.sql diff --git a/src/test/resources/db/data-test.sql b/src/test/resources/db/data-test.sql deleted file mode 100644 index 7a4dd2ed1..000000000 --- a/src/test/resources/db/data-test.sql +++ /dev/null @@ -1,332 +0,0 @@ --- populate users -DELETE -FROM USERS; -create sequence USERS_ID_SEQ INCREMENT BY 1; -alter sequence USERS_ID_SEQ restart with 1; -insert into USERS (EMAIL, PASSWORD, FIRST_NAME, LAST_NAME, DISPLAY_NAME) -values ('user@gmail.com', '{noop}password', 'userFirstName', 'userLastName', 'userDisplayName'), - ('admin@gmail.com', '{noop}admin', 'adminFirstName', 'adminLastName', 'adminDisplayName'), - ('guest@gmail.com', '{noop}guest', 'guestFirstName', 'guestLastName', 'guestDisplayName'), - ('manager@gmail.com', '{noop}manager', 'managerFirstName', 'managerLastName', 'managerDisplayName'), - ('taras@gmail.com', '{noop}password', 'Тарас', 'Шевченко', '@taras'), - ('petlura@gmail.com', '{noop}password', 'Симон', 'Петлюра', '@epetl'), - ('moroz_a@gmail.com', '{noop}password', 'Александр', 'Мороз', '@Moroz93'), - ('antonio.nest@gmail.com', '{noop}password', 'Антон', 'Нестеров', '@antonio_nest'), - ('i.franko@gmail.com', '{noop}password', 'Иван', 'Франко', '@ifranko'), - ('g.skovoroda@gmail.com', '{noop}password', 'Григорий', 'Сковорода', '@Gregory24'), - ('arsh.and@gmail.com', '{noop}password', 'Андрей', 'Арш', '@arsh01'), - ('squirrel2011@gmail.com', '{noop}password', 'Леся', 'Иванюк', '@SmallSquirrel'), - ('nikk24@gmail.com', '{noop}password', 'Николай', 'Никулин', '@nikk'), - ('artem711@gmail.com', '{noop}password', 'Артем', 'Запорожец', '@Artt'), - ('max.pain@gmail.com', '{noop}password', 'Максим', 'Дудник', '@MaxPain'), - ('admin@aws.co', '{noop}password', 'test', 'admin', '@testAdmin'); - --- 0 DEV --- 1 ADMIN --- 2 MANAGER -DELETE -FROM USER_ROLE; -insert into USER_ROLE (USER_ID, ROLE) -values (1, 0), - (2, 0), - (2, 1), - (4, 2), - (5, 0), - (6, 0), - (7, 0), - (8, 0), - (9, 0), - (10, 0), - (11, 0), - (12, 0), - (13, 0), - (14, 0), - (15, 1), - (16, 1); - - -insert into PROFILE (ID, LAST_FAILED_LOGIN, LAST_LOGIN, MAIL_NOTIFICATIONS) -values (1, null, null, 49), - (2, null, null, 14); - -insert into CONTACT (ID, CODE, "VALUE") -values (1, 'skype', 'userSkype'), - (1, 'mobile', '+01234567890'), - (1, 'website', 'user.com'), - (2, 'github', 'adminGitHub'), - (2, 'tg', 'adminTg'), - (2, 'vk', 'adminVk'); - -delete -from ATTACHMENT; -create sequence ATTACHMENT_ID_SEQ INCREMENT BY 1; -alter -sequence ATTACHMENT_ID_SEQ restart with 1; -insert into ATTACHMENT (name, file_link, object_id, object_type, user_id, date_time) -values ('Снимок экрана 1.png', './attachments/project/1_Снимок экрана 1.png', 2, 0, 4, '2023-05-04 22:28:50.215429'), - ('Снимок экрана 2.png', './attachments/project/2_Снимок экрана 2.png', 2, 0, 4, '2023-05-04 22:28:53.687600'), - ('Ежедневный-чеклист.xlsx', './attachments/project/3_Ежедневный-чеклист.xlsx', 2, 0, 4, - '2023-05-04 22:31:15.166547'), - ('Снимок экрана 1.png', './attachments/task/1_Снимок экрана 1.png', 41, 2, 4, '2023-05-04 22:28:53.687600'), - ('Снимок экрана 2.png', './attachments/task/2_Снимок экрана 2.png', 41, 2, 4, '2023-05-04 22:28:50.215429'), - ('Ежедневный-чеклист.xlsx', './attachments/task/3_Ежедневный-чеклист.xlsx', 38, 2, 4, - '2023-05-04 22:28:50.215429'); -alter -sequence ATTACHMENT_ID_SEQ restart with 1000; - - --- populate tasks -delete -from TASK; -create sequence TASK_ID_SEQ INCREMENT BY 1; -alter -sequence TASK_ID_SEQ restart with 1; -delete -from SPRINT; -create sequence SPRINT_ID_SEQ INCREMENT BY 1; -alter -sequence SPRINT_ID_SEQ restart with 1; -delete -from PROJECT; -create sequence PROJECT_ID_SEQ INCREMENT BY 1; -alter -sequence PROJECT_ID_SEQ restart with 1; -delete -from ACTIVITY; -create sequence ACTIVITY_ID_SEQ INCREMENT BY 1; -alter -sequence ACTIVITY_ID_SEQ restart with 1; - -insert into PROJECT (code, title, description, type_code, parent_id) -values ('JiraRush', 'JiraRush', '«Mini-JIRA» app : project management system tutorial app', 'task_tracker', null), - ('Test_Project', 'Test Project', 'Just test project', 'task_tracker', null), - ('Test_Project_2', 'Test Project 2', 'Just test project 2', 'task_tracker', null), - ('JiraRush sub', 'JiraRush subproject', 'subproject', 'task_tracker', 1); -alter -sequence PROJECT_ID_SEQ restart with 1000; - -insert into SPRINT (status_code, startpoint, endpoint, code, project_id) -values ('active', null, null, 'Sprint-2', 1), - ('finished', '2023-04-09 08:05:10', '2023-04-29 16:48:34', 'Sprint-1', 2), - ('finished', '2023-04-03 12:14:11', '2023-04-18 17:03:41', 'Sprint-2', 2), - ('active', '2023-04-05 14:25:43', '2023-06-10 13:00:00', 'Sprint-3', 2), - ('active', null, null, 'Sprint-1', 4); -alter -sequence SPRINT_ID_SEQ restart with 1000; - ----- project 1 ------------- -INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, STARTPOINT) -values ('Data', 'epic', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Trees', 'epic', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI', 'epic', 'in_progress', 1, 1, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Sprint', 'epic', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Project', 'epic', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Task', 'epic', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Attachments', 'story', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Dashboard', 'epic', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Report of Sprint (UI)', 'story', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Organizational-architectural', 'epic', 'in_progress', 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), ---- project 2 ------------- - ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'canceled', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_test', 2, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'story', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'bug', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'epic', 'in_progress', 2, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'story', 'ready_for_test', 2, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'bug', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'epic', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'story', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'bug', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'canceled', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'canceled', 2, 2, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_test', 2, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'in_progress', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 3, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_test', 2, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'story', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'bug', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'todo', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'epic', 'in_progress', 2, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'ready_for_review', 2, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'story', 'ready_for_test', 2, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'bug', 'review', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'epic', 'test', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'story', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'bug', 'done', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Title', 'task', 'canceled', 2, 4, now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('subproject sprint task', 'epic', 'in_progress', 4, 5, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('subproject backlog task', 'epic', 'in_progress', 4, null, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20); - -INSERT INTO TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, PARENT_ID, STARTPOINT) -values ('Add role manager and filters in security', 'task', 'done', 1, 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Add users from task-timing', 'task', 'ready_for_review', 1, 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Add tasks-2 in DB', 'task', 'in_progress', 1, 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Remove reference with USER_TYPE IN (3,4,5)', 'task', 'in_progress', 1, 1, 1, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('REST API for trees', 'task', 'in_progress', 1, 1, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Drawing in trees', 'task', 'in_progress', 1, 1, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Context menu', 'task', 'in_progress', 1, 1, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Reassignment sprint', 'task', 'in_progress', 1, 1, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Add task, subtask, sprint, subsprint', 'task', 'in_progress', 1, 1, 2, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Make layout for view TitleTo', 'task', 'in_progress', 1, 1, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Make layout for edit TitleTo', 'task', 'in_progress', 1, 1, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Fix header-fragment', 'task', 'ready_for_review', 1, 1, 3, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('REST API', 'task', 'in_progress', 1, 1, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Tests', 'task', 'in_progress', 1, 1, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI edit', 'task', 'in_progress', 1, 1, 4, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('REST API', 'task', 'in_progress', 1, 1, 5, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Tests', 'task', 'in_progress', 1, 1, 5, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 5, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI edit', 'task', 'in_progress', 1, 1, 5, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('REST API', 'task', 'in_progress', 1, 1, 6, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Tests', 'task', 'in_progress', 1, 1, 6, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI view, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI edit', 'task', 'in_progress', 1, 1, 6, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI view add to Task, mock button to dashboard', 'task', 'in_progress', 1, 1, 6, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI edit add to Task', 'task', 'in_progress', 1, 1, 6, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Edit changelog with changes of Task model', 'task', 'in_progress', 1, 1, 6, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('REST API: changeStatus', 'task', 'in_progress', 1, 1, 6, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Make columns with tasks', 'task', 'in_progress', 1, 1, 8, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('UI tab of tasks', 'task', 'in_progress', 1, 1, 8, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Context mune', 'task', 'in_progress', 1, 1, 8, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Duration, count of tasks, elapsed time', 'task', 'in_progress', 1, 1, 9, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Meeting, dividing tasks', 'task', 'in_progress', 1, 1, 10, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Refactoring packages', 'task', 'in_progress', 1, 1, 10, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Refactoring tasks', 'task', 'in_progress', 1, 1, 10, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Subproject sprint subtask', 'task', 'in_progress', 4, 5, 87, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20), - ('Subproject backlog subtask', 'task', 'in_progress', 4, null, 88, - now() + random() * 100 + random() * 100 + random() * 100 + random() * 20); -alter -sequence TASK_ID_SEQ restart with 1000; - ----task 1------ -INSERT INTO ACTIVITY(AUTHOR_ID, TASK_ID, UPDATED, COMMENT, TITLE, DESCRIPTION, ESTIMATE, TYPE_CODE, STATUS_CODE, - PRIORITY_CODE) -values (6, 1, '2023-05-15 09:05:10', null, 'Data', null, 3, 'epic', 'in_progress', 'low'), - (5, 1, '2023-05-15 12:25:10', null, 'Data', null, null, null, null, 'normal'), - (6, 1, '2023-05-15 14:05:10', null, 'Data', null, 4, null, null, null), ---task 118---- - (11, 118, '2023-05-16 10:05:10', null, 'UI tab of tasks', null, 4, 'task', 'in_progress', 'normal'), - (5, 118, '2023-05-16 11:10:10', null, 'UI tab of tasks', null, null, null, null, 'high'), - (11, 118, '2023-05-16 12:30:10', null, 'UI tab of tasks', null, 2, null, null, null); - From b326a6d6af3d9744c56db3ab5b64bd1621db9078 Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 29 Oct 2024 19:41:04 +0300 Subject: [PATCH 15/17] Was removed excess annotation for active profile choosing. --- src/test/java/com/javarush/jira/JiraRushApplicationTests.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/java/com/javarush/jira/JiraRushApplicationTests.java b/src/test/java/com/javarush/jira/JiraRushApplicationTests.java index f821163f8..287178598 100644 --- a/src/test/java/com/javarush/jira/JiraRushApplicationTests.java +++ b/src/test/java/com/javarush/jira/JiraRushApplicationTests.java @@ -1,9 +1,7 @@ package com.javarush.jira; import org.junit.jupiter.api.Test; -import org.springframework.test.context.ActiveProfiles; -@ActiveProfiles("test") class JiraRushApplicationTests extends BaseTests { @Test void contextLoads() { From 56999f46dd14c222eb6328b26ee16bda0d248c2b Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 29 Oct 2024 19:41:53 +0300 Subject: [PATCH 16/17] Data.sql script was simplified for H2 db --- src/test/resources/data.sql | 98 +++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/test/resources/data.sql diff --git a/src/test/resources/data.sql b/src/test/resources/data.sql new file mode 100644 index 000000000..5a1c52922 --- /dev/null +++ b/src/test/resources/data.sql @@ -0,0 +1,98 @@ +--------- users ---------------------- +delete +from USER_ROLE; +delete +from CONTACT; +delete +from PROFILE; + +delete +from ACTIVITY; +alter table ACTIVITY + alter column ID restart with 1; +delete +from TASK; +alter table TASK + alter column ID restart with 1; +delete +from SPRINT; +alter table SPRINT + alter column ID restart with 1; +delete +from PROJECT; +alter table PROJECT + alter column ID restart with 1; + +delete +from USERS; +alter table USERS + alter column ID restart with 1; + +insert into USERS (EMAIL, PASSWORD, FIRST_NAME, LAST_NAME, DISPLAY_NAME) +values ('user@gmail.com', '{noop}password', 'userFirstName', 'userLastName', 'userDisplayName'), + ('admin@gmail.com', '{noop}admin', 'adminFirstName', 'adminLastName', 'adminDisplayName'), + ('guest@gmail.com', '{noop}guest', 'guestFirstName', 'guestLastName', 'guestDisplayName'), + ('manager@gmail.com', '{noop}manager', 'managerFirstName', 'managerLastName', 'managerDisplayName'); + +-- 0 DEV +-- 1 ADMIN +-- 2 MANAGER + +insert into USER_ROLE (USER_ID, ROLE) +values (1, 0), + (2, 0), + (2, 1), + (4, 2); + +insert into PROFILE (ID, LAST_FAILED_LOGIN, LAST_LOGIN, MAIL_NOTIFICATIONS) +values (1, null, null, 49), + (2, null, null, 14); + +insert into CONTACT (ID, CODE, "VALUE") +values (1, 'skype', 'userSkype'), + (1, 'mobile', '+01234567890'), + (1, 'website', 'user.com'), + (2, 'github', 'adminGitHub'), + (2, 'tg', 'adminTg'), + (2, 'vk', 'adminVk'); + + +insert into PROJECT (code, title, description, type_code, parent_id) +values ('PR1', 'PROJECT-1', 'test project 1', 'task_tracker', null), + ('PR2', 'PROJECT-2', 'test project 2', 'task_tracker', 1); + +insert into SPRINT (status_code, startpoint, endpoint, code, project_id) +values ('finished', '2023-05-01 08:05:10', '2023-05-07 17:10:01', 'SP-1.001', 1), + ('active', '2023-05-01 08:06:00', null, 'SP-1.002', 1), + ('active', '2023-05-01 08:07:00', null, 'SP-1.003', 1), + ('planning', '2023-05-01 08:08:00', null, 'SP-1.004', 1), + ('active', '2023-05-10 08:06:00', null, 'SP-2.001', 2), + ('planning', '2023-05-10 08:07:00', null, 'SP-2.002', 2), + ('planning', '2023-05-10 08:08:00', null, 'SP-2.003', 2); + +insert into TASK (TITLE, TYPE_CODE, STATUS_CODE, PROJECT_ID, SPRINT_ID, STARTPOINT) +values ('Data', 'epic', 'in_progress', 1, 1, '2023-05-15 09:05:10'), + ('Trees', 'epic', 'in_progress', 1, 1, '2023-05-15 12:05:10'), + ('task-3', 'task', 'ready_for_test', 2, 5, '2023-06-14 09:28:10'), + ('task-4', 'task', 'ready_for_review', 2, 5, '2023-06-14 09:28:10'), + ('task-5', 'task', 'todo', 2, 5, '2023-06-14 09:28:10'), + ('task-6', 'task', 'done', 2, 5, '2023-06-14 09:28:10'), + ('task-7', 'task', 'canceled', 2, 5, '2023-06-14 09:28:10'); + + +insert into ACTIVITY(AUTHOR_ID, TASK_ID, UPDATED, COMMENT, TITLE, DESCRIPTION, ESTIMATE, TYPE_CODE, STATUS_CODE, + PRIORITY_CODE) +values (1, 1, '2023-05-15 09:05:10', null, 'Data', null, 3, 'epic', 'in_progress', 'low'), + (2, 1, '2023-05-15 12:25:10', null, 'Data', null, null, null, null, 'normal'), + (1, 1, '2023-05-15 14:05:10', null, 'Data', null, 4, null, null, null), + (1, 2, '2023-05-15 12:05:10', null, 'Trees', 'Trees desc', 4, 'epic', 'in_progress', 'normal'); + +insert into USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE, STARTPOINT, ENDPOINT) +values (1, 2, 2, 'task_developer', '2023-06-14 08:35:10', '2023-06-14 08:55:00'), + (1, 2, 2, 'task_reviewer', '2023-06-14 09:35:10', null), + (1, 2, 1, 'task_developer', '2023-06-12 11:40:00', '2023-06-12 12:35:00'), + (1, 2, 1, 'task_developer', '2023-06-13 12:35:00', null), + (1, 2, 1, 'task_tester', '2023-06-14 15:20:00', null), + (2, 2, 2, 'task_developer', '2023-06-08 07:10:00', null), + (2, 2, 1, 'task_developer', '2023-06-09 14:48:00', null), + (2, 2, 1, 'task_tester', '2023-06-10 16:37:00', null); \ No newline at end of file From 474fd78653506d9dfa5847aa5fe9b27550eeab04 Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 29 Oct 2024 19:56:05 +0300 Subject: [PATCH 17/17] Changelog.sql was copied to test folder, renamed to changelog-test.sql and simplified for H2 db --- src/test/resources/{db => }/changelog-test.sql | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) rename src/test/resources/{db => }/changelog-test.sql (97%) diff --git a/src/test/resources/db/changelog-test.sql b/src/test/resources/changelog-test.sql similarity index 97% rename from src/test/resources/db/changelog-test.sql rename to src/test/resources/changelog-test.sql index 839e860e4..d921d08d5 100644 --- a/src/test/resources/db/changelog-test.sql +++ b/src/test/resources/changelog-test.sql @@ -313,8 +313,4 @@ values ('todo', 'ToDo', 3, 'in_progress,canceled|'), ('done', 'Done', 3, 'canceled|'), ('canceled', 'Canceled', 3, null); ---changeset ishlyakhtenkov:change_UK_USER_BELONG - -drop index UK_USER_BELONG; --- create unique index UK_USER_BELONG on USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE) where ENDPOINT is null; -create unique index UK_USER_BELONG on USER_BELONG (OBJECT_ID, OBJECT_TYPE, USER_ID, USER_TYPE_CODE); +drop index UK_USER_BELONG; \ No newline at end of file