Skip to content

Commit a32482a

Browse files
Merge pull request #4 from nordeck/nic/feat/ZO-195_maven
fix(ci): fix maven build errors
2 parents ba9ee45 + 094480b commit a32482a

File tree

5 files changed

+160
-55
lines changed

5 files changed

+160
-55
lines changed

src/main/resources/liquibase/changelog-init.xml

+37-33
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
22
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
3-
<changeSet author="wagner.wutzke" id="1740060932516-1">
3+
<property name="NOW" value="now() " dbms="mysql,h2"/>
4+
<property name="NOW" value="CURRENT_TIMESTAMP" dbms="postgresql"/>
5+
<property name="NOW" value="sysdate" dbms="oracle"/>
6+
7+
<changeSet author="wagner.wutzke" id="1740266386086-1">
48
<createTable tableName="meeting">
59
<column name="id" type="UUID">
610
<constraints nullable="false" primaryKey="true" primaryKeyName="meeting_pkey"/>
@@ -12,10 +16,10 @@
1216
<column name="start_time" type="TIMESTAMP WITH TIME ZONE"/>
1317
<column name="end_time" type="TIMESTAMP WITH TIME ZONE"/>
1418
<column name="owner_id" type="VARCHAR(127)"/>
15-
<column defaultValueComputed="now()" name="created_at" type="TIMESTAMP WITH TIME ZONE">
19+
<column defaultValueComputed="${NOW}" name="created_at" type="TIMESTAMP WITH TIME ZONE">
1620
<constraints nullable="false"/>
1721
</column>
18-
<column defaultValueComputed="now()" name="updated_at" type="TIMESTAMP WITH TIME ZONE">
22+
<column defaultValueComputed="${NOW}" name="updated_at" type="TIMESTAMP WITH TIME ZONE">
1923
<constraints nullable="false"/>
2024
</column>
2125
<column defaultValueBoolean="false" name="password_restricted" type="BOOLEAN"/>
@@ -46,15 +50,15 @@
4650
<column name="series_end_time" type="TIMESTAMP WITH TIME ZONE"/>
4751
</createTable>
4852
</changeSet>
49-
<changeSet author="wagner.wutzke" id="1740060932516-2">
53+
<changeSet author="wagner.wutzke" id="1740266386086-2">
5054
<createTable tableName="notification">
5155
<column name="id" type="UUID">
5256
<constraints nullable="false" primaryKey="true" primaryKeyName="notification_pkey"/>
5357
</column>
5458
<column name="message" type="VARCHAR(1024)"/>
5559
<column name="user_id" type="VARCHAR(255)"/>
5660
<column name="meeting_id" type="UUID"/>
57-
<column defaultValueComputed="now()" name="created_at" type="TIMESTAMP WITH TIME ZONE">
61+
<column defaultValueComputed="${NOW}" name="created_at" type="TIMESTAMP WITH TIME ZONE">
5862
<constraints nullable="false"/>
5963
</column>
6064
<column name="viewed_at" type="TIMESTAMP WITH TIME ZONE"/>
@@ -65,7 +69,7 @@
6569
<column name="room_deletion_due_date" type="TIMESTAMP WITH TIME ZONE"/>
6670
</createTable>
6771
</changeSet>
68-
<changeSet author="wagner.wutzke" id="1740060932516-3">
72+
<changeSet author="wagner.wutzke" id="1740266386086-3">
6973
<createTable tableName="meeting_participant">
7074
<column name="id" type="UUID">
7175
<constraints nullable="false" primaryKey="true" primaryKeyName="meeting_participant_pkey"/>
@@ -76,15 +80,15 @@
7680
</column>
7781
<column name="role" type="VARCHAR(127)"/>
7882
<column name="email" type="VARCHAR(255)"/>
79-
<column defaultValueComputed="now()" name="created_at" type="TIMESTAMP WITH TIME ZONE">
83+
<column defaultValueComputed="${NOW}" name="created_at" type="TIMESTAMP WITH TIME ZONE">
8084
<constraints nullable="false"/>
8185
</column>
82-
<column defaultValueComputed="now()" name="updated_at" type="TIMESTAMP WITH TIME ZONE">
86+
<column defaultValueComputed="${NOW}" name="updated_at" type="TIMESTAMP WITH TIME ZONE">
8387
<constraints nullable="false"/>
8488
</column>
8589
</createTable>
8690
</changeSet>
87-
<changeSet author="wagner.wutzke" id="1740060932516-4">
91+
<changeSet author="wagner.wutzke" id="1740266386086-4">
8892
<createTable tableName="batch_job_instance">
8993
<column name="job_instance_id" type="BIGINT">
9094
<constraints nullable="false" primaryKey="true" primaryKeyName="batch_job_instance_pkey"/>
@@ -98,44 +102,44 @@
98102
</column>
99103
</createTable>
100104
</changeSet>
101-
<changeSet author="wagner.wutzke" id="1740060932516-5">
105+
<changeSet author="wagner.wutzke" id="1740266386086-5">
102106
<createIndex indexName="meeting_end_time_idx" tableName="meeting">
103107
<column name="end_time"/>
104108
</createIndex>
105109
</changeSet>
106-
<changeSet author="wagner.wutzke" id="1740060932516-6">
110+
<changeSet author="wagner.wutzke" id="1740266386086-6">
107111
<createIndex indexName="meeting_created_at_idx" tableName="meeting">
108-
<column defaultValueComputed="now()" name="created_at"/>
112+
<column defaultValueComputed="${NOW}" name="created_at"/>
109113
</createIndex>
110114
</changeSet>
111-
<changeSet author="wagner.wutzke" id="1740060932516-7">
115+
<changeSet author="wagner.wutzke" id="1740266386086-7">
112116
<createIndex indexName="notification_user_id_idx" tableName="notification">
113117
<column name="user_id"/>
114118
</createIndex>
115119
</changeSet>
116-
<changeSet author="wagner.wutzke" id="1740060932516-8">
120+
<changeSet author="wagner.wutzke" id="1740266386086-8">
117121
<createIndex indexName="meeting_participant_meeting_id_idx" tableName="meeting_participant">
118122
<column name="meeting_id"/>
119123
</createIndex>
120124
</changeSet>
121-
<changeSet author="wagner.wutzke" id="1740060932516-9">
125+
<changeSet author="wagner.wutzke" id="1740266386086-9" dbms="postgresql">
122126
<createIndex indexName="meeting_participant_email_upper_idx" tableName="meeting_participant">
123127
<column computed="true" name="upper((email)::text)"/>
124128
</createIndex>
125129
</changeSet>
126-
<changeSet author="wagner.wutzke" id="1740060932516-10">
130+
<changeSet author="wagner.wutzke" id="1740266386086-10">
127131
<addUniqueConstraint columnNames="job_name, job_key" constraintName="job_inst_un" tableName="batch_job_instance"/>
128132
</changeSet>
129-
<changeSet author="wagner.wutzke" id="1740060932516-11">
133+
<changeSet author="wagner.wutzke" id="1740266386086-11">
130134
<createSequence cacheSize="1" cycle="false" dataType="bigint" incrementBy="1" maxValue="9223372036854775807" minValue="1" sequenceName="batch_job_execution_seq" startValue="1"/>
131135
</changeSet>
132-
<changeSet author="wagner.wutzke" id="1740060932516-12">
136+
<changeSet author="wagner.wutzke" id="1740266386086-12">
133137
<createSequence cacheSize="1" cycle="false" dataType="bigint" incrementBy="1" maxValue="9223372036854775807" minValue="1" sequenceName="batch_job_seq" startValue="1"/>
134138
</changeSet>
135-
<changeSet author="wagner.wutzke" id="1740060932516-13">
139+
<changeSet author="wagner.wutzke" id="1740266386086-13">
136140
<createSequence cacheSize="1" cycle="false" dataType="bigint" incrementBy="1" maxValue="9223372036854775807" minValue="1" sequenceName="batch_step_execution_seq" startValue="1"/>
137141
</changeSet>
138-
<changeSet author="wagner.wutzke" id="1740060932516-14">
142+
<changeSet author="wagner.wutzke" id="1740266386086-14">
139143
<createTable tableName="batch_job_execution">
140144
<column name="job_execution_id" type="BIGINT">
141145
<constraints nullable="false" primaryKey="true" primaryKeyName="batch_job_execution_pkey"/>
@@ -155,7 +159,7 @@
155159
<column name="last_updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
156160
</createTable>
157161
</changeSet>
158-
<changeSet author="wagner.wutzke" id="1740060932516-15">
162+
<changeSet author="wagner.wutzke" id="1740266386086-15">
159163
<createTable tableName="batch_job_execution_context">
160164
<column name="job_execution_id" type="BIGINT">
161165
<constraints nullable="false" primaryKey="true" primaryKeyName="batch_job_execution_context_pkey"/>
@@ -166,7 +170,7 @@
166170
<column name="serialized_context" type="TEXT"/>
167171
</createTable>
168172
</changeSet>
169-
<changeSet author="wagner.wutzke" id="1740060932516-16">
173+
<changeSet author="wagner.wutzke" id="1740266386086-16">
170174
<createTable tableName="batch_job_execution_params">
171175
<column name="job_execution_id" type="BIGINT">
172176
<constraints nullable="false"/>
@@ -183,7 +187,7 @@
183187
</column>
184188
</createTable>
185189
</changeSet>
186-
<changeSet author="wagner.wutzke" id="1740060932516-17">
190+
<changeSet author="wagner.wutzke" id="1740266386086-17">
187191
<createTable tableName="batch_step_execution">
188192
<column name="step_execution_id" type="BIGINT">
189193
<constraints nullable="false" primaryKey="true" primaryKeyName="batch_step_execution_pkey"/>
@@ -216,7 +220,7 @@
216220
<column name="last_updated" type="TIMESTAMP WITHOUT TIME ZONE"/>
217221
</createTable>
218222
</changeSet>
219-
<changeSet author="wagner.wutzke" id="1740060932516-18">
223+
<changeSet author="wagner.wutzke" id="1740266386086-18">
220224
<createTable tableName="batch_step_execution_context">
221225
<column name="step_execution_id" type="BIGINT">
222226
<constraints nullable="false" primaryKey="true" primaryKeyName="batch_step_execution_context_pkey"/>
@@ -227,7 +231,7 @@
227231
<column name="serialized_context" type="TEXT"/>
228232
</createTable>
229233
</changeSet>
230-
<changeSet author="wagner.wutzke" id="1740060932516-19">
234+
<changeSet author="wagner.wutzke" id="1740266386086-19">
231235
<createTable tableName="shedlock">
232236
<column name="name" type="VARCHAR(64)">
233237
<constraints nullable="false" primaryKey="true" primaryKeyName="shedlock_pkey"/>
@@ -243,28 +247,28 @@
243247
</column>
244248
</createTable>
245249
</changeSet>
246-
<changeSet author="wagner.wutzke" id="1740060932516-20">
250+
<changeSet author="wagner.wutzke" id="1740266386086-20">
247251
<addForeignKeyConstraint baseColumnNames="parent_id" baseTableName="meeting" constraintName="fk_child_meeting_on_parent_meeting" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="meeting" validate="true"/>
248252
</changeSet>
249-
<changeSet author="wagner.wutzke" id="1740060932516-21">
253+
<changeSet author="wagner.wutzke" id="1740266386086-21">
250254
<addForeignKeyConstraint baseColumnNames="meeting_id" baseTableName="meeting_participant" constraintName="fk_meeting_participant_on_meeting" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="meeting" validate="true"/>
251255
</changeSet>
252-
<changeSet author="wagner.wutzke" id="1740060932516-22">
256+
<changeSet author="wagner.wutzke" id="1740266386086-22">
253257
<addForeignKeyConstraint baseColumnNames="meeting_id" baseTableName="notification" constraintName="fk_notification_on_meeting" deferrable="false" initiallyDeferred="false" onDelete="CASCADE" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="meeting" validate="true"/>
254258
</changeSet>
255-
<changeSet author="wagner.wutzke" id="1740060932516-23">
259+
<changeSet author="wagner.wutzke" id="1740266386086-23">
256260
<addForeignKeyConstraint baseColumnNames="job_execution_id" baseTableName="batch_job_execution_context" constraintName="job_exec_ctx_fk" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="job_execution_id" referencedTableName="batch_job_execution" validate="true"/>
257261
</changeSet>
258-
<changeSet author="wagner.wutzke" id="1740060932516-24">
262+
<changeSet author="wagner.wutzke" id="1740266386086-24">
259263
<addForeignKeyConstraint baseColumnNames="job_execution_id" baseTableName="batch_job_execution_params" constraintName="job_exec_params_fk" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="job_execution_id" referencedTableName="batch_job_execution" validate="true"/>
260264
</changeSet>
261-
<changeSet author="wagner.wutzke" id="1740060932516-25">
265+
<changeSet author="wagner.wutzke" id="1740266386086-25">
262266
<addForeignKeyConstraint baseColumnNames="job_execution_id" baseTableName="batch_step_execution" constraintName="job_exec_step_fk" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="job_execution_id" referencedTableName="batch_job_execution" validate="true"/>
263267
</changeSet>
264-
<changeSet author="wagner.wutzke" id="1740060932516-26">
268+
<changeSet author="wagner.wutzke" id="1740266386086-26">
265269
<addForeignKeyConstraint baseColumnNames="job_instance_id" baseTableName="batch_job_execution" constraintName="job_inst_exec_fk" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="job_instance_id" referencedTableName="batch_job_instance" validate="true"/>
266270
</changeSet>
267-
<changeSet author="wagner.wutzke" id="1740060932516-27">
271+
<changeSet author="wagner.wutzke" id="1740266386086-27">
268272
<addForeignKeyConstraint baseColumnNames="step_execution_id" baseTableName="batch_step_execution_context" constraintName="step_exec_ctx_fk" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="step_execution_id" referencedTableName="batch_step_execution" validate="true"/>
269273
</changeSet>
270274
</databaseChangeLog>

src/test/java/net/nordeck/ovc/backend/jobs/DeleteOldMeetingsJobTest.java

+28-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import net.nordeck.ovc.backend.TestUtils;
44
import net.nordeck.ovc.backend.entity.MeetingEntity;
5+
import net.nordeck.ovc.backend.entity.MeetingParticipantEntity;
6+
import net.nordeck.ovc.backend.repository.MeetingParticipantRepository;
57
import net.nordeck.ovc.backend.repository.MeetingRepository;
68
import org.junit.jupiter.api.AfterEach;
79
import org.junit.jupiter.api.BeforeEach;
@@ -26,6 +28,7 @@
2628
import org.springframework.transaction.PlatformTransactionManager;
2729

2830
import java.time.ZonedDateTime;
31+
import java.util.Arrays;
2932
import java.util.Collection;
3033
import java.util.List;
3134
import java.util.UUID;
@@ -48,6 +51,9 @@ public class DeleteOldMeetingsJobTest {
4851
@Autowired
4952
private MeetingRepository meetingRepository;
5053

54+
@Autowired
55+
private MeetingParticipantRepository meetingParticipantRepository;
56+
5157
@Mock
5258
private JobRepository jobRepository;
5359

@@ -79,7 +85,27 @@ void initData() {
7985
m2.setEndTime(ZonedDateTime.now().minusDays(65));
8086
m3.setEndTime(ZonedDateTime.now().minusDays(30));
8187

82-
meetingRepository.saveAll(List.of(m1, m2, m3));
88+
List<List<MeetingParticipantEntity>> participants = List.of(
89+
m1.getParticipants(),
90+
m2.getParticipants(),
91+
m3.getParticipants()
92+
);
93+
94+
m1.setParticipants(null);
95+
m2.setParticipants(null);
96+
m3.setParticipants(null);
97+
98+
List<MeetingEntity> meetingEntities = meetingRepository
99+
.saveAll(List.of(m1, m2, m3));
100+
101+
// set meeting id for every participant
102+
for (int i=0; i<meetingEntities.size(); i++) {
103+
int finalI = i;
104+
participants.get(i).forEach(o -> o.setMeetingId(meetingEntities.get(finalI).getId()));
105+
meetingEntities.get(i).setParticipants(participants.get(i));
106+
}
107+
108+
meetingRepository.saveAll(meetingEntities);
83109

84110
mockedJob.meetingRepository = meetingRepository;
85111
mockedJob.chunkSize = chunkSize;
@@ -90,6 +116,7 @@ void initData() {
90116
public void cleanUp() {
91117
jobRepositoryTestUtils.removeJobExecutions();
92118
meetingRepository.deleteAll();
119+
meetingParticipantRepository.deleteAll();
93120
}
94121

95122
private JobParameters defaultJobParameters() {

src/test/java/net/nordeck/ovc/backend/jobs/StaticRoomsDeleteUnusedJobTest.java

+37-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import net.nordeck.ovc.backend.TestUtils;
44
import net.nordeck.ovc.backend.entity.MeetingEntity;
5+
import net.nordeck.ovc.backend.entity.MeetingParticipantEntity;
6+
import net.nordeck.ovc.backend.repository.MeetingParticipantRepository;
57
import net.nordeck.ovc.backend.repository.MeetingRepository;
68
import org.junit.jupiter.api.AfterEach;
79
import org.junit.jupiter.api.BeforeEach;
@@ -25,6 +27,7 @@
2527
import org.springframework.transaction.PlatformTransactionManager;
2628

2729
import java.time.ZonedDateTime;
30+
import java.util.Arrays;
2831
import java.util.Collection;
2932
import java.util.List;
3033
import java.util.UUID;
@@ -47,6 +50,9 @@ public class StaticRoomsDeleteUnusedJobTest {
4750
@Autowired
4851
private MeetingRepository meetingRepository;
4952

53+
@Autowired
54+
private MeetingParticipantRepository meetingParticipantRepository;
55+
5056
@Mock
5157
private JobRepository jobRepository;
5258

@@ -84,19 +90,39 @@ void initData() {
8490
MeetingEntity room2 = TestUtils.getStaticRoom();
8591
MeetingEntity room3 = TestUtils.getStaticRoom();
8692

87-
room1.setLastVisitDate(ZonedDateTime.now().minusDays(6)); // should be deleted by step1
88-
room1.setRoomDeletionDueDate(ZonedDateTime.now().minusDays(10));
89-
room1.setDeleteCandidate(true);
93+
List<List<MeetingParticipantEntity>> participants = List.of(
94+
room1.getParticipants(),
95+
room2.getParticipants(),
96+
room3.getParticipants()
97+
);
98+
99+
room1.setParticipants(null);
100+
room2.setParticipants(null);
101+
room3.setParticipants(null);
102+
103+
List<MeetingEntity> meetingEntities = meetingRepository.saveAll(List.of(room1, room2, room3));
104+
105+
meetingEntities.get(0).setLastVisitDate(ZonedDateTime.now().minusDays(6)); // should be deleted by step1
106+
meetingEntities.get(0).setRoomDeletionDueDate(ZonedDateTime.now().minusDays(10));
107+
meetingEntities.get(0).setDeleteCandidate(true);
108+
109+
meetingEntities.get(1).setLastVisitDate(ZonedDateTime.now().minusDays(1)); // should be reset by step2
110+
meetingEntities.get(1).setRoomDeletionDueDate(ZonedDateTime.now().minusDays(10));
111+
meetingEntities.get(1).setDeleteCandidate(true);
112+
113+
meetingEntities.get(2).setLastVisitDate(ZonedDateTime.now().minusDays(3)); // should be marked as candidate by step3
114+
meetingEntities.get(2).setRoomDeletionDueDate(ZonedDateTime.now().minusDays(10));
115+
meetingEntities.get(2).setDeleteCandidate(false);
90116

91-
room2.setLastVisitDate(ZonedDateTime.now().minusDays(1)); // should be reset by step2
92-
room2.setRoomDeletionDueDate(ZonedDateTime.now().minusDays(10));
93-
room2.setDeleteCandidate(true);
94117

95-
room3.setLastVisitDate(ZonedDateTime.now().minusDays(3)); // should be marked as candidate by step3
96-
room3.setRoomDeletionDueDate(ZonedDateTime.now().minusDays(10));
97-
room3.setDeleteCandidate(false);
118+
// set meeting id for every participant
119+
for (int i=0; i<meetingEntities.size(); i++) {
120+
int finalI = i;
121+
participants.get(i).forEach(o -> o.setMeetingId(meetingEntities.get(finalI).getId()));
122+
meetingEntities.get(i).setParticipants(participants.get(i));
123+
}
98124

99-
meetingRepository.saveAll(List.of(room1, room2, room3));
125+
meetingRepository.saveAll(meetingEntities);
100126

101127
mockedJob.meetingRepository = meetingRepository;
102128
mockedJob.chunkSize = chunkSize;
@@ -106,6 +132,7 @@ void initData() {
106132
@AfterEach
107133
void cleanData() {
108134
meetingRepository.deleteAll();
135+
meetingParticipantRepository.deleteAll();
109136
jobRepositoryTestUtils.removeJobExecutions();
110137
}
111138

0 commit comments

Comments
 (0)