Created
September 2, 2016 19:12
-
-
Save fchaillou/453fe7ab621870c78c921c4523f84135 to your computer and use it in GitHub Desktop.
EventStoreJvm bug when fetching metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.UUID | |
import akka.actor.ActorSystem | |
import eventstore.EventStream.Id | |
import eventstore.{Content, EventData, EventStoreExtension, WriteEvents} | |
import scala.concurrent.Await | |
import scala.concurrent.duration.Duration | |
object MetadataBug extends App { | |
implicit val system = ActorSystem() | |
import system.dispatcher | |
val connection = EventStoreExtension(system).connection | |
val uuid = UUID.randomUUID() | |
val streamId = Id(s"test-$uuid") | |
val writeCommand = WriteEvents( | |
streamId = streamId, | |
events = List(EventData("eventType", UUID.randomUUID(), Content.Json("""{"happy" : true}"""))) | |
) | |
val metadataFuture = for { | |
writeCompleted <- connection.future(writeCommand) | |
readMetata <- connection.getStreamMetadata(streamId) | |
} yield readMetata | |
val metadata = Await.result(metadataFuture, Duration.Inf) | |
if(metadata == Content.Empty) { | |
println("ok") | |
} else { | |
println("Unexpected metadata") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment