diff --git a/api.md b/api.md deleted file mode 100644 index b6907cd..0000000 --- a/api.md +++ /dev/null @@ -1,609 +0,0 @@ -# Skilllevel Service API - -
- Table of Contents - - * [Query](#query) - * [Mutation](#mutation) - * [Objects](#objects) - * [PaginationInfo](#paginationinfo) - * [SkillLevel](#skilllevel) - * [SkillLevelLogItem](#skilllevellogitem) - * [SkillLevels](#skilllevels) - * [Inputs](#inputs) - * [DateTimeFilter](#datetimefilter) - * [IntFilter](#intfilter) - * [Pagination](#pagination) - * [StringFilter](#stringfilter) - * [Enums](#enums) - * [SortDirection](#sortdirection) - * [Scalars](#scalars) - * [Boolean](#boolean) - * [Date](#date) - * [DateTime](#datetime) - * [Float](#float) - * [Int](#int) - * [LocalTime](#localtime) - * [String](#string) - * [Time](#time) - * [UUID](#uuid) - * [Url](#url) - -
- -## Query - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldArgumentTypeDescription
_internal_noauth_userSkillLevelsByChapterIds[SkillLevels!]! - - -Get the skill levels of the current user for all skill types for a list of chapter ids. -⚠️ This query is only accessible internally in the system and allows the caller to fetch contents without -any permissions check and should not be called without any validation of the caller's permissions. ⚠️ - -
chapterIds[UUID!]!
_internal_noauth_skillLevelsForUserByChapterIds[SkillLevels!]! - - -Get the skill levels of the specified user for all skill types for a list of chapter ids. -⚠️ This query is only accessible internally in the system and allows the caller to fetch contents without -any permissions check and should not be called without any validation of the caller's permissions. ⚠️ - -
chapterIds[UUID!]!
userIdUUID!
- -## Mutation - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldArgumentTypeDescription
recalculateLevels ⚠️SkillLevels! - - - ONLY FOR TESTING PURPOSES. DO NOT USE IN FRONTEND. WILL BE REMOVED. - - Triggers the recalculation of the skill level of the user. - This is done automatically at some time in the night. - - The purpose of this mutation is to allow testing of the skill level score and demonstrate the functionality. - 🔒 The user must be a super-user, otherwise an exception is thrown. - -

⚠️ DEPRECATED

-
- -Only for testing purposes. Will be removed. - -
-
chapterIdUUID!
userIdUUID!
- -## Objects - -### PaginationInfo - - -Return type for information about paginated results. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldArgumentTypeDescription
pageInt! - - -The current page number. - -
sizeInt! - - -The number of elements per page. - -
totalElementsInt! - - -The total number of elements across all pages. - -
totalPagesInt! - - -The total number of pages. - -
hasNextBoolean! - - -Whether there is a next page. - -
- -### SkillLevel - - -The skill level of a user. - - - - - - - - - - - - - - - - - - - - - - -
FieldArgumentTypeDescription
valueFloat! - - -The value of the skill level. -levels are between 0 and 100. - -
log[SkillLevelLogItem!]! - - -A log of the changes to the skill level - -
- -### SkillLevelLogItem - - -An item in the skill level change log. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldArgumentTypeDescription
dateDateTime! - - -The date when the skill level changed. - -
differenceFloat! - - -The difference between the previous and the new skill level. - -
oldValueFloat! - - -The old skill level. - -
newValueFloat! - - -The new skill level. - -
associatedContentIds[UUID!]! - - -The ids of the contents that are associated with the change. - -
- -### SkillLevels - - -The four skill level of a user. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldArgumentTypeDescription
rememberSkillLevel! - - -remember represents how much user remember the concept - -
understandSkillLevel! - - -understand represents how well the user understands learned content. - -
applySkillLevel! - - -apply represents the how well user applies the learned concept during assessment. - -
analyzeSkillLevel! - - -apply is how much user can evaluate information and draw conclusions - -
- -## Inputs - -### DateTimeFilter - - -Filter for date values. -If multiple filters are specified, they are combined with AND. - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
afterDateTime - - -If specified, filters for dates after the specified value. - -
beforeDateTime - - -If specified, filters for dates before the specified value. - -
- -### IntFilter - - -Filter for integer values. -If multiple filters are specified, they are combined with AND. - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
equalsInt - - -An integer value to match exactly. - -
greaterThanInt - - -If specified, filters for values greater than to the specified value. - -
lessThanInt - - -If specified, filters for values less than to the specified value. - -
- -### Pagination - - -Specifies the page size and page number for paginated results. - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
pageInt! - - -The page number, starting at 0. -If not specified, the default value is 0. -For values greater than 0, the page size must be specified. -If this value is larger than the number of pages, an empty page is returned. - -
sizeInt! - - -The number of elements per page. - -
- -### StringFilter - - -Filter for string values. -If multiple filters are specified, they are combined with AND. - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldTypeDescription
equalsString - - -A string value to match exactly. - -
containsString - - -A string value that must be contained in the field that is being filtered. - -
ignoreCaseBoolean! - - -If true, the filter is case-insensitive. - -
- -## Enums - -### SortDirection - - -Specifies the sort direction, either ascending or descending. - - - - - - - - - - - - - - - - -
ValueDescription
ASC
DESC
- -## Scalars - -### Boolean - -Built-in Boolean - -### Date - -An RFC-3339 compliant Full Date Scalar - -### DateTime - -A slightly refined version of RFC-3339 compliant DateTime Scalar - -### Float - -Built-in Float - -### Int - -Built-in Int - -### LocalTime - -24-hour clock time value string in the format `hh:mm:ss` or `hh:mm:ss.sss`. - -### String - -Built-in String - -### Time - -An RFC-3339 compliant Full Time Scalar - -### UUID - -A universally unique identifier compliant UUID Scalar - -### Url - -A Url scalar - diff --git a/build.gradle b/build.gradle index 9145d57..9225a2e 100644 --- a/build.gradle +++ b/build.gradle @@ -107,8 +107,8 @@ repositories { dependencies { - implementation 'de.unistuttgart.iste.meitrex:meitrex-common:1.2.6' - implementation 'de.unistuttgart.iste.meitrex:content_service:1.0.8' + implementation 'de.unistuttgart.iste.meitrex:meitrex-common:1.4.4' + implementation 'de.unistuttgart.iste.meitrex:content_service:1.5.0rc1' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-graphql' @@ -127,7 +127,7 @@ dependencies { runtimeOnly 'org.postgresql:postgresql' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' annotationProcessor 'org.projectlombok:lombok' - testImplementation 'de.unistuttgart.iste.meitrex:meitrex-common-test:1.2.6' + testImplementation 'de.unistuttgart.iste.meitrex:meitrex-common-test:1.4.4' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework:spring-webflux' testImplementation 'org.springframework.graphql:spring-graphql-test' diff --git a/src/main/java/de/unistuttgart/iste/meitrex/skilllevel_service/config/GraphQlScalarsAndValidationConfiguration.java b/src/main/java/de/unistuttgart/iste/meitrex/skilllevel_service/config/GraphQlScalarsAndValidationConfiguration.java deleted file mode 100644 index a5c0c33..0000000 --- a/src/main/java/de/unistuttgart/iste/meitrex/skilllevel_service/config/GraphQlScalarsAndValidationConfiguration.java +++ /dev/null @@ -1,35 +0,0 @@ -package de.unistuttgart.iste.meitrex.skilllevel_service.config; - -import graphql.scalars.ExtendedScalars; -import graphql.validation.rules.OnValidationErrorStrategy; -import graphql.validation.rules.ValidationRules; -import graphql.validation.schemawiring.ValidationSchemaWiring; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.graphql.execution.RuntimeWiringConfigurer; - -/** - * This class sets up the validation rules for the GraphQL schema and the scalar types. - */ -@Configuration -public class GraphQlScalarsAndValidationConfiguration { - - @Bean - public RuntimeWiringConfigurer runtimeWiringConfigurer() { - - ValidationRules validationRules = ValidationRules.newValidationRules() - .onValidationErrorStrategy(OnValidationErrorStrategy.RETURN_NULL) - .build(); - - ValidationSchemaWiring schemaWiring = new ValidationSchemaWiring(validationRules); - - return wiringBuilder -> wiringBuilder - .directiveWiring(schemaWiring) - .scalar(ExtendedScalars.DateTime) - .scalar(ExtendedScalars.Date) - .scalar(ExtendedScalars.Time) - .scalar(ExtendedScalars.LocalTime) - .scalar(ExtendedScalars.UUID) - .scalar(ExtendedScalars.Url); - } -} diff --git a/src/main/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/calculation/SkillLevelCalculator.java b/src/main/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/calculation/SkillLevelCalculator.java index bf341bc..622712c 100644 --- a/src/main/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/calculation/SkillLevelCalculator.java +++ b/src/main/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/calculation/SkillLevelCalculator.java @@ -1,8 +1,9 @@ package de.unistuttgart.iste.meitrex.skilllevel_service.service.calculation; +import de.unistuttgart.iste.meitrex.common.dapr.TopicPublisher; import de.unistuttgart.iste.meitrex.common.event.ItemResponse; -import de.unistuttgart.iste.meitrex.common.event.LevelOfBloomsTaxonomy; +import de.unistuttgart.iste.meitrex.common.event.skilllevels.UserSkillLevelChangedEvent; import de.unistuttgart.iste.meitrex.generated.dto.BloomLevel; import de.unistuttgart.iste.meitrex.skilllevel_service.persistence.entity.*; import de.unistuttgart.iste.meitrex.skilllevel_service.persistence.repository.AllSkillLevelsRepository; @@ -34,6 +35,7 @@ public class SkillLevelCalculator { private final BloomLevelAbilityRepository bloomLevelAbilityRepository; private final AllSkillLevelsRepository allSkillLevelsRepository; + private final TopicPublisher topicPublisher; private final static float ALPHA = 0.05f; private final static float BETA = 1f; @@ -82,8 +84,7 @@ private void calculate(final UUID userId, final ItemResponse response) { skillAbilities.add(ability.getAbility()); } List bloomLevelAbilities = new ArrayList(); - for (LevelOfBloomsTaxonomy levelOfBloomsTaxonomy : response.getLevelsOfBloomsTaxonomy()) { - BloomLevel level = mapLevelOfBloomsTaxonomyToBloomLevel(levelOfBloomsTaxonomy); + for (BloomLevel level : response.getLevelsOfBloomsTaxonomy()) { BloomLevelAbilityEntity ability = bloomLevelAbilityRepository.findByUserIdAndBloomLevel(userId, level); if (ability == null) { ability = createBloomAbility(userId, level); @@ -103,8 +104,7 @@ private void calculate(final UUID userId, final ItemResponse response) { for (UUID skillId : response.getSkillIds()) { updateSkillAbility(userId, skillId, difficulty, correctResponse, alpha); } - for (LevelOfBloomsTaxonomy levelOfBloomsTaxonomy : response.getLevelsOfBloomsTaxonomy()) { - BloomLevel level = mapLevelOfBloomsTaxonomyToBloomLevel(levelOfBloomsTaxonomy); + for (BloomLevel level : response.getLevelsOfBloomsTaxonomy()) { updateBloomLevelAbilities(userId, level, difficulty, correctResponse, alpha); } updateSkillLevels(response, userId, prediction); @@ -119,8 +119,7 @@ private void calculate(final UUID userId, final ItemResponse response) { */ private void updateSkillLevels(ItemResponse response, UUID userId, float prediction) { for (UUID skillId : response.getSkillIds()) { - for (LevelOfBloomsTaxonomy levelOfBloomsTaxonomy : response.getLevelsOfBloomsTaxonomy()) { - BloomLevel level = mapLevelOfBloomsTaxonomyToBloomLevel(levelOfBloomsTaxonomy); + for (BloomLevel level : response.getLevelsOfBloomsTaxonomy()) { updateSkillLevel(userId, skillId, level, response.getItemId(), response.getResponse(), prediction); } } @@ -170,6 +169,13 @@ private void updateSkillLevel(UUID userId, UUID skillId, BloomLevel bloomLevel, } setSkillLevelEntityBySkillType(entity, bloomLevel, skillLevelEntity); allSkillLevelsRepository.save(entity); + topicPublisher.notifyUserSkillLevelChanged(UserSkillLevelChangedEvent.builder() + .userId(userId) + .skillId(skillId) + .bloomLevel(bloomLevel) + .oldValue(oldAbility) + .newValue(newAbility) + .build()); } /** @@ -415,21 +421,4 @@ private SkillLevelEntity initializeSkillLevelEntity(final float initialValue) { skillLevelEntity.setLog(new ArrayList<>()); return skillLevelEntity; } - - /*** - * maps the Level of Blooms Taxonomy from Dapr Topic to the same Level of Blooms Taxonomy of the DTO - * @param levelOfBloomsOfBloomsTaxonomy level of blooms Taxonomy - * @return mapped level for the DTO - */ - private BloomLevel mapLevelOfBloomsTaxonomyToBloomLevel(LevelOfBloomsTaxonomy levelOfBloomsOfBloomsTaxonomy) { - return switch (levelOfBloomsOfBloomsTaxonomy) { - case LevelOfBloomsTaxonomy.UNDERSTAND -> BloomLevel.UNDERSTAND; - case LevelOfBloomsTaxonomy.REMEMBER -> BloomLevel.REMEMBER; - case LevelOfBloomsTaxonomy.APPLY -> BloomLevel.APPLY; - case LevelOfBloomsTaxonomy.ANALYZE -> BloomLevel.ANALYZE; - case LevelOfBloomsTaxonomy.EVALUATE -> BloomLevel.EVALUATE; - case LevelOfBloomsTaxonomy.CREATE -> BloomLevel.CREATE; - }; - } - } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 02b479b..1c38b97 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -4,6 +4,8 @@ spring.profiles.active=prod spring.graphql.graphiql.enabled=true spring.graphql.graphiql.path=/graphiql +spring.graphql.schema.locations=classpath*:graphql/common/**/,classpath:graphql/** + # increase max request header size because we transmit authorization data in the header and this might get large # if the user is in a lot of courses server.max-http-request-header-size=64000 diff --git a/src/main/resources/graphql/common/bloomLevels.graphqls b/src/main/resources/graphql/common/bloomLevels.graphqls deleted file mode 100644 index d81a2a0..0000000 --- a/src/main/resources/graphql/common/bloomLevels.graphqls +++ /dev/null @@ -1,11 +0,0 @@ -""" -Level of Blooms Taxonomy -""" -enum BloomLevel{ - REMEMBER - UNDERSTAND - APPLY - ANALYZE - EVALUATE - CREATE -} \ No newline at end of file diff --git a/src/main/resources/graphql/common/directives.graphqls b/src/main/resources/graphql/common/directives.graphqls deleted file mode 100644 index 5b85062..0000000 --- a/src/main/resources/graphql/common/directives.graphqls +++ /dev/null @@ -1,23 +0,0 @@ -# see also https://github.com/graphql-java/graphql-java-extended-validation/blob/master/README.md - -directive @DecimalMax(value : String!, inclusive : Boolean! = true, message : String = "graphql.validation.DecimalMax.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @DecimalMin(value : String!, inclusive : Boolean! = true, message : String = "graphql.validation.DecimalMin.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @Max(value : Int! = 2147483647, message : String = "graphql.validation.Max.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @Min(value : Int! = 0, message : String = "graphql.validation.Min.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @Negative(message : String = "graphql.validation.Negative.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @NegativeOrZero(message : String = "graphql.validation.NegativeOrZero.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @NotBlank(message : String = "graphql.validation.NotBlank.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @NotEmpty(message : String = "graphql.validation.NotEmpty.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @ContainerNotEmpty(message : String = "graphql.validation.ContainerNotEmpty.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @Pattern(regexp : String! =".*", message : String = "graphql.validation.Pattern.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @Positive(message : String = "graphql.validation.Positive.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @PositiveOrZero(message : String = "graphql.validation.PositiveOrZero.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @Range(min : Int = 0, max : Int = 2147483647, message : String = "graphql.validation.Range.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @Size(min : Int = 0, max : Int = 2147483647, message : String = "graphql.validation.Size.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION -directive @ContainerSize(min : Int = 0, max : Int = 2147483647, message : String = "graphql.validation.ContainerSize.message") on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION - -""" -The @OnDemand directive is used to mark fields that are only internally resolved when requested. -Implementation Note: This will cause the code generator to omit the field from the generated DTOs. -""" -directive @OnDemand on FIELD_DEFINITION \ No newline at end of file diff --git a/src/main/resources/graphql/common/scalars.graphqls b/src/main/resources/graphql/common/scalars.graphqls deleted file mode 100644 index d5da038..0000000 --- a/src/main/resources/graphql/common/scalars.graphqls +++ /dev/null @@ -1,12 +0,0 @@ -# will be mapped to OffsetDateTime in Java -scalar DateTime @specifiedBy(url: "https://scalars.graphql.org/andimarek/date-time.html") -# will be mapped to LocalDate in Java -scalar Date @specifiedBy(url:"https://tools.ietf.org/html/rfc3339") -# will be mapped to OffsetTime in Java -scalar Time @specifiedBy(url:"https://tools.ietf.org/html/rfc3339") -# will be mapped to LocalTime in Java -scalar LocalTime -# will be mapped to UUID in Java -scalar UUID @specifiedBy(url: "https://tools.ietf.org/html/rfc4122") -# will be mapped to URL in Java -scalar Url @specifiedBy(url:"https://www.w3.org/Addressing/URL/url-spec.txt") \ No newline at end of file diff --git a/src/main/resources/graphql/common/sortFilterPagination.graphqls b/src/main/resources/graphql/common/sortFilterPagination.graphqls deleted file mode 100644 index 67e1d26..0000000 --- a/src/main/resources/graphql/common/sortFilterPagination.graphqls +++ /dev/null @@ -1,104 +0,0 @@ -""" -Specifies the sort direction, either ascending or descending. -""" -enum SortDirection { - ASC - DESC -} - -""" -Specifies the page size and page number for paginated results. -""" -input Pagination { - """ - The page number, starting at 0. - If not specified, the default value is 0. - For values greater than 0, the page size must be specified. - If this value is larger than the number of pages, an empty page is returned. - """ - page: Int! = 0 @PositiveOrZero - """ - The number of elements per page. - """ - size: Int! @Positive -} - -""" -Return type for information about paginated results. -""" -type PaginationInfo { - """ - The current page number. - """ - page: Int! - """ - The number of elements per page. - """ - size: Int! - """ - The total number of elements across all pages. - """ - totalElements: Int! - """ - The total number of pages. - """ - totalPages: Int! - """ - Whether there is a next page. - """ - hasNext: Boolean! -} - -""" -Filter for string values. -If multiple filters are specified, they are combined with AND. -""" -input StringFilter { - """ - A string value to match exactly. - """ - equals: String - """ - A string value that must be contained in the field that is being filtered. - """ - contains: String - """ - If true, the filter is case-insensitive. - """ - ignoreCase: Boolean! = false -} - -""" -Filter for integer values. -If multiple filters are specified, they are combined with AND. -""" -input IntFilter { - """ - An integer value to match exactly. - """ - equals: Int - """ - If specified, filters for values greater than to the specified value. - """ - greaterThan: Int - """ - If specified, filters for values less than to the specified value. - """ - lessThan: Int -} - -""" -Filter for date values. -If multiple filters are specified, they are combined with AND. -""" -input DateTimeFilter { - """ - If specified, filters for dates after the specified value. - """ - after: DateTime - """ - If specified, filters for dates before the specified value. - """ - before: DateTime -} - diff --git a/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/MElo_Test.java b/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/MElo_Test.java index 990f0f5..bc10bb9 100644 --- a/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/MElo_Test.java +++ b/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/MElo_Test.java @@ -1,7 +1,6 @@ package de.unistuttgart.iste.meitrex.skilllevel_service.service; import de.unistuttgart.iste.meitrex.common.event.ItemResponse; -import de.unistuttgart.iste.meitrex.common.event.LevelOfBloomsTaxonomy; import de.unistuttgart.iste.meitrex.common.testutil.GraphQlApiTest; import de.unistuttgart.iste.meitrex.common.testutil.TablesToDelete; import de.unistuttgart.iste.meitrex.generated.dto.BloomLevel; @@ -61,7 +60,7 @@ public void testNewSkill() { //give the new assessment to M-Elo to update the item and skill ArrayList skillIds = new ArrayList<>(); skillIds.add(skillId); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); ItemResponse responseItem = new ItemResponse().builder() .itemId(itemId) .response(1) @@ -96,7 +95,7 @@ public void testNewSkill() { difficulty = repoItemDifficulty.findById(itemId); assertFalse(difficulty.isPresent()); skillIds.add(skillId); - levels = new ArrayList(); + levels = new ArrayList(); responseItem = new ItemResponse().builder() .itemId(itemId) .response(0).skillIds(skillIds).levelsOfBloomsTaxonomy(levels).build(); @@ -139,7 +138,7 @@ public void testTwoNewSkill() { ArrayList skillIds = new ArrayList<>(); skillIds.add(skillId); skillIds.add(skillId2); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); ItemResponse responseItem = new ItemResponse().builder() .itemId(itemId) .response(1) @@ -180,7 +179,7 @@ public void testTwoNewSkill() { assertFalse(ability2.isPresent()); skillIds.add(skillId); skillIds.add(skillId2); - levels = new ArrayList(); + levels = new ArrayList(); responseItem = new ItemResponse().builder() .itemId(itemId) .response(0).skillIds(skillIds).levelsOfBloomsTaxonomy(levels).build(); @@ -236,7 +235,7 @@ public void testMultipleNewSkill() { skillIds.add(skillId2); skillIds.add(skillId3); skillIds.add(skillId4); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); ItemResponse responseItem = new ItemResponse().builder() .itemId(itemId) .response(1) @@ -296,7 +295,7 @@ public void testMultipleNewItemsOneSkillPerItem() { //give the new assessment to M-Elo to update the item and skill ArrayList skillIds = new ArrayList<>(); skillIds.add(skillId); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); ItemResponse responseItem = new ItemResponse().builder() .itemId(itemId) .response(1) @@ -347,7 +346,7 @@ public void testMultipleNewItemsOneSkillPerItem() { //give the new assessment to M-Elo to update the item and skill skillIds = new ArrayList<>(); skillIds.add(skillId); - levels = new ArrayList(); + levels = new ArrayList(); responseItem = new ItemResponse().builder() .itemId(itemId) .response(0) @@ -403,7 +402,7 @@ public void testMultipleAttemptsOnTheSameItem() { //give the new assessment to M-Elo to update the item and skill ArrayList skillIds = new ArrayList<>(); skillIds.add(skillId); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); ItemResponse responseItem = new ItemResponse().builder() .itemId(itemId) .response(1) @@ -452,7 +451,7 @@ public void testNewSkillBloomsTaxonomy() { UUID skillId = UUID.randomUUID(); UUID userId = UUID.randomUUID(); UUID itemId = UUID.randomUUID(); - LevelOfBloomsTaxonomy level = LevelOfBloomsTaxonomy.UNDERSTAND; + BloomLevel level = BloomLevel.UNDERSTAND; //make sure, that the item and the skill is not saved in the database Optional ability = repoSkillAbility.findById(new SkillAbilityEntity.PrimaryKey(skillId, userId)); assertFalse(ability.isPresent()); @@ -463,7 +462,7 @@ public void testNewSkillBloomsTaxonomy() { //give the new assessment to M-Elo to update the item and skill ArrayList skillIds = new ArrayList<>(); skillIds.add(skillId); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); levels.add(level); ItemResponse responseItem = new ItemResponse().builder() .itemId(itemId) @@ -497,9 +496,9 @@ public void testNewSkillBloomsTaxonomy() { skillId = UUID.randomUUID(); userId = UUID.randomUUID(); itemId = UUID.randomUUID(); - level = LevelOfBloomsTaxonomy.UNDERSTAND; - LevelOfBloomsTaxonomy level2 = LevelOfBloomsTaxonomy.REMEMBER; - levels = new ArrayList(); + level = BloomLevel.UNDERSTAND; + BloomLevel level2 = BloomLevel.REMEMBER; + levels = new ArrayList(); levels.add(level); levels.add(level2); ability = repoSkillAbility.findById(new SkillAbilityEntity.PrimaryKey(skillId, userId)); @@ -588,7 +587,7 @@ public void testMultipleCombinations() { skillIds.add(skillId1); skillIds.add(skillId2); skillIds.add(skillId3); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); ItemResponse responseItem = new ItemResponse().builder() .itemId(itemId) .response(1) @@ -696,7 +695,7 @@ public void updateExistingDifficultiesAndSkills() { assertThat(skillAbility).isEqualTo(ability); ArrayList skillIds = new ArrayList<>(); skillIds.add(skillId); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); ItemResponse responseItem = new ItemResponse().builder() .itemId(itemId) .response(0) diff --git a/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/SkillLevelCalculateLevelsTest.java b/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/SkillLevelCalculateLevelsTest.java index 7fce881..1ca7fe9 100644 --- a/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/SkillLevelCalculateLevelsTest.java +++ b/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/SkillLevelCalculateLevelsTest.java @@ -1,7 +1,6 @@ package de.unistuttgart.iste.meitrex.skilllevel_service.service; import de.unistuttgart.iste.meitrex.common.event.ItemResponse; -import de.unistuttgart.iste.meitrex.common.event.LevelOfBloomsTaxonomy; import de.unistuttgart.iste.meitrex.common.testutil.GraphQlApiTest; import de.unistuttgart.iste.meitrex.common.testutil.TablesToDelete; import de.unistuttgart.iste.meitrex.generated.dto.*; @@ -51,10 +50,10 @@ void testCalculateLevels() { final UUID itemId = UUID.randomUUID(); final UUID itemId2 = UUID.randomUUID(); final ArrayList skillIds = new ArrayList<>(); - final ArrayList levels = new ArrayList(); + final ArrayList levels = new ArrayList(); final ArrayList responses = new ArrayList(); - levels.add(LevelOfBloomsTaxonomy.REMEMBER); - levels.add(LevelOfBloomsTaxonomy.ANALYZE); + levels.add(BloomLevel.REMEMBER); + levels.add(BloomLevel.ANALYZE); skillIds.add(skillId); ItemResponse response1 = ItemResponse.builder() .itemId(itemId) diff --git a/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/SkillLevelMultipleSkillTypesTest.java b/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/SkillLevelMultipleSkillTypesTest.java index d210ad1..070da17 100644 --- a/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/SkillLevelMultipleSkillTypesTest.java +++ b/src/test/java/de/unistuttgart/iste/meitrex/skilllevel_service/service/SkillLevelMultipleSkillTypesTest.java @@ -1,7 +1,6 @@ package de.unistuttgart.iste.meitrex.skilllevel_service.service; import de.unistuttgart.iste.meitrex.common.event.ItemResponse; -import de.unistuttgart.iste.meitrex.common.event.LevelOfBloomsTaxonomy; import de.unistuttgart.iste.meitrex.common.testutil.GraphQlApiTest; import de.unistuttgart.iste.meitrex.common.testutil.TablesToDelete; import de.unistuttgart.iste.meitrex.generated.dto.*; @@ -53,17 +52,17 @@ void testMultipleSkillTypes() { UUID itemId = UUID.randomUUID(); UUID itemId2 = UUID.randomUUID(); final ArrayList skillIds = new ArrayList<>(); - ArrayList levels = new ArrayList(); + ArrayList levels = new ArrayList(); final ArrayList responses = new ArrayList(); - levels.add(LevelOfBloomsTaxonomy.REMEMBER); + levels.add(BloomLevel.REMEMBER); skillIds.add(skillId); ItemResponse response1 = ItemResponse.builder() .itemId(itemId) .response(1) .skillIds(skillIds) .levelsOfBloomsTaxonomy(levels).build(); - levels = new ArrayList(); - levels.add(LevelOfBloomsTaxonomy.UNDERSTAND); + levels = new ArrayList(); + levels.add(BloomLevel.UNDERSTAND); ItemResponse response2 = ItemResponse.builder() .itemId(itemId2) .response(1) diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 0320edc..5fc45ad 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -3,6 +3,7 @@ spring.datasource.username=root spring.datasource.password=root spring.jpa.hibernate.ddl-auto=create +spring.graphql.schema.locations=classpath*:graphql/common/**/,classpath:graphql/** course_service.url=http://localhost:2001/graphql content_service.url=http://localhost:4001/graphql \ No newline at end of file