-
Notifications
You must be signed in to change notification settings - Fork 70
Closed
Description
Issue:
- we have runtime when we need several connections to multiple event stores
- it is impossible to configure via JSON
Solution:
- scheme as in next test
Otherusages:
- one liner connection string from notebook to make streams research more interactive
module Tests
open Equinox.EventStore
open Expecto
open System
type Connector with
static member Connect (uri:Uri, connectionName) =
// TODO: drop proper exception
// TODO: consider what if no : presented
// TODO: consider password contains non url encoded chracters
// TODO: consider ?requestTimeoutMilliseconds= and requestRetries=
let namePassword = uri.UserInfo.Split(":")
let discovery =
match uri.Scheme with
| "uri" -> uri.Host |> Uri |> Discovery.Uri
| "gossipdns" -> uri.Host |> Discovery.GossipDns
let connector = Connector(namePassword.[0], namePassword.[1], TimeSpan.FromSeconds 5., 10)
connector.Connect(connectionName, discovery)
[<Tests>]
let tests =
testList "samples" [
let url = "gossipdns://admin:changeit@localhost:1234?requestTimeoutMilliseconds=5000&requestRetries=10"
test "format" {
let parsed = Uri(url)
Expect.equal parsed.Scheme "gossipdns" "Scheme"
Expect.equal parsed.UserInfo "admin:changeit" "UserPassword"
Expect.equal parsed.Host "localhost" "Host"
}
testAsync "factory1" {
let parsed = Uri(url)
let! connection = Connector.Connect(parsed,"Test")
Expect.isNotNull connection "Created"
}
]
Metadata
Metadata
Assignees
Labels
No labels