From d5719438ed9a93c4035262fa8bd94ee60eead048 Mon Sep 17 00:00:00 2001 From: Diego Date: Tue, 22 Aug 2017 11:56:12 -0300 Subject: move kamon.context.SimpleStringCodec to kamon.testkit.SimpleStringCodec in order to avoid java.lang.ClassNotFoundException: kamon.context.SimpleStringCodec in tests --- .../scala/kamon/context/ContextCodecSpec.scala | 42 +--------------------- 1 file changed, 1 insertion(+), 41 deletions(-) (limited to 'kamon-core-tests/src') diff --git a/kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala b/kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala index ceac4e58..ab71814f 100644 --- a/kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala +++ b/kamon-core-tests/src/test/scala/kamon/context/ContextCodecSpec.scala @@ -1,7 +1,5 @@ package kamon.context -import java.nio.ByteBuffer - import kamon.Kamon import kamon.testkit.ContextTesting import org.scalatest.{Matchers, OptionValues, WordSpec} @@ -69,42 +67,4 @@ class ContextCodecSpec extends WordSpec with Matchers with ContextTesting with O } val ContextCodec = new Codecs(Kamon.config()) -} - -object SimpleStringCodec { - final class Headers extends Codecs.ForEntry[TextMap] { - private val dataKey = "X-String-Value" - - override def encode(context: Context): TextMap = { - val textMap = TextMap.Default() - context.get(ContextTesting.StringBroadcastKey).foreach { value => - textMap.put(dataKey, value) - } - - textMap - } - - override def decode(carrier: TextMap, context: Context): Context = { - carrier.get(dataKey) match { - case value @ Some(_) => context.withKey(ContextTesting.StringBroadcastKey, value) - case None => context - } - } - } - - final class Binary extends Codecs.ForEntry[ByteBuffer] { - val emptyBuffer = ByteBuffer.allocate(0) - - override def encode(context: Context): ByteBuffer = { - context.get(ContextTesting.StringBroadcastKey) match { - case Some(value) => ByteBuffer.wrap(value.getBytes) - case None => emptyBuffer - } - } - - override def decode(carrier: ByteBuffer, context: Context): Context = { - context.withKey(ContextTesting.StringBroadcastKey, Some(new String(carrier.array()))) - } - } - -} +} \ No newline at end of file -- cgit v1.2.3