From b0950f84158d62aad7d604de0972dcdb4b0ea8dc Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 7 Apr 2020 12:53:00 +0300 Subject: [PATCH] 0.1.7 release --- build.gradle.kts | 4 ++-- .../kotlin/hep/dataforge/io/FileBinaryTest.kt | 4 +++- .../hep/dataforge/io/tcp/EnvelopeServerTest.kt | 12 +++++++----- .../src/commonMain/kotlin/hep/dataforge/meta/Meta.kt | 9 +++------ .../kotlin/hep/dataforge/meta/serializationUtils.kt | 2 ++ 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 95da230e..d73b0e60 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,12 @@ plugins { - val toolsVersion = "0.4.1" + val toolsVersion = "0.4.2" id("scientifik.mpp") version toolsVersion apply false id("scientifik.jvm") version toolsVersion apply false id("scientifik.publish") version toolsVersion apply false } -val dataforgeVersion by extra("0.1.6-dev-2") +val dataforgeVersion by extra("0.1.7") val bintrayRepo by extra("dataforge") val githubProject by extra("dataforge-core") diff --git a/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/FileBinaryTest.kt b/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/FileBinaryTest.kt index 685342cf..7ccc65e7 100644 --- a/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/FileBinaryTest.kt +++ b/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/FileBinaryTest.kt @@ -1,6 +1,7 @@ package hep.dataforge.io import hep.dataforge.context.Global +import hep.dataforge.meta.DFExperimental import kotlinx.io.asBinary import kotlinx.io.toByteArray import kotlinx.io.writeDouble @@ -46,6 +47,7 @@ class FileBinaryTest { } + @DFExperimental @Test fun testFileDataSizeRewriting() { println(System.getProperty("user.dir")) @@ -53,6 +55,6 @@ class FileBinaryTest { Global.io.writeEnvelopeFile(tmpPath, envelope) val binary = Global.io.readEnvelopeFile(tmpPath)?.data!! - assertEquals(binary.size.toInt(), binary.toByteArray().size) + assertEquals(binary.size, binary.toByteArray().size) } } \ No newline at end of file diff --git a/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/tcp/EnvelopeServerTest.kt b/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/tcp/EnvelopeServerTest.kt index 3e545421..48c108d4 100644 --- a/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/tcp/EnvelopeServerTest.kt +++ b/dataforge-io/src/jvmTest/kotlin/hep/dataforge/io/tcp/EnvelopeServerTest.kt @@ -8,8 +8,9 @@ import hep.dataforge.io.toByteArray import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.runBlocking import kotlinx.io.writeDouble -import org.junit.AfterClass -import org.junit.BeforeClass +import org.junit.jupiter.api.AfterAll +import org.junit.jupiter.api.BeforeAll +import org.junit.jupiter.api.Timeout import kotlin.test.Test import kotlin.test.assertEquals import kotlin.time.ExperimentalTime @@ -31,20 +32,21 @@ class EnvelopeServerTest { @JvmStatic val echoEnvelopeServer = EnvelopeServer(Global, 7778, EchoResponder, GlobalScope) - @BeforeClass + @BeforeAll @JvmStatic fun start() { echoEnvelopeServer.start() } - @AfterClass + @AfterAll @JvmStatic fun close() { echoEnvelopeServer.stop() } } - @Test(timeout = 1000) + @Test + @Timeout(1) fun doEchoTest() { val request = Envelope { type = "test.echo" diff --git a/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/Meta.kt b/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/Meta.kt index 1afbb183..9650b04e 100644 --- a/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/Meta.kt +++ b/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/Meta.kt @@ -98,7 +98,9 @@ interface Meta : MetaRepr { */ const val VALUE_KEY = "@value" - val EMPTY = EmptyMeta + val EMPTY: Meta = object: MetaBase() { + override val items: Map> = emptyMap() + } } } @@ -216,11 +218,6 @@ fun MetaItem<*>.seal(): MetaItem = when (this) { is NodeItem -> NodeItem(node.seal()) } -@Deprecated("Use Meta.EMPTY instead", replaceWith = ReplaceWith("Meta.EMPTY")) -object EmptyMeta : MetaBase() { - override val items: Map> = emptyMap() -} - /** * Unsafe methods to access values and nodes directly from [MetaItem] */ diff --git a/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/serializationUtils.kt b/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/serializationUtils.kt index 41c33c7c..f06bb06a 100644 --- a/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/serializationUtils.kt +++ b/dataforge-meta/src/commonMain/kotlin/hep/dataforge/meta/serializationUtils.kt @@ -66,5 +66,7 @@ inline fun Encoder.encodeStructure( encoder.endStructure(desc) } +@OptIn(UnstableDefault::class) val JSON_PRETTY = Json(JsonConfiguration(prettyPrint = true, useArrayPolymorphism = true)) +@OptIn(UnstableDefault::class) val JSON_PLAIN = Json(JsonConfiguration(prettyPrint = true, useArrayPolymorphism = true)) \ No newline at end of file