forked from migtools/tackle-application-inventory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'comments' column to 'application' entity (#5)
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 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
2 changes: 2 additions & 0 deletions
2
src/main/resources/db/migration/V20210308.1__alter_application.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,2 @@ | ||
alter table if exists application | ||
add column comments varchar (5000); |
4 changes: 4 additions & 0 deletions
4
src/main/resources/db/test-data/V20210308.2__update_application.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,4 @@ | ||
UPDATE application SET createUser = 'mrizzi', createTime = '2019-01-01 00:00:00.407', updateUser = 'mrizzi', updateTime = CURRENT_TIMESTAMP, deleted = false, comments = 'first' WHERE id = 1; | ||
UPDATE application SET createUser = 'foo', createTime = '2020-01-01 00:00:00', updateUser = 'mrizzi', updateTime = CURRENT_TIMESTAMP, deleted = false, comments = 'first' WHERE id = 2; | ||
UPDATE application SET createUser = 'foo', createTime = '2021-01-01 00:00:00', deleted = false, comments = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' WHERE id = 3; | ||
|
46 changes: 46 additions & 0 deletions
46
src/test/java/io/tackle/applicationinventory/resources/ApplicationResourceTest.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,46 @@ | ||
package io.tackle.applicationinventory.resources; | ||
|
||
import io.quarkus.test.common.QuarkusTestResource; | ||
import io.quarkus.test.common.ResourceArg; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.tackle.commons.testcontainers.KeycloakTestResource; | ||
import io.tackle.commons.testcontainers.PostgreSQLDatabaseTestResource; | ||
import io.tackle.commons.tests.SecuredResourceTest; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
@QuarkusTest | ||
@QuarkusTestResource(value = PostgreSQLDatabaseTestResource.class, | ||
initArgs = { | ||
@ResourceArg(name = PostgreSQLDatabaseTestResource.DB_NAME, value = "application_inventory_db"), | ||
@ResourceArg(name = PostgreSQLDatabaseTestResource.USER, value = "application_inventory"), | ||
@ResourceArg(name = PostgreSQLDatabaseTestResource.PASSWORD, value = "application_inventory") | ||
} | ||
) | ||
@QuarkusTestResource(value = KeycloakTestResource.class, | ||
initArgs = { | ||
@ResourceArg(name = KeycloakTestResource.IMPORT_REALM_JSON_PATH, value = "keycloak/quarkus-realm.json"), | ||
@ResourceArg(name = KeycloakTestResource.REALM_NAME, value = "quarkus") | ||
} | ||
) | ||
public class ApplicationResourceTest extends SecuredResourceTest { | ||
|
||
@BeforeAll | ||
public static void init() { | ||
PATH = "/application"; | ||
} | ||
|
||
@Test | ||
public void testComments() { | ||
given() | ||
.accept("application/hal+json") | ||
.queryParam("sort", "-id") | ||
.when().get(PATH) | ||
.then() | ||
.statusCode(200) | ||
.body("_embedded.application.comments[0].length()", is(1000)); | ||
} | ||
} |