-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:folio-org/mod-circulation-storage…
… into ecs-tlr-feature # Conflicts: # src/test/java/org/folio/rest/api/StaffSlipsApiTest.java # src/test/java/org/folio/rest/support/builders/RequestRequestBuilder.java
- Loading branch information
Showing
12 changed files
with
205 additions
and
21 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
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
8 changes: 8 additions & 0 deletions
8
src/main/resources/templates/db_scripts/add_due_date_slips.sql
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,8 @@ | ||
INSERT INTO ${myuniversity}_${mymodule}.staff_slips(id, jsonb) | ||
VALUES ('0b52bca7-db17-4e91-a740-7872ed6d7323', | ||
jsonb_build_object( | ||
'id', '0b52bca7-db17-4e91-a740-7872ed6d7323', | ||
'name', 'Due date receipt', | ||
'active', true, | ||
'template', '<p></p>')) | ||
ON CONFLICT DO NOTHING; |
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
44 changes: 44 additions & 0 deletions
44
src/test/java/org/folio/rest/api/migration/DueDateSlipsMigrationScriptTest.java
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,44 @@ | ||
package org.folio.rest.api.migration; | ||
|
||
import io.vertx.core.json.JsonArray; | ||
import io.vertx.core.json.JsonObject; | ||
import org.folio.rest.api.StorageTestSuite; | ||
import org.folio.rest.support.JsonResponse; | ||
import org.folio.rest.support.ResponseHandler; | ||
import org.hamcrest.core.Is; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.net.HttpURLConnection; | ||
import java.net.MalformedURLException; | ||
import java.util.concurrent.CompletableFuture; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
|
||
public class DueDateSlipsMigrationScriptTest extends StaffSlipsMigrationTestBase { | ||
public static final String DUE_DATE_RECEIPT_ID = "0b52bca7-db17-4e91-a740-7872ed6d7323"; | ||
private static final String MIGRATION_SCRIPT = loadScript("add_due_date_slips.sql"); | ||
|
||
@Before | ||
public void beforeEach() throws MalformedURLException { | ||
StorageTestSuite.deleteAll(staffSlipsStorageUrl("")); | ||
} | ||
|
||
@Test | ||
public void canMigrateStaffSlips() throws Exception { | ||
executeMultipleSqlStatements(MIGRATION_SCRIPT); | ||
CompletableFuture<JsonResponse> getCompleted = new CompletableFuture<>(); | ||
client.get(staffSlipsStorageUrl(""), StorageTestSuite.TENANT_ID, | ||
ResponseHandler.json(getCompleted)); | ||
JsonResponse getResponse = getCompleted.get(5, TimeUnit.SECONDS); | ||
|
||
assertThat(getResponse.getStatusCode(), Is.is(HttpURLConnection.HTTP_OK)); | ||
|
||
JsonArray slipsJsonArray = getResponse.getJson().getJsonArray("staffSlips"); | ||
JsonObject staffSlips = getRecordById(slipsJsonArray, DUE_DATE_RECEIPT_ID); | ||
|
||
assertStaffSlip(staffSlips, DUE_DATE_RECEIPT_ID, "Due date receipt"); | ||
} | ||
} |
Oops, something went wrong.