test(education): activate paid collection fixture
This commit is contained in:
@@ -53,8 +53,24 @@ class EducationEntitlementPostgreSqlIntegrationTest extends PostgreSqlDbIntegrat
|
|||||||
QuestionCollectionDO collection = new QuestionCollectionDO(); collection.setId(102L); collection.setTenantId(10L); collection.setScope("TENANT_OWNED");
|
QuestionCollectionDO collection = new QuestionCollectionDO(); collection.setId(102L); collection.setTenantId(10L); collection.setScope("TENANT_OWNED");
|
||||||
collection.setEntryId(100L); collection.setNodeId(101L); collection.setName("Paid collection"); collection.setCollectionType("MANUAL");
|
collection.setEntryId(100L); collection.setNodeId(101L); collection.setName("Paid collection"); collection.setCollectionType("MANUAL");
|
||||||
collection.setQuestionCount(0); collection.setAccessMode("PAID"); collection.setAccessRules("{\"label\":\"descriptive only\"}");
|
collection.setQuestionCount(0); collection.setAccessMode("PAID"); collection.setAccessRules("{\"label\":\"descriptive only\"}");
|
||||||
collection.setIsHidden(false); collection.setIsActive(true); collection.setSortOrder(0); collection.setPublicationStatus("ACTIVE");
|
collection.setIsHidden(true); collection.setIsActive(false); collection.setSortOrder(0); collection.setPublicationStatus("DRAFT");
|
||||||
collection.setAuthoringVersion(0); collection.setMembershipVersion(0); collectionMapper.insert(collection);
|
collection.setAuthoringVersion(0); collection.setMembershipVersion(0); collectionMapper.insert(collection);
|
||||||
|
try (Connection connection = dataSource.getConnection(); var statement = connection.createStatement()) {
|
||||||
|
statement.execute("""
|
||||||
|
DO $activate_collection$
|
||||||
|
BEGIN
|
||||||
|
UPDATE education_question_collection
|
||||||
|
SET publication_status='ACTIVE', is_active=true, is_hidden=false, authoring_version=1
|
||||||
|
WHERE id=102 AND tenant_id=10;
|
||||||
|
INSERT INTO education_question_collection_lifecycle_audit
|
||||||
|
(tenant_id,collection_id,authoring_version,actor_id,from_status,to_status)
|
||||||
|
VALUES (10,102,1,7,'DRAFT','ACTIVE');
|
||||||
|
END
|
||||||
|
$activate_collection$;
|
||||||
|
""");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new IllegalStateException(ex);
|
||||||
|
}
|
||||||
EducationResourceProductBindingDO binding = EducationResourceProductBindingDO.builder().resourceType("QUESTION_COLLECTION")
|
EducationResourceProductBindingDO binding = EducationResourceProductBindingDO.builder().resourceType("QUESTION_COLLECTION")
|
||||||
.resourceId(102L).productSpuId(900L).status("ACTIVE").version(0).build();
|
.resourceId(102L).productSpuId(900L).status("ACTIVE").version(0).build();
|
||||||
binding.setTenantId(10L); bindingMapper.insert(binding);
|
binding.setTenantId(10L); bindingMapper.insert(binding);
|
||||||
|
|||||||
Reference in New Issue
Block a user