This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-3676 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 923b3e1e14e52ce475a72e7aaa5d9c266fd7335c Author: danhaywood <[email protected]> AuthorDate: Fri Jan 26 13:26:23 2024 +0000 CAUSEWAY-3676: splits up tests a little, is all --- .../viewer/test/e2e/Abstract_IntegTest.java | 4 +- ...nt._.gql => Calculator_IntegTest.add_int._.gql} | 0 ... => Calculator_IntegTest.add_int.approved.json} | 0 ...ma_IntegTest.java => Calculator_IntegTest.java} | 38 +++--- ...> Department_IntegTest.create_department._.gql} | 0 ...ment_IntegTest.create_department.approved.json} | 0 ...st.create_department_name_param_disabled._.gql} | 0 ...e_department_name_param_disabled.approved.json} | 0 ...epartment_IntegTest.find_all_departments._.gql} | 0 ...t_IntegTest.find_all_departments.approved.json} | 0 ...department_and_add_staff_members._.choices.gql} | 0 ..._department_and_add_staff_members._.invoke.gql} | 0 ...department_and_add_staff_members.approved.json} | 0 ..._department_and_change_head_autocomplete._.gql} | 0 ...ent_and_change_head_autocomplete.approved.json} | 0 ....find_department_and_change_head_default._.gql} | 0 ...partment_and_change_head_default.approved.json} | 0 ....find_department_and_change_name_invalid._.gql} | 0 ...partment_and_change_name_invalid.approved.json} | 0 ...nd_department_and_edit_head_autocomplete._.gql} | 0 ...tment_and_edit_head_autocomplete.approved.json} | 0 ...and_edit_head_autocomplete_none_matching._.gql} | 0 ..._head_autocomplete_none_matching.approved.json} | 0 ...partment_and_remove_staff_member_choices._.gql} | 0 ..._and_remove_staff_member_choices.approved.json} | 0 ...rtment_IntegTest.find_department_by_name._.gql} | 0 ...ntegTest.find_department_by_name.approved.json} | 0 ...in_IntegTest.java => Department_IntegTest.java} | 131 +-------------------- ..._IntegTest.find_depthead_and_change_name._.gql} | 0 ...st.find_depthead_and_change_name.approved.json} | 0 ...st.find_depthead_and_change_name_invalid._.gql} | 0 ...depthead_and_change_name_invalid.approved.json} | 0 ..._depthead_and_change_name_invoke_invalid._.gql} | 0 ...d_and_change_name_invoke_invalid.approved.json} | 0 ...DeptHead_IntegTest.find_depthead_by_name._.gql} | 0 ..._IntegTest.find_depthead_by_name.approved.json} | 0 .../viewer/test/e2e/DeptHead_IntegTest.java | 92 +++++++++++++++ ...Test.create_staff_member_with_department._.gql} | 0 ...ate_staff_member_with_department.approved.json} | 0 ...gTest.find_staff_member_by_name_and_edit._.gql} | 0 ...nd_staff_member_by_name_and_edit.approved.json} | 0 ...ff_member_by_name_and_edit_grade_choices._.gql} | 0 ...r_by_name_and_edit_grade_choices.approved.json} | 0 .../graphql/viewer/test/e2e/Staff_IntegTest.java | 119 +++++++++++++++++++ ...IntegTest.staff_member_name_edit_invalid._.gql} | 0 ...t.staff_member_name_edit_invalid.approved.json} | 0 ...aff_IntegTest.staff_member_name_validate._.gql} | 0 ...gTest.staff_member_name_validate.approved.json} | 0 .../test/{e2e => schema}/Schema_IntegTest.java | 2 +- .../{e2e => schema}/Schema_IntegTest.schema._.gql | 0 .../Schema_IntegTest.schema.approved.json | 0 .../Schema_IntegTest.schema_types_name._.gql | 0 ...chema_IntegTest.schema_types_name.approved.json | 0 53 files changed, 238 insertions(+), 148 deletions(-) diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Abstract_IntegTest.java b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Abstract_IntegTest.java index 0c48f77378..42b3c13ca1 100644 --- a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Abstract_IntegTest.java +++ b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Abstract_IntegTest.java @@ -55,9 +55,7 @@ import org.apache.causeway.viewer.graphql.viewer.test.domain.StaffMemberReposito import lombok.val; -//NOT USING @Transactional since we are running server within same transaction otherwise -@ActiveProfiles("test") -public class Abstract_IntegTest extends CausewayViewerGraphqlTestModuleIntegTestAbstract { +public abstract class Abstract_IntegTest extends CausewayViewerGraphqlTestModuleIntegTestAbstract { @Inject DepartmentRepository departmentRepository; @Inject DeptHeadRepository deptHeadRepository; diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.calculator_add_int._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.add_int._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.calculator_add_int._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.add_int._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.calculator_add_int.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.add_int.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.calculator_add_int.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.add_int.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.java b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.java similarity index 59% copy from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.java copy to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.java index 21a402fcb8..d9fde489a6 100644 --- a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.java +++ b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Calculator_IntegTest.java @@ -18,39 +18,45 @@ */ package org.apache.causeway.viewer.graphql.viewer.test.e2e; -import org.apache.causeway.viewer.graphql.viewer.test.CausewayViewerGraphqlTestModuleIntegTestAbstract; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import org.approvaltests.Approvals; import org.approvaltests.reporters.DiffReporter; import org.approvaltests.reporters.UseReporter; +import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledIfSystemProperties; - -import org.junit.jupiter.api.condition.DisabledIfSystemProperty; +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; import org.springframework.test.context.ActiveProfiles; +import org.springframework.transaction.annotation.Propagation; -import static org.apache.causeway.commons.internal.assertions._Assert.assertEquals; -import static org.apache.causeway.commons.internal.assertions._Assert.assertNotNull; -import static org.apache.causeway.commons.internal.assertions._Assert.assertTrue; +import org.apache.causeway.applib.services.bookmark.Bookmark; +import org.apache.causeway.commons.internal.base._Strings; +import org.apache.causeway.commons.internal.collections._Maps; +import org.apache.causeway.viewer.graphql.viewer.test.domain.Department; +import org.apache.causeway.viewer.graphql.viewer.test.domain.DeptHead; +import org.apache.causeway.viewer.graphql.viewer.test.domain.StaffMember; -import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; +import lombok.val; +//NOT USING @Transactional since we are running server within same transaction otherwise @ActiveProfiles("test") -public class Schema_IntegTest extends CausewayViewerGraphqlTestModuleIntegTestAbstract { +public class Calculator_IntegTest extends Abstract_IntegTest { @Test - // @DisabledIfSystemProperty(named = "isRunningWithSurefire", matches = "true") @UseReporter(DiffReporter.class) - void schema() throws Exception { - Approvals.verify(submit(), jsonOptions()); - } + void add_int() throws Exception { - @Test - @UseReporter(DiffReporter.class) - void schema_types_name() throws Exception { + // when, then Approvals.verify(submit(), jsonOptions()); } + + } diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_department._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.create_department._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_department._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.create_department._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_department.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.create_department.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_department.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.create_department.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_department_name_param_disabled._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.create_department_name_param_disabled._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_department_name_param_disabled._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.create_department_name_param_disabled._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_department_name_param_disabled.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.create_department_name_param_disabled.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_department_name_param_disabled.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.create_department_name_param_disabled.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_all_departments._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_all_departments._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_all_departments._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_all_departments._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_all_departments.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_all_departments.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_all_departments.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_all_departments.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_add_staff_members._.choices.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_add_staff_members._.choices.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_add_staff_members._.choices.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_add_staff_members._.choices.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_add_staff_members._.invoke.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_add_staff_members._.invoke.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_add_staff_members._.invoke.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_add_staff_members._.invoke.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_add_staff_members.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_add_staff_members.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_add_staff_members.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_add_staff_members.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_head_autocomplete._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_head_autocomplete._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_head_autocomplete._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_head_autocomplete._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_head_autocomplete.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_head_autocomplete.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_head_autocomplete.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_head_autocomplete.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_head_default._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_head_default._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_head_default._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_head_default._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_head_default.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_head_default.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_head_default.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_head_default.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_name_invalid._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_name_invalid._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_name_invalid._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_name_invalid._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_name_invalid.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_name_invalid.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_change_name_invalid.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_change_name_invalid.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_edit_head_autocomplete._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_edit_head_autocomplete._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_edit_head_autocomplete._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_edit_head_autocomplete._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_edit_head_autocomplete.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_edit_head_autocomplete.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_edit_head_autocomplete.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_edit_head_autocomplete.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_edit_head_autocomplete_none_matching._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_edit_head_autocomplete_none_matching._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_edit_head_autocomplete_none_matching._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_edit_head_autocomplete_none_matching._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_edit_head_autocomplete_none_matching.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_edit_head_autocomplete_none_matching.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_edit_head_autocomplete_none_matching.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_edit_head_autocomplete_none_matching.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_remove_staff_member_choices._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_remove_staff_member_choices._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_remove_staff_member_choices._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_remove_staff_member_choices._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_remove_staff_member_choices.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_remove_staff_member_choices.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_and_remove_staff_member_choices.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_and_remove_staff_member_choices.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_by_name._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_by_name._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_by_name._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_by_name._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_by_name.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_by_name.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_department_by_name.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.find_department_by_name.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.java b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.java similarity index 62% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.java rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.java index 905088384e..e349c4dc4b 100644 --- a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.java +++ b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Department_IntegTest.java @@ -48,7 +48,7 @@ import lombok.val; //NOT USING @Transactional since we are running server within same transaction otherwise @ActiveProfiles("test") -public class Domain_IntegTest extends Abstract_IntegTest { +public class Department_IntegTest extends Abstract_IntegTest { @Test @UseReporter(DiffReporter.class) @@ -112,22 +112,6 @@ public class Domain_IntegTest extends Abstract_IntegTest { Approvals.verify(submit(), jsonOptions()); } - @Test - @UseReporter(DiffReporter.class) - void find_staff_member_by_name_and_edit_grade_choices() throws Exception { - - // when, then - Approvals.verify(submit(), jsonOptions()); - } - - @Test - @UseReporter(DiffReporter.class) - void calculator_add_int() throws Exception { - - // when, then - Approvals.verify(submit(), jsonOptions()); - } - @Test @UseReporter(DiffReporter.class) void find_department_and_add_staff_members() throws Exception { @@ -151,66 +135,12 @@ public class Domain_IntegTest extends Abstract_IntegTest { Assertions.assertThat(ids).hasSize(3); val replacements = _Maps.unmodifiable( - "$staffMemberId1", ids.get(0), - "$staffMemberId2", ids.get(1)); + "$staffMemberId1", ids.get(0), + "$staffMemberId2", ids.get(1)); Approvals.verify(submit("invoke", replacements), jsonOptions()); } - @Test - @UseReporter(DiffReporter.class) - void find_staff_member_by_name_and_edit() throws Exception { - - // given - final Optional<Bookmark> bookmarkIfAny = - transactionService.callTransactional( - Propagation.REQUIRED, - () -> { - StaffMember pojo = staffMemberRepository.findByName("Gerry Jones"); - return bookmarkService.bookmarkFor(pojo); - } - ).valueAsNullableElseFail(); - - assertThat(bookmarkIfAny).isPresent(); - - // when, then - Approvals.verify(submit(), jsonOptions()); - - // and in the database... - final Optional<StaffMember> staffMemberIfAny = - transactionService.callTransactional( - Propagation.REQUIRED, - () -> bookmarkService.lookup(bookmarkIfAny.get(), StaffMember.class) - ).valueAsNullableElseFail(); - - assertThat(staffMemberIfAny).isPresent(); - assertThat(staffMemberIfAny.get()).extracting(StaffMember::getName).isEqualTo("Gerald Johns"); - } - - @Test - @UseReporter(DiffReporter.class) - void staff_member_name_validate() throws Exception { - - // when, then - Approvals.verify(submit(), jsonOptions()); - } - - @Test - @UseReporter(DiffReporter.class) - void staff_member_name_edit_invalid() throws Exception { - - // when, then - Approvals.verify(submit(), jsonOptions()); - } - - @Test - @UseReporter(DiffReporter.class) - void find_depthead_by_name() throws Exception { - - // when, then - Approvals.verify(submit(), jsonOptions()); - } - @Test @UseReporter(DiffReporter.class) void find_department_and_change_head_autocomplete() throws Exception { @@ -219,26 +149,6 @@ public class Domain_IntegTest extends Abstract_IntegTest { Approvals.verify(submit(), jsonOptions()); } - @Test - @UseReporter(DiffReporter.class) - void create_staff_member_with_department() throws Exception { - - final Bookmark bookmark = - transactionService.callTransactional( - Propagation.REQUIRED, - () -> { - Department department = departmentRepository.findByName("Classics"); - return bookmarkService.bookmarkFor(department).orElseThrow(); - } - ).valueAsNonNullElseFail(); - - val response = submit(_Maps.unmodifiable("$departmentId", bookmark.getIdentifier())); - - // then payload - Approvals.verify(response, jsonOptions()); - - } - @Test @UseReporter(DiffReporter.class) void create_department() throws Exception { @@ -291,23 +201,6 @@ public class Domain_IntegTest extends Abstract_IntegTest { Approvals.verify(response, jsonOptions()); } - @Test - @UseReporter(DiffReporter.class) - void find_depthead_and_change_name_invalid() throws Exception { - - String response = submit(); - - // then payload - Approvals.verify(response, jsonOptions()); - } - - @Test - @UseReporter(DiffReporter.class) - void find_depthead_and_change_name_invoke_invalid() throws Exception { - - // when, then - Approvals.verify(submit(), jsonOptions()); - } @Test @UseReporter(DiffReporter.class) @@ -317,23 +210,5 @@ public class Domain_IntegTest extends Abstract_IntegTest { Approvals.verify(submit(), jsonOptions()); } - @Test - @UseReporter(DiffReporter.class) - void find_depthead_and_change_name() throws Exception { - - // when lookup 'Prof. Dicky Horwich' and change it to 'Prof. Richard Horwich' - String response = submit(); - - // then payload - Approvals.verify(response, jsonOptions()); - - // and also in the database - DeptHead deptHeadAfter = transactionService.callTransactional( - Propagation.REQUIRED, - () -> deptHeadRepository.findByName("Prof. Richard Horwich") - ).valueAsNullableElseFail(); - - assertThat(deptHeadAfter).isNotNull(); - } } diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name_invalid._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name_invalid._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name_invalid._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name_invalid._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name_invalid.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name_invalid.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name_invalid.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name_invalid.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name_invoke_invalid._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name_invoke_invalid._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name_invoke_invalid._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name_invoke_invalid._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name_invoke_invalid.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name_invoke_invalid.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_and_change_name_invoke_invalid.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_and_change_name_invoke_invalid.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_by_name._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_by_name._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_by_name._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_by_name._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_by_name.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_by_name.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_depthead_by_name.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.find_depthead_by_name.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.java b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.java new file mode 100644 index 0000000000..fae67abef7 --- /dev/null +++ b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/DeptHead_IntegTest.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.causeway.viewer.graphql.viewer.test.e2e; + +import java.util.Optional; + +import org.approvaltests.Approvals; +import org.approvaltests.reporters.DiffReporter; +import org.approvaltests.reporters.UseReporter; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +import org.springframework.test.context.ActiveProfiles; +import org.springframework.transaction.annotation.Propagation; + +import org.apache.causeway.applib.services.bookmark.Bookmark; +import org.apache.causeway.commons.internal.collections._Maps; +import org.apache.causeway.viewer.graphql.viewer.test.domain.Department; +import org.apache.causeway.viewer.graphql.viewer.test.domain.DeptHead; +import org.apache.causeway.viewer.graphql.viewer.test.domain.StaffMember; + +import lombok.val; + + +//NOT USING @Transactional since we are running server within same transaction otherwise +@ActiveProfiles("test") +public class DeptHead_IntegTest extends Abstract_IntegTest { + + @Test + @UseReporter(DiffReporter.class) + void find_depthead_by_name() throws Exception { + + // when, then + Approvals.verify(submit(), jsonOptions()); + } + + + @Test + @UseReporter(DiffReporter.class) + void find_depthead_and_change_name_invalid() throws Exception { + + String response = submit(); + + // then payload + Approvals.verify(response, jsonOptions()); + } + @Test + @UseReporter(DiffReporter.class) + void find_depthead_and_change_name_invoke_invalid() throws Exception { + + // when, then + Approvals.verify(submit(), jsonOptions()); + } + + @Test + @UseReporter(DiffReporter.class) + void find_depthead_and_change_name() throws Exception { + + // when lookup 'Prof. Dicky Horwich' and change it to 'Prof. Richard Horwich' + String response = submit(); + + // then payload + Approvals.verify(response, jsonOptions()); + + // and also in the database + DeptHead deptHeadAfter = transactionService.callTransactional( + Propagation.REQUIRED, + () -> deptHeadRepository.findByName("Prof. Richard Horwich") + ).valueAsNullableElseFail(); + + assertThat(deptHeadAfter).isNotNull(); + } + + +} diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_staff_member_with_department._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.create_staff_member_with_department._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_staff_member_with_department._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.create_staff_member_with_department._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_staff_member_with_department.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.create_staff_member_with_department.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.create_staff_member_with_department.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.create_staff_member_with_department.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_staff_member_by_name_and_edit._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.find_staff_member_by_name_and_edit._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_staff_member_by_name_and_edit._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.find_staff_member_by_name_and_edit._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_staff_member_by_name_and_edit.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.find_staff_member_by_name_and_edit.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_staff_member_by_name_and_edit.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.find_staff_member_by_name_and_edit.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_staff_member_by_name_and_edit_grade_choices._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.find_staff_member_by_name_and_edit_grade_choices._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_staff_member_by_name_and_edit_grade_choices._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.find_staff_member_by_name_and_edit_grade_choices._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_staff_member_by_name_and_edit_grade_choices.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.find_staff_member_by_name_and_edit_grade_choices.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.find_staff_member_by_name_and_edit_grade_choices.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.find_staff_member_by_name_and_edit_grade_choices.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.java b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.java new file mode 100644 index 0000000000..b6977ddba1 --- /dev/null +++ b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.java @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.causeway.viewer.graphql.viewer.test.e2e; + +import java.util.Optional; + +import org.approvaltests.Approvals; +import org.approvaltests.reporters.DiffReporter; +import org.approvaltests.reporters.UseReporter; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +import org.springframework.test.context.ActiveProfiles; +import org.springframework.transaction.annotation.Propagation; + +import org.apache.causeway.applib.services.bookmark.Bookmark; +import org.apache.causeway.commons.internal.collections._Maps; +import org.apache.causeway.viewer.graphql.viewer.test.domain.Department; +import org.apache.causeway.viewer.graphql.viewer.test.domain.DeptHead; +import org.apache.causeway.viewer.graphql.viewer.test.domain.StaffMember; + +import lombok.val; + + +//NOT USING @Transactional since we are running server within same transaction otherwise +@ActiveProfiles("test") +public class Staff_IntegTest extends Abstract_IntegTest { + + @Test + @UseReporter(DiffReporter.class) + void find_staff_member_by_name_and_edit_grade_choices() throws Exception { + + // when, then + Approvals.verify(submit(), jsonOptions()); + } + + @Test + @UseReporter(DiffReporter.class) + void find_staff_member_by_name_and_edit() throws Exception { + + // given + final Optional<Bookmark> bookmarkIfAny = + transactionService.callTransactional( + Propagation.REQUIRED, + () -> { + StaffMember pojo = staffMemberRepository.findByName("Gerry Jones"); + return bookmarkService.bookmarkFor(pojo); + } + ).valueAsNullableElseFail(); + + assertThat(bookmarkIfAny).isPresent(); + + // when, then + Approvals.verify(submit(), jsonOptions()); + + // and in the database... + final Optional<StaffMember> staffMemberIfAny = + transactionService.callTransactional( + Propagation.REQUIRED, + () -> bookmarkService.lookup(bookmarkIfAny.get(), StaffMember.class) + ).valueAsNullableElseFail(); + + assertThat(staffMemberIfAny).isPresent(); + assertThat(staffMemberIfAny.get()).extracting(StaffMember::getName).isEqualTo("Gerald Johns"); + } + + @Test + @UseReporter(DiffReporter.class) + void staff_member_name_validate() throws Exception { + + // when, then + Approvals.verify(submit(), jsonOptions()); + } + + @Test + @UseReporter(DiffReporter.class) + void staff_member_name_edit_invalid() throws Exception { + + // when, then + Approvals.verify(submit(), jsonOptions()); + } + + @Test + @UseReporter(DiffReporter.class) + void create_staff_member_with_department() throws Exception { + + final Bookmark bookmark = + transactionService.callTransactional( + Propagation.REQUIRED, + () -> { + Department department = departmentRepository.findByName("Classics"); + return bookmarkService.bookmarkFor(department).orElseThrow(); + } + ).valueAsNonNullElseFail(); + + val response = submit(_Maps.unmodifiable("$departmentId", bookmark.getIdentifier())); + + // then payload + Approvals.verify(response, jsonOptions()); + + } +} diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.staff_member_name_edit_invalid._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.staff_member_name_edit_invalid._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.staff_member_name_edit_invalid._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.staff_member_name_edit_invalid._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.staff_member_name_edit_invalid.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.staff_member_name_edit_invalid.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.staff_member_name_edit_invalid.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.staff_member_name_edit_invalid.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.staff_member_name_validate._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.staff_member_name_validate._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.staff_member_name_validate._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.staff_member_name_validate._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.staff_member_name_validate.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.staff_member_name_validate.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Domain_IntegTest.staff_member_name_validate.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Staff_IntegTest.staff_member_name_validate.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.java b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.java similarity index 97% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.java rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.java index 21a402fcb8..91cb19afd5 100644 --- a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.java +++ b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.causeway.viewer.graphql.viewer.test.e2e; +package org.apache.causeway.viewer.graphql.viewer.test.schema; import org.apache.causeway.viewer.graphql.viewer.test.CausewayViewerGraphqlTestModuleIntegTestAbstract; diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.schema._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.schema._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.schema._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.schema._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.schema.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.schema.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.schema.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.schema.approved.json diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.schema_types_name._.gql b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.schema_types_name._.gql similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.schema_types_name._.gql rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.schema_types_name._.gql diff --git a/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.schema_types_name.approved.json b/incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.schema_types_name.approved.json similarity index 100% rename from incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/e2e/Schema_IntegTest.schema_types_name.approved.json rename to incubator/viewers/graphql/test/src/test/java/org/apache/causeway/viewer/graphql/viewer/test/schema/Schema_IntegTest.schema_types_name.approved.json
