| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Test dnsjava in SBT REPL to resolve SRV records:
```scala
import org.xbill.DNS._
scala> new Lookup(s"_imaps._tcp.gmail.com", Type.SRV).run()
// => Array[org.xbill.DNS.Record] = Array(_imaps._tcp.gmail.com. 21599 IN SRV 5 0 993 imap.gmail.com.)
// Note1: Lookup.setResolver(Lookup.getDefaultResolver.setTimeout(..))
def records(name: String): Array[Name] =
// name.count(_ == '.') >= 3
new Lookup(s"_imaps._tcp.${name}", Type.SRV).run().map(_.getAdditionalName)
// TODO: resolvedHosts.forAll(_ endsWith name.parent)
records("gmail.com")
// => Array[org.xbill.DNS.Name] = Array(imap.gmail.com.)
```
Then refactor this as first implementation directly in runnable specs (see UtilSpec).
sbt> testQuick UtilSpec -- include wip
Test in SBT console to list TXT records (as documentation is not crystal clear).
```scala
scala> import org.xbill.DNS._
import org.xbill.DNS._
scala> new Lookup("gmail.com", Type.TXT).run()
=> Array[org.xbill.DNS.Record] = Array(gmail.com. 299 IN TXT "v=spf1 redirect=_spf.google.com")
scala> new Lookup("gmail.com", Type.TXT).run().map(_.rdataToString)
=> Array[String] = Array("v=spf1 redirect=_spf.google.com")
```
Then add `txtRecords` in runnable specification `UtilSpec`.
sbt> testQuick UtilSpec -- include wip
- Move `srvRecords` to package object `reactivemongo.util`, with `resolver` parameter refactored as `timeout`.
- Add scaladoc
- Update `UtilSpec` accordingly.
testOnly UtilSpec -- include wip
- Move `txtRecords` to `reactivemongo.util` with `resolver` parameter refactored as `timeout`.
- Add scaladoc
- Update `UtilSpec` accordingly.
testOnly UtilSpec -- include wip
Refactor functions `srvRecords` and `txtRecords` to return `Future`, with error handling. Also support port in `srvRecords`. Execute `testOnly UtilSpec` with SBT to check there is no regression.
Update the parsing of the options for the connection URI, to be able to change the default values, as `sslEnabled` default value must be enforced when using seed list. Check there is no regression running `testOnly MongoURISpec` in the SBT console.
Update the parsing of the connection URI. - Pass down the flag indicating whether the URI is about a seed list. - Strip the options from the URI when it's parsed, to more easily parse the node set. Make sure there is no regression running `testOnly MongoURISpec` in SBT.
Refactor `srvRecords` to introduce an abstraction over DNS resolution, so that can be later mock, to test the validations specific to seed list, whatever is the underlying SRV resolution. Use it in the parsing of the connection URI if seed list is required. Update and execute the corresponding `UtilSpec`.
Use mock for `SRVResolver` in the runnable specs about URI parsing. Execute `testQuick MongoURISpec` to check there is no regression.
Add test about handling the seed list in the parsing for the connection URI. Run it with SBT using `testOnly MongoURISpec -- include wip` . As this new test detects the `option.sslEnabled` is not forced to true when the URI is specifying seed list, fix it.
Add tests to check erroneous cases from SRV resolution are handled when parsing seed list from a connection URI. Execute `testQuick MongoURISpec` from SBT.
- Update `txtRecords` return type; - Update `UtilSpec` as failing after `txtRecords` changes. Execute `testQuick UtilSpec` in SBT.
Refact `txtRecords` and use it in the parsing of the connection URI, to parse options from TXT records, overridden by values directly in URI, for the options defined in both. Make sure there is no regression running `testQuick MongoURISpec` in SBT.
Refactor `txtRecords` to return a function type, that can later be mock. Execute `testQuick MongoURISpec UtilSpec` with SBT to ensure there is no regression.
Refactor the parsing of the connection URI to pass TXT resolver as parameter. Update the tests and execute them with `testQuick MongoURISpec UtilSpec` in SBT.
Update the tests about seed list to check it's ok with credentials and DB name in the URI.
sbt 'testQuick MongoURISpec'
As it fails, update the parsing to fix it.
Add a test about handling TXT records as option while parsing connection URI. The tests are executed with `testQuick MongoURISpec` using SBT.
CI is failing: https://travis-ci.org/ReactiveMongo/ReactiveMongo/jobs/396612535#L2229 Revert the refactoring of `parseHosts` as `ListSet` order is not compatible between Scala versions.
| Back | FazBrowse Home | New Git URL |
No description provided.