-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MODLISTS-75] Source version author information from list rather than…
… session (#51) * [MODLISTS-75] Source version author information from list rather than session * Add updatedBy mappings to created list * Add liquibase changelog * fix liquibase script * nit fix Co-authored-by: mweaver-ebsco <[email protected]> --------- Co-authored-by: mweaver-ebsco <[email protected]>
- Loading branch information
1 parent
591e1dc
commit 02caa9d
Showing
6 changed files
with
62 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...gelog/changes/v1.1.0/yml/alter-list-details-updated-metadata-add-not-null-constraint.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
databaseChangeLog: | ||
- changeSet: | ||
id: alter-list-details-updated-metadata-add-not-null-constraint | ||
author: [email protected] | ||
changes: | ||
# backfill default values | ||
- update: | ||
tableName: list_details | ||
columns: | ||
- column: | ||
name: updated_by | ||
valueComputed: created_by | ||
- column: | ||
name: updated_by_username | ||
valueComputed: created_by_username | ||
- column: | ||
name: updated_date | ||
valueComputed: created_date | ||
where: updated_by IS NULL | ||
|
||
# add new constraints | ||
- addNotNullConstraint: | ||
columnName: updated_by | ||
tableName: list_details | ||
- addNotNullConstraint: | ||
columnName: updated_by_username | ||
tableName: list_details | ||
- addNotNullConstraint: | ||
columnName: updated_date | ||
tableName: list_details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
package org.folio.list.domain; | ||
|
||
import org.folio.list.rest.UsersClient; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.folio.list.utils.TestDataFixture; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class ListVersionTest { | ||
|
||
@Test | ||
void shouldSetDataFromListEntity() { | ||
ListEntity listEntity = TestDataFixture.getListEntityWithSuccessRefresh(); | ||
UsersClient.User user = new UsersClient.User(UUID.randomUUID(), Optional.of(new UsersClient.Personal("Test", "User"))); | ||
ListVersion listVersion = TestDataFixture.getListVersion(); | ||
listVersion.setDataFromListEntity(listEntity, user); | ||
listVersion.setDataFromListEntity(listEntity); | ||
assertEquals(listVersion.getListId(), listEntity.getId()); | ||
assertEquals(listVersion.getName(), listEntity.getName()); | ||
assertEquals(listVersion.getFqlQuery(), listEntity.getFqlQuery()); | ||
assertEquals(listVersion.getIsActive(), listEntity.getIsActive()); | ||
assertEquals(listVersion.getUpdatedBy(), user.id()); | ||
assertEquals(listVersion.getUpdatedByUsername(), user.getFullName().get()); | ||
assertEquals(listVersion.getUpdatedBy(), listEntity.getUpdatedBy()); | ||
assertEquals( | ||
listVersion.getUpdatedByUsername(), | ||
listEntity.getUpdatedByUsername() | ||
); | ||
} | ||
} |