<commit_before>package uk.ac.wellcome.platform.idminter.fixtures

import io.circe.Json
import scalikejdbc.{ConnectionPool, DB}
import uk.ac.wellcome.messaging.test.fixtures.SNS.Topic
import uk.ac.wellcome.messaging.test.fixtures.SQS.Queue
import uk.ac.wellcome.messaging.test.fixtures.{Messaging, SNS}
import uk.ac.wellcome.monitoring.fixtures.MetricsSenderFixture
import uk.ac.wellcome.platform.idminter.config.models.IdentifiersTableConfig
import uk.ac.wellcome.platform.idminter.database.IdentifiersDao
import uk.ac.wellcome.platform.idminter.models.IdentifiersTable
import uk.ac.wellcome.platform.idminter.services.IdMinterWorkerService
import uk.ac.wellcome.platform.idminter.steps.{IdEmbedder, IdentifierGenerator}
import uk.ac.wellcome.storage.fixtures.S3.Bucket
import uk.ac.wellcome.test.fixtures.{Akka, TestWith}

import scala.concurrent.ExecutionContext.Implicits.global

trait WorkerServiceFixture
    extends Akka
    with IdentifiersDatabase
    with Messaging
    with MetricsSenderFixture
    with SNS {
  def withWorkerService[R](bucket: Bucket,
                           topic: Topic,
                           queue: Queue,
                           identifiersDao: IdentifiersDao,
                           identifiersTableConfig: IdentifiersTableConfig)(
    testWith: TestWith[IdMinterWorkerService, R]): R =
    withActorSystem { actorSystem =>
      withMetricsSender(actorSystem) { metricsSender =>
        withMessageWriter[Json, R](bucket, topic, snsClient) { messageWriter =>
          withMessageStream[Json, R](actorSystem, queue, metricsSender) {
            messageStream =>
              val workerService = new IdMinterWorkerService(
                idEmbedder = new IdEmbedder(
                  identifierGenerator = new IdentifierGenerator(
                    identifiersDao = identifiersDao
                  )
                ),
                writer = messageWriter,<commit_msg>actorSystem is passed implicitly here<commit_after>package uk.ac.wellcome.platform.idminter.fixtures

import io.circe.Json
import scalikejdbc.{ConnectionPool, DB}
import uk.ac.wellcome.messaging.test.fixtures.SNS.Topic
import uk.ac.wellcome.messaging.test.fixtures.SQS.Queue
import uk.ac.wellcome.messaging.test.fixtures.{Messaging, SNS}
import uk.ac.wellcome.monitoring.fixtures.MetricsSenderFixture
import uk.ac.wellcome.platform.idminter.config.models.IdentifiersTableConfig
import uk.ac.wellcome.platform.idminter.database.IdentifiersDao
import uk.ac.wellcome.platform.idminter.models.IdentifiersTable
import uk.ac.wellcome.platform.idminter.services.IdMinterWorkerService
import uk.ac.wellcome.platform.idminter.steps.{IdEmbedder, IdentifierGenerator}
import uk.ac.wellcome.storage.fixtures.S3.Bucket
import uk.ac.wellcome.test.fixtures.{Akka, TestWith}

import scala.concurrent.ExecutionContext.Implicits.global

trait WorkerServiceFixture
    extends Akka
    with IdentifiersDatabase
    with Messaging
    with MetricsSenderFixture
    with SNS {
  def withWorkerService[R](bucket: Bucket,
                           topic: Topic,
                           queue: Queue,
                           identifiersDao: IdentifiersDao,
                           identifiersTableConfig: IdentifiersTableConfig)(
    testWith: TestWith[IdMinterWorkerService, R]): R =
    withActorSystem { implicit actorSystem =>
      withMetricsSender(actorSystem) { metricsSender =>
        withMessageWriter[Json, R](bucket, topic, snsClient) { messageWriter =>
          withMessageStream[Json, R](queue, metricsSender) {
            messageStream =>
              val workerService = new IdMinterWorkerService(
                idEmbedder = new IdEmbedder(
                  identifierGenerator = new IdentifierGenerator(
                    identifiersDao = identifiersDao
                  )
                ),
                writer = messageWriter,
{'fraction_non_alphanumeric': 0.08040330920372285, 'fraction_numerical': 0.000517063081695967, 'mean_word_length': 3.0176531671858773, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '382776', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1075, 'n_words': 181}