@@ -2,7 +2,7 @@ package net.sc8s.elastic.testkit
22
33import akka .actor .testkit .typed .scaladsl .ScalaTestWithActorTestKit
44import akka .actor .typed .scaladsl .adapter .TypedActorSystemOps
5- import cats .implicits .toTraverseOps
5+ import cats .implicits .{ catsStdInstancesForFuture , toTraverseOps }
66import com .sksamuel .elastic4s .ElasticClient
77import com .sksamuel .elastic4s .ElasticDsl ._
88import com .sksamuel .elastic4s .akka .{AkkaHttpClient , AkkaHttpClientSettings }
@@ -11,14 +11,18 @@ import net.sc8s.elastic.{Index, IndexSetup}
1111import org .scalatest .Inspectors .forAll
1212import org .scalatest .{BeforeAndAfterAll , BeforeAndAfterEach , EitherValues , Suite }
1313
14+ import scala .concurrent .{ExecutionContextExecutor , Future }
1415import scala .util .Random
1516
1617trait ElasticIndexTesting extends BeforeAndAfterEach with BeforeAndAfterAll with EitherValues {
1718 _ : Suite with ScalaTestWithActorTestKit =>
1819
1920 val elasticIndices : Set [Index ]
2021
21- implicit lazy val elasticClient = ElasticClient (AkkaHttpClient (AkkaHttpClientSettings ())(system.toClassic))
22+ implicit lazy val elasticClient : ElasticClient [Future ] = {
23+ implicit val executionContext : ExecutionContextExecutor = system.executionContext
24+ ElasticClient (AkkaHttpClient (AkkaHttpClientSettings ())(system.toClassic))
25+ }
2226
2327 implicit lazy val indexSetup : IndexSetup = IndexSetup (
2428 elasticClient,
@@ -34,9 +38,9 @@ trait ElasticIndexTesting extends BeforeAndAfterEach with BeforeAndAfterAll with
3438 // note: refresh,forceMerge didn't help
3539 val recreateIndices = false
3640
37- override protected def beforeAll () = {
41+ override protected def beforeAll (): Unit = {
3842 if (createTemporaryIndices && ! recreateIndices) {
39- implicit val executionContext = system.executionContext
43+ implicit val executionContext : ExecutionContextExecutor = system.executionContext
4044 forAll(elasticIndices.map(index =>
4145 elasticClient.execute(
4246 createIndex(index.name)
@@ -48,9 +52,9 @@ trait ElasticIndexTesting extends BeforeAndAfterEach with BeforeAndAfterAll with
4852 super .beforeAll()
4953 }
5054
51- override protected def beforeEach () = {
55+ override protected def beforeEach (): Unit = {
5256 if (createTemporaryIndices) {
53- implicit val executionContext = system.executionContext
57+ implicit val executionContext : ExecutionContextExecutor = system.executionContext
5458 if (recreateIndices)
5559 forAll(
5660 elasticIndices.map(recreateIndex).toList.sequence.futureValue
@@ -67,7 +71,7 @@ trait ElasticIndexTesting extends BeforeAndAfterEach with BeforeAndAfterAll with
6771 super .beforeEach()
6872 }
6973
70- protected override def afterAll () = {
74+ protected override def afterAll (): Unit = {
7175 if (createTemporaryIndices)
7276 elasticClient.execute(deleteIndex(elasticIndices.map(_.name)))
7377 super .afterAll()
0 commit comments