Skip to content

Commit

Permalink
Update version of jackson dependencies
Browse files Browse the repository at this point in the history
Also, drop redundant explicit transitive dependencies because we don't need them anymore

Note, new version of `jackson-dataformat-yaml` library serialize `Date` objects using quotes (see FasterXML/jackson-dataformats-text#180)
  • Loading branch information
Undin committed Sep 14, 2022
1 parent 12d2c91 commit 5977295
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
13 changes: 2 additions & 11 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ val studioPath: String
return androidStudioPath ?: downloadStudioIfNeededAndGetPath()
}

val jacksonVersion = "2.10.0"
val jacksonVersion = "2.13.4"
val okhttpVersion = "3.14.0"

val ideaSandbox = "${project.buildDir.absolutePath}/idea-sandbox"
Expand Down Expand Up @@ -236,17 +236,8 @@ allprojects {
dependencies {
implementation(group = "org.twitter4j", name = "twitter4j-core", version = "4.0.1")
implementation("org.jsoup:jsoup:1.12.1")
implementation(group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version = jacksonVersion) {
exclude(module = "snakeyaml")
}
implementation(group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version = jacksonVersion)
implementation(group = "com.fasterxml.jackson.datatype", name = "jackson-datatype-jsr310", version = jacksonVersion)

//transitive dependency is specified explicitly to avoid conflict with lib bundled since idea 181
implementation(group = "com.fasterxml.jackson.core", name = "jackson-core", version = jacksonVersion)

//transitive dependency is specified explicitly because of the issue https://github.com/FasterXML/jackson-dataformats-text/issues/81
//intellij platform uses affected snakeyaml version inside
implementation(group = "org.yaml", name = "snakeyaml", version = "1.21")
implementation(group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin", version = jacksonVersion) {
excludeKotlinDeps()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,19 @@ class YamlRemoteDeserializationTest : YamlTestCase() {
assertEquals(attempt, task.attempt)
}

fun `test quited date`() {
val id = 1
val yamlText = """
|id: $id
|update_date: "Thu, 01 Jan 1970 00:00:01 UTC"
|""".trimMargin()

val configFile = createConfigFile(yamlText, REMOTE_COURSE_CONFIG)
val course = YamlDeserializer.deserializeRemoteItem(configFile) as EduCourse
assertEquals(1, course.id)
assertEquals(Date(1000), course.updateDate)
}

private fun createConfigFile(yamlText: String, configName: String): LightVirtualFile {
val configFile = LightVirtualFile(configName)
runWriteAction { VfsUtil.saveText(configFile, yamlText) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class YamlRemoteSerializationTest : YamlTestCase() {
course.updateDate = Date("Fri, 01 Jan 2010 00:00:00 UTC")
doTest(course, """
|id: 1
|update_date: Fri, 01 Jan 2010 00:00:00 UTC
|update_date: "Fri, 01 Jan 2010 00:00:00 UTC"
|default_section: 1
|""".trimMargin())
}
Expand Down Expand Up @@ -57,7 +57,7 @@ class YamlRemoteSerializationTest : YamlTestCase() {
| ide_files: ${hyperskillProject.ideFiles}
| is_template_based: ${hyperskillProject.isTemplateBased}
| use_ide: true
|update_date: Fri, 01 Jan 2010 00:00:00 UTC
|update_date: "Fri, 01 Jan 2010 00:00:00 UTC"
|stages:
|- id: 1
| step: 11
Expand All @@ -84,7 +84,7 @@ class YamlRemoteSerializationTest : YamlTestCase() {
course.updateDate = Date("Fri, 01 Jan 2010 00:00:00 UTC")
doTest(course, """
|id: 1
|update_date: Fri, 01 Jan 2010 00:00:00 UTC
|update_date: "Fri, 01 Jan 2010 00:00:00 UTC"
|""".trimMargin())
}

Expand All @@ -97,7 +97,7 @@ class YamlRemoteSerializationTest : YamlTestCase() {
section.updateDate = Date("Fri, 01 Jan 2010 00:00:00 UTC")
doTest(section, """
|id: 1
|update_date: Fri, 01 Jan 2010 00:00:00 UTC
|update_date: "Fri, 01 Jan 2010 00:00:00 UTC"
|""".trimMargin())
}

Expand Down Expand Up @@ -138,7 +138,7 @@ class YamlRemoteSerializationTest : YamlTestCase() {
task.updateDate = Date("Fri, 01 Jan 2010 00:00:00 UTC")
doTest(task, """
|id: 1
|update_date: Fri, 01 Jan 2010 00:00:00 UTC
|update_date: "Fri, 01 Jan 2010 00:00:00 UTC"
|""".trimMargin())
}

Expand All @@ -152,7 +152,7 @@ class YamlRemoteSerializationTest : YamlTestCase() {
doTest(task, """
|type: dataset
|id: 1
|update_date: Fri, 01 Jan 2010 00:00:00 UTC
|update_date: "Fri, 01 Jan 2010 00:00:00 UTC"
|""".trimMargin())
}

Expand All @@ -170,10 +170,10 @@ class YamlRemoteSerializationTest : YamlTestCase() {
doTest(task, """
|type: dataset
|id: 1
|update_date: Fri, 01 Jan 2010 00:00:00 UTC
|update_date: "Fri, 01 Jan 2010 00:00:00 UTC"
|attempt:
| id: 2
| end_date_time: Thu, 01 Jan 1970 00:05:00 UTC
| end_date_time: "Thu, 01 Jan 1970 00:05:00 UTC"
|""".trimMargin())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class StudentYamlSerializationTest : EduTestCase() {
|status: Failed
|feedback:
| message: $message
| time: Thu, 01 Jan 1970 00:00:00 UTC
| time: "Thu, 01 Jan 1970 00:00:00 UTC"
| expected: $expected
| actual: $actual
|record: 1
Expand All @@ -267,7 +267,7 @@ class StudentYamlSerializationTest : EduTestCase() {
|type: edu
|status: Failed
|feedback:
| time: Thu, 01 Jan 1970 00:00:00 UTC
| time: "Thu, 01 Jan 1970 00:00:00 UTC"
|record: 1
|""".trimMargin())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ class StepikCreateSubmissionTest : StepikBasedCreateSubmissionTest() {
| is_visible: true
| - name: src/Test.kt
| is_visible: false
| edu_task: '{"task":{"name":"Edu problem","stepic_id":1,"status":"Unchecked","files":{"src/Task.kt":{"name":"src/Task.kt","placeholders":[],"is_visible":true,"text":""},"src/Test.kt":{"name":"src/Test.kt","placeholders":[],"is_visible":false,"text":""}},"task_type":"edu"}}'
| edu_task: "{\"task\":{\"name\":\"Edu problem\",\"stepic_id\":1,\"status\":\"Unchecked\"\
| ,\"files\":{\"src/Task.kt\":{\"name\":\"src/Task.kt\",\"placeholders\":[],\"\
| is_visible\":true,\"text\":\"\"},\"src/Test.kt\":{\"name\":\"src/Test.kt\",\"\
| placeholders\":[],\"is_visible\":false,\"text\":\"\"}},\"task_type\":\"edu\"\
| }}"
| version: $JSON_FORMAT_VERSION
|
""".trimMargin())
Expand Down

0 comments on commit 5977295

Please sign in to comment.