diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/apirequest/ApiRequestEnrichment.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/apirequest/ApiRequestEnrichment.scala index 2431dc47f..65f24b2cd 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/apirequest/ApiRequestEnrichment.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/apirequest/ApiRequestEnrichment.scala @@ -17,9 +17,8 @@ package apirequest import java.util.UUID -import cats.{Eval, Id, Monad} +import cats.{Id, Monad} import cats.data.{EitherT, NonEmptyList, ValidatedNel} -import cats.effect.Sync import cats.implicits._ import com.snowplowanalytics.iglu.core.{SchemaCriterion, SchemaKey, SelfDescribingData} @@ -215,45 +214,6 @@ sealed trait CreateApiRequestEnrichment[F[_]] { object CreateApiRequestEnrichment { def apply[F[_]](implicit ev: CreateApiRequestEnrichment[F]): CreateApiRequestEnrichment[F] = ev - implicit def syncCreateApiRequestEnrichment[F[_]: Sync: HttpClient]( - implicit CLM: CreateLruMap[F, String, (Either[Throwable, Json], Long)] - ): CreateApiRequestEnrichment[F] = - new CreateApiRequestEnrichment[F] { - override def create(conf: ApiRequestConf): F[ApiRequestEnrichment[F]] = - CLM - .create(conf.cache.size) - .map(c => - ApiRequestEnrichment( - conf.schemaKey, - conf.inputs, - conf.api, - conf.outputs, - conf.cache.ttl, - c - ) - ) - } - - implicit def evalCreateApiRequestEnrichment( - implicit CLM: CreateLruMap[Eval, String, (Either[Throwable, Json], Long)], - HTTP: HttpClient[Eval] - ): CreateApiRequestEnrichment[Eval] = - new CreateApiRequestEnrichment[Eval] { - override def create(conf: ApiRequestConf): Eval[ApiRequestEnrichment[Eval]] = - CLM - .create(conf.cache.size) - .map(c => - ApiRequestEnrichment( - conf.schemaKey, - conf.inputs, - conf.api, - conf.outputs, - conf.cache.ttl, - c - ) - ) - } - implicit def idCreateApiRequestEnrichment( implicit CLM: CreateLruMap[Id, String, (Either[Throwable, Json], Long)], HTTP: HttpClient[Id] diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/SpecHelpers.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/SpecHelpers.scala index 486415968..d0f147d5d 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/SpecHelpers.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/SpecHelpers.scala @@ -12,7 +12,7 @@ */ package com.snowplowanalytics.snowplow.enrich.common -import cats.Eval +import cats.Id import cats.implicits._ import com.snowplowanalytics.iglu.client.Client import com.snowplowanalytics.iglu.core.SelfDescribingData @@ -57,9 +57,8 @@ object SpecHelpers { }""" /** Builds an Iglu client from the above Iglu configuration. */ - val client: Client[Eval, Json] = Client - .parseDefault[Eval](igluConfig) - .value + val client: Client[Id, Json] = Client + .parseDefault[Id](igluConfig) .value .getOrElse(throw new RuntimeException("invalid resolver configuration")) diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/CallrailAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/CallrailAdapterSpec.scala index 97d9385ca..702213bde 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/CallrailAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/CallrailAdapterSpec.scala @@ -14,9 +14,10 @@ package com.snowplowanalytics.snowplow.enrich.common package adapters package registry -import cats.Eval +import cats.Id import cats.data.NonEmptyList import cats.syntax.option._ + import com.snowplowanalytics.iglu.client.resolver.registries.RegistryLookup._ import com.snowplowanalytics.snowplow.badrows._ import org.joda.time.DateTime @@ -96,7 +97,7 @@ class CallrailAdapterSpec extends Specification with DataTables with ValidatedMa "nuid" -> "-" ) val payload = CollectorPayload(Shared.api, params, None, None, Shared.source, Shared.context) - val actual = CallrailAdapter.toRawEvents[Eval](payload, SpecHelpers.client).value + val actual = CallrailAdapter.toRawEvents[Id](payload, SpecHelpers.client) val expectedJson = """|{ @@ -159,7 +160,7 @@ class CallrailAdapterSpec extends Specification with DataTables with ValidatedMa def e2 = { val params = toNameValuePairs() val payload = CollectorPayload(Shared.api, params, None, None, Shared.source, Shared.context) - val actual = CallrailAdapter.toRawEvents[Eval](payload, SpecHelpers.client).value + val actual = CallrailAdapter.toRawEvents[Id](payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/CloudfrontAccessLogAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/CloudfrontAccessLogAdapterSpec.scala index 10f27a656..aac2f9a7a 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/CloudfrontAccessLogAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/CloudfrontAccessLogAdapterSpec.scala @@ -85,7 +85,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with val payload = loader.toCollectorPayload(input, processor) val actual = payload.map( - _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client).value) + _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client)) ) val expectedJson = @@ -133,7 +133,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with val payload = loader.toCollectorPayload(input, processor) val actual = payload.map( - _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client).value) + _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client)) ) val expectedJson = @@ -184,7 +184,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with val payload = loader.toCollectorPayload(input, processor) val actual = payload.map( - _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client).value) + _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client)) ) val expectedJson = @@ -238,7 +238,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with val payload = loader.toCollectorPayload(input, processor) val actual = payload.map( - _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client).value) + _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client)) ) val expectedJson = @@ -293,7 +293,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with val payload = loader.toCollectorPayload(input, processor) val actual = payload.map( - _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client).value) + _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client)) ) val expectedJson = @@ -352,7 +352,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with val payload = loader.toCollectorPayload(input, processor) val actual = payload.map( - _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client).value) + _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client)) ) val expectedJson = @@ -412,7 +412,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with val payload = loader.toCollectorPayload(input, processor) val actual = payload.map( - _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client).value) + _.map(CloudfrontAccessLogAdapter.toRawEvents(_, SpecHelpers.client)) ) val expectedJson = @@ -478,7 +478,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with Shared.source, Shared.context ) - val actual = CloudfrontAccessLogAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = CloudfrontAccessLogAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList @@ -503,7 +503,7 @@ class CloudfrontAccessLogAdapterSpec extends Specification with DataTables with Shared.source, Shared.context ) - val actual = CloudfrontAccessLogAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = CloudfrontAccessLogAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.of( diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/GoogleAnalyticsAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/GoogleAnalyticsAdapterSpec.scala index 96519c7d7..2fd29dd21 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/GoogleAnalyticsAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/GoogleAnalyticsAdapterSpec.scala @@ -76,7 +76,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e1 = { val payload = CollectorPayload(api, Nil, None, None, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData("body", None, "empty body") @@ -87,7 +87,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e2 = { val body = "dl=docloc" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( @@ -102,7 +102,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e3 = { val body = "t=unknown&dl=docloc" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.of( FailureDetails.AdapterFailure @@ -119,7 +119,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e4 = { val body = "t=pageview&dh=host&dp=path" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedJson = """|{ @@ -144,7 +144,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e5 = { val body = "t=pageview&dh=host&cid=id&v=version" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -174,7 +174,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e6 = { val body = "t=pageview&dp=path&uip=ip" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -200,7 +200,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e7 = { val body = "t=item&in=name&ip=12.228&iq=12&aip=0" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -236,7 +236,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e8 = { val body = "t=exception&exd=desc&exf=1&dh=host" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -261,7 +261,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e9 = { val body = "t=transaction&ti=tr&cu=EUR&pr12id=ident&pr12cd42=val" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -294,7 +294,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e10 = { val body = "t=pageview&dp=path&il12pi42id=s&il12pi42cd36=dim" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -322,7 +322,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e11 = { val body = "t=screenview&cd=name&cd12=dim" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -347,7 +347,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e12 = { val body = "t=pageview&dp=path&pr1id=s1&pr2id=s2&pr1cd1=v1&pr1cd2=v2" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -381,7 +381,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e13 = { val body = "t=pageview&dp=path&promoa=action&promo12id=id" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedUE = """|{ @@ -409,7 +409,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali def e14 = { val body = "t=pageview&dh=host&dp=path\nt=pageview&dh=host&dp=path" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedJson = """|{ @@ -436,7 +436,7 @@ class GoogleAnalyticsAdapterSpec extends Specification with DataTables with Vali val body = "t=pageview&dh=host&dp=path&cu=EUR&il1pi1pr=1&il1pi1nm=name1&il1pi1ps=1&il1pi1ca=cat1&il1pi1id=id1&il1pi1br=brand1&il1pi2pr=2&il1pi2nm=name2&il1pi2ps=2&il1pi2ca=cat2&il1pi2id=id2&il1pi2br=brand2&il2pi1pr=21&il2pi1nm=name21&il2pi1ps=21&il2pi1ca=cat21&il2pi1id=id21&il2pi1br=brand21" val payload = CollectorPayload(api, Nil, None, body.some, source, context) - val actual = toRawEvents(payload, SpecHelpers.client).value + val actual = toRawEvents(payload, SpecHelpers.client) val expectedJson = """|{ diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/HubSpotAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/HubSpotAdapterSpec.scala index 62d93eed4..460b98f3e 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/HubSpotAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/HubSpotAdapterSpec.scala @@ -97,7 +97,7 @@ class HubSpotAdapterSpec extends Specification with DataTables with ValidatedMat Shared.context ) ) - HubSpotAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + HubSpotAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e4 = { @@ -116,7 +116,7 @@ class HubSpotAdapterSpec extends Specification with DataTables with ValidatedMat HubSpotAdapter.EventSchemaMap, "no schema associated with the provided type parameter at index 0" ) - HubSpotAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + HubSpotAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one(expected) ) } @@ -124,7 +124,7 @@ class HubSpotAdapterSpec extends Specification with DataTables with ValidatedMat def e5 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - HubSpotAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + HubSpotAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: not events to process") @@ -135,7 +135,7 @@ class HubSpotAdapterSpec extends Specification with DataTables with ValidatedMat def e6 = { val payload = CollectorPayload(Shared.api, Nil, None, "stub".some, Shared.cljSource, Shared.context) - HubSpotAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + HubSpotAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -156,7 +156,7 @@ class HubSpotAdapterSpec extends Specification with DataTables with ValidatedMat Shared.cljSource, Shared.context ) - HubSpotAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + HubSpotAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("contentType", ct, "expected application/json") diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/IgluAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/IgluAdapterSpec.scala index f7e31ecf3..2c776553d 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/IgluAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/IgluAdapterSpec.scala @@ -80,7 +80,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche "ad_unit" -> "" ) val payload = CollectorPayload(Shared.api, params, None, None, Shared.cfSource, Shared.context) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expectedJson = """|{ @@ -122,7 +122,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche "aid" -> "webhooks" ) val payload = CollectorPayload(Shared.api, params, None, None, Shared.cfSource, Shared.context) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expectedMap = { val json = @@ -165,7 +165,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche "nuid" -> "" ) val payload = CollectorPayload(Shared.api, params, None, None, Shared.cljSource, Shared.context) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expectedMap = { val json = @@ -205,7 +205,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche "p" -> "mob" ) val payload = CollectorPayload(Shared.api, params, None, None, Shared.cfSource, Shared.context) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expectedJson = """|{ @@ -235,7 +235,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche def e5 = { val params = SpecHelpers.toNameValuePairs() val payload = CollectorPayload(Shared.api, params, None, None, Shared.cfSource, Shared.context) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.of( @@ -252,7 +252,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche "p" -> "mob" ) val payload = CollectorPayload(Shared.api, params, None, None, Shared.cfSource, Shared.context) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.of( @@ -268,7 +268,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche "schema" -> "iglooooooo://blah" ) val payload = CollectorPayload(Shared.api, params, None, None, Shared.cfSource, Shared.context) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList @@ -295,7 +295,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expected = RawEvent( Shared.api, @@ -329,7 +329,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expected = FailureDetails.AdapterFailure.InputData( "contentType", @@ -355,7 +355,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( @@ -374,7 +374,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche val jsonStr = """{"key":"value"}""" val payload = CollectorPayload(Shared.api, params, None, jsonStr.some, Shared.cljSource, Shared.context) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( @@ -400,7 +400,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expected = RawEvent( Shared.api, @@ -431,7 +431,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( @@ -456,7 +456,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( @@ -481,7 +481,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expected = RawEvent( Shared.api, @@ -516,7 +516,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) val expected = RawEvent( Shared.api, @@ -550,7 +550,7 @@ class IgluAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.cljSource, Shared.context ) - val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = IgluAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MailchimpAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MailchimpAdapterSpec.scala index edcace1e3..88c92c9e2 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MailchimpAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MailchimpAdapterSpec.scala @@ -142,7 +142,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM |} |}""".stripMargin.replaceAll("[\n\r]", "") - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -183,7 +183,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM |} |}""".stripMargin.replaceAll("[\n\r]", "") - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -216,7 +216,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM ) val expectedJson = "{\"schema\":\"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0\",\"data\":{\"schema\":\"" + expected + "\",\"data\":{\"type\":\"" + schema + "\"}}}" - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -251,7 +251,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM Shared.cljSource, Shared.context ) - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid(NonEmptyList.one(expected)) } @@ -294,7 +294,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM |} |}""".stripMargin.replaceAll("[\n\r]", "") - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -317,7 +317,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM def e11 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure @@ -329,7 +329,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM def e12 = { val payload = CollectorPayload(Shared.api, Nil, None, "stub".some, Shared.cljSource, Shared.context) - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( @@ -350,7 +350,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM Shared.cljSource, Shared.context ) - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( @@ -372,7 +372,7 @@ class MailchimpAdapterSpec extends Specification with DataTables with ValidatedM Shared.cljSource, Shared.context ) - val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = MailchimpAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MailgunAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MailgunAdapterSpec.scala index b303de801..01209c1a9 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MailgunAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MailgunAdapterSpec.scala @@ -96,7 +96,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat Shared.context ) ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e2 = { @@ -145,7 +145,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat Shared.context ) ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e3 = { @@ -195,7 +195,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat Shared.context ) ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e4 = { @@ -245,7 +245,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat Shared.context ) ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e5 = { @@ -292,13 +292,13 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat Shared.context ) ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e6 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") @@ -310,7 +310,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat val body = "body" val payload = CollectorPayload(Shared.api, Nil, None, body.some, Shared.cljSource, Shared.context) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -326,7 +326,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat val ct = "application/json" val payload = CollectorPayload(Shared.api, Nil, ct.some, body.some, Shared.cljSource, Shared.context) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -352,7 +352,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e10 = { @@ -373,7 +373,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat "could not parse body: Illegal character in query at index 261: http://localhost/?X-MailgunSid=WyIxZjQzMiIsICJyb25ueUBrZGUub3JnIiwgIjliMjYwIl0%3D&event=delivered×tamp=1467040750&token=c2fc6a36198fa651243afb6042867b7490e480843198008c6b&signature=9387fb0e5ff02de5e159594173f02c95c55d7e681b40a7b930ed4d0a3cbbdd6e&recipient=<>" ) ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e11 = { @@ -394,7 +394,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat "no `event` parameter provided: cannot determine event type" ) ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e12 = { @@ -415,7 +415,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat "no schema associated with the provided type parameter" ) ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e13 = { @@ -434,7 +434,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat FailureDetails.AdapterFailure .InputData("timestamp", None, "missing 'timestamp'") ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e14 = { @@ -451,7 +451,7 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat val expected = NonEmptyList.one( FailureDetails.AdapterFailure.InputData("token", None, "missing 'token'") ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e15 = { @@ -470,6 +470,6 @@ class MailgunAdapterSpec extends Specification with DataTables with ValidatedMat FailureDetails.AdapterFailure .InputData("signature", None, "missing 'signature'") ) - MailgunAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + MailgunAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MandrillAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MandrillAdapterSpec.scala index 6d85f05c7..0996ccfca 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MandrillAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MandrillAdapterSpec.scala @@ -212,7 +212,7 @@ class MandrillAdapterSpec extends Specification with DataTables with ValidatedMa Shared.context ) ) - MandrillAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + MandrillAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e5 = { // Spec for nine seperate events where two have incorrect event names and one does not have event as a parameter @@ -243,13 +243,13 @@ class MandrillAdapterSpec extends Specification with DataTables with ValidatedMa "cannot determine event type: type parameter not provided at index 2" ) ) - MandrillAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + MandrillAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e6 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - MandrillAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + MandrillAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") @@ -261,7 +261,7 @@ class MandrillAdapterSpec extends Specification with DataTables with ValidatedMa val body = "mandrill_events=%5B%7B%22event%22%3A%20%22subscribe%22%7D%5D" val payload = CollectorPayload(Shared.api, Nil, None, body.some, Shared.cljSource, Shared.context) - MandrillAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + MandrillAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -277,7 +277,7 @@ class MandrillAdapterSpec extends Specification with DataTables with ValidatedMa val ct = "application/x-www-form-urlencoded; charset=utf-8".some val payload = CollectorPayload(Shared.api, Nil, ct, body.some, Shared.cljSource, Shared.context) - MandrillAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + MandrillAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("contentType", ct, "expected application/x-www-form-urlencoded") diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MarketoAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MarketoAdapterSpec.scala index a9060590e..fa753f28d 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MarketoAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/MarketoAdapterSpec.scala @@ -70,13 +70,13 @@ class MarketoAdapterSpec extends Specification with DataTables with ValidatedMat Shared.context ) ) - MarketoAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + MarketoAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e2 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - MarketoAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + MarketoAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/OlarkAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/OlarkAdapterSpec.scala index 1e0d5c93b..bb24ed646 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/OlarkAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/OlarkAdapterSpec.scala @@ -140,7 +140,7 @@ class OlarkAdapterSpec extends Specification with DataTables with ValidatedMatch Shared.context ) ) - OlarkAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + OlarkAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e2 = { @@ -204,13 +204,13 @@ class OlarkAdapterSpec extends Specification with DataTables with ValidatedMatch Shared.context ) ) - OlarkAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + OlarkAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e3 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - OlarkAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + OlarkAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") @@ -223,7 +223,7 @@ class OlarkAdapterSpec extends Specification with DataTables with ValidatedMatch "data=%7B%22kind%22%3A%20%22Conversation%22%2C%20%22tags%22%3A%20%5B%22olark%22%2C%20%22customer%22%5D%2C%20%22items%22%3A%20%5B%7B%22body%22%3A%20%22Hi%20there.%20Need%20any%20help%3F%22%2C%20%22timestamp%22%3A%20%221307116657.1%22%2C%20%22kind%22%3A%20%22MessageToVisitor%22%2C%20%22nickname%22%3A%20%22John%22%2C%20%22operatorId%22%3A%20%221234%22%7D%2C%20%7B%22body%22%3A%20%22Yes%2C%20please%20help%20me%20with%20billing.%22%2C%20%22timestamp%22%3A%20%221307116661.25%22%2C%20%22kind%22%3A%20%22MessageToOperator%22%2C%20%22nickname%22%3A%20%22Bob%22%7D%5D%2C%20%22operators%22%3A%20%7B%221234%22%3A%20%7B%22username%22%3A%20%22jdoe%22%2C%20%22emailAddress%22%3A%20%22john%40example.com%22%2C%20%22kind%22%3A%20%22Operator%22%2C%20%22nickname%22%3A%20%22John%22%2C%20%22id%22%3A%20%221234%22%7D%7D%2C%20%22groups%22%3A%20%5B%7B%22kind%22%3A%20%22Group%22%2C%20%22name%22%3A%20%22My%20Sales%20Group%22%2C%20%22id%22%3A%20%220123456789abcdef%22%7D%5D%2C%20%22visitor%22%3A%20%7B%22ip%22%3A%20%22123.4.56.78%22%2C%20%22city%22%3A%20%22Palo%20Alto%22%2C%20%22kind%22%3A%20%22Visitor%22%2C%20%22conversationBeginPage%22%3A%20%22http%3A%2F%2Fwww.example.com%2Fpath%22%2C%20%22countryCode%22%3A%20%22US%22%2C%20%22country%22%3A%20%22United%20State%22%2C%20%22region%22%3A%20%22CA%22%2C%20%22chat_feedback%22%3A%20%7B%22overall_chat%22%3A%205%2C%20%22responsiveness%22%3A%205%2C%20%22friendliness%22%3A%205%2C%20%22knowledge%22%3A%205%2C%20%22comments%22%3A%20%22Very%20helpful%2C%20thanks%22%7D%2C%20%22operatingSystem%22%3A%20%22Windows%22%2C%20%22emailAddress%22%3A%20%22bob%40example.com%22%2C%20%22organization%22%3A%20%22Widgets%20Inc.%22%2C%20%22phoneNumber%22%3A%20%22%28555%29%20555-5555%22%2C%20%22fullName%22%3A%20%22Bob%20Doe%22%2C%20%22customFields%22%3A%20%7B%22favoriteColor%22%3A%20%22blue%22%2C%20%22myInternalCustomerId%22%3A%20%2212341234%22%7D%2C%20%22id%22%3A%20%229QRF9YWM5XW3ZSU7P9CGWRU89944341%22%2C%20%22browser%22%3A%20%22Chrome%2012.1%22%7D%2C%20%22id%22%3A%20%22EV695BI2930A6XMO32886MPT899443414%22%7D" val payload = CollectorPayload(Shared.api, Nil, None, body.some, Shared.cljSource, Shared.context) - OlarkAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + OlarkAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -240,7 +240,7 @@ class OlarkAdapterSpec extends Specification with DataTables with ValidatedMatch val ct = "application/json" val payload = CollectorPayload(Shared.api, Nil, ct.some, body.some, Shared.cljSource, Shared.context) - OlarkAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + OlarkAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -266,7 +266,7 @@ class OlarkAdapterSpec extends Specification with DataTables with ValidatedMatch FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") ) - OlarkAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + OlarkAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e7 = { @@ -283,7 +283,7 @@ class OlarkAdapterSpec extends Specification with DataTables with ValidatedMatch val expected = NonEmptyList.one( FailureDetails.AdapterFailure.InputData("data", None, "missing 'data' field") ) - OlarkAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + OlarkAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e8 = { @@ -297,7 +297,7 @@ class OlarkAdapterSpec extends Specification with DataTables with ValidatedMatch Shared.cljSource, Shared.context ) - OlarkAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid.like { + OlarkAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid.like { case nel => nel.size must_== 1 nel.head must haveClass[FailureDetails.AdapterFailure.NotJson] diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/PagerdutyAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/PagerdutyAdapterSpec.scala index 8cae96443..61573c9d5 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/PagerdutyAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/PagerdutyAdapterSpec.scala @@ -133,7 +133,7 @@ class PagerdutyAdapterSpec extends Specification with DataTables with ValidatedM Shared.context ) ) - PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e7 = { @@ -152,7 +152,7 @@ class PagerdutyAdapterSpec extends Specification with DataTables with ValidatedM PagerdutyAdapter.EventSchemaMap, "no schema associated with the provided type parameter at index 0" ) - PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one(expected) ) } @@ -160,7 +160,7 @@ class PagerdutyAdapterSpec extends Specification with DataTables with ValidatedM def e8 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") @@ -171,7 +171,7 @@ class PagerdutyAdapterSpec extends Specification with DataTables with ValidatedM def e9 = { val payload = CollectorPayload(Shared.api, Nil, None, "stub".some, Shared.cljSource, Shared.context) - PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -192,7 +192,7 @@ class PagerdutyAdapterSpec extends Specification with DataTables with ValidatedM Shared.cljSource, Shared.context ) - PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + PagerdutyAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("contentType", ct, "expected application/json") diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/PingdomAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/PingdomAdapterSpec.scala index daa0dbffc..2272bf37a 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/PingdomAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/PingdomAdapterSpec.scala @@ -89,7 +89,7 @@ class PingdomAdapterSpec extends Specification with DataTables with ValidatedMat Shared.cljSource, Shared.context ) - PingdomAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid( + PingdomAdapter.toRawEvents(payload, SpecHelpers.client) must beValid( NonEmptyList.one(expected) ) } @@ -102,7 +102,7 @@ class PingdomAdapterSpec extends Specification with DataTables with ValidatedMat None, "empty querystring: no events to process" ) - PingdomAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + PingdomAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one(expected) ) } @@ -117,7 +117,7 @@ class PingdomAdapterSpec extends Specification with DataTables with ValidatedMat "p=apps".some, "no `message` parameter provided" ) - PingdomAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + PingdomAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one(expected) ) } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/RemoteAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/RemoteAdapterSpec.scala index d36e79091..4ca4ef5da 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/RemoteAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/RemoteAdapterSpec.scala @@ -196,7 +196,7 @@ class RemoteAdapterSpec extends Specification with ValidatedMatchers { ) } - val they = testAdapter.toRawEvents(payload, SpecHelpers.client).value + val they = testAdapter.toRawEvents(payload, SpecHelpers.client) they must beValid(expected) } @@ -210,7 +210,7 @@ class RemoteAdapterSpec extends Specification with ValidatedMatchers { "empty body: not a valid remote adapter http://localhost:8091/myEnrichment payload" ) ) - testAdapter.toRawEvents(emptyListPayload, SpecHelpers.client).value must beInvalid(expected) + testAdapter.toRawEvents(emptyListPayload, SpecHelpers.client) must beInvalid(expected) } def e3 = { @@ -223,7 +223,7 @@ class RemoteAdapterSpec extends Specification with ValidatedMatchers { "empty body: not a valid remote adapter http://localhost:8091/myEnrichment payload" ) ) - testAdapter.toRawEvents(bodylessPayload, SpecHelpers.client).value must beInvalid(expected) + testAdapter.toRawEvents(bodylessPayload, SpecHelpers.client) must beInvalid(expected) } def e4 = { diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/SendgridAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/SendgridAdapterSpec.scala index 6b3427491..0e59562e2 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/SendgridAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/SendgridAdapterSpec.scala @@ -221,7 +221,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - val actual = SendgridAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = SendgridAdapter.toRawEvents(payload, SpecHelpers.client) "return the correct number of events" in { actual must beValid @@ -265,7 +265,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { "reject empty bodies" in { val invalidpayload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - val toBeRejected = SendgridAdapter.toRawEvents(invalidpayload, SpecHelpers.client).value + val toBeRejected = SendgridAdapter.toRawEvents(invalidpayload, SpecHelpers.client) toBeRejected must beInvalid } @@ -280,7 +280,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - val toBeRejected = SendgridAdapter.toRawEvents(invalidpayload, SpecHelpers.client).value + val toBeRejected = SendgridAdapter.toRawEvents(invalidpayload, SpecHelpers.client) toBeRejected must beInvalid } @@ -294,7 +294,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - SendgridAdapter.toRawEvents(invalidpayload, SpecHelpers.client).value must beInvalid + SendgridAdapter.toRawEvents(invalidpayload, SpecHelpers.client) must beInvalid } "accept content types with explicit charsets" in { @@ -307,7 +307,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - val res = SendgridAdapter.toRawEvents(payload, SpecHelpers.client).value + val res = SendgridAdapter.toRawEvents(payload, SpecHelpers.client) res must beValid } @@ -337,7 +337,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { Shared.context ) - SendgridAdapter.toRawEvents(invalidpayload, SpecHelpers.client).value must beInvalid + SendgridAdapter.toRawEvents(invalidpayload, SpecHelpers.client) must beInvalid } "reject invalid/unparsable json" in { @@ -353,8 +353,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { Shared.context ), SpecHelpers.client - ) - .value must beInvalid + ) must beInvalid } "reject valid json in incorrect format" in { @@ -370,8 +369,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { Shared.context ), SpecHelpers.client - ) - .value must beInvalid + ) must beInvalid } "reject a payload with a some valid, some invalid events" in { @@ -406,7 +404,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - val actual = SendgridAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = SendgridAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.SchemaMapping( @@ -451,7 +449,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers { val expectedJson = """{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.sendgrid/processed/jsonschema/2-0-0","data":{"timestamp":"2015-11-03T11:20:15.000Z","email":"example@test.com","marketing_campaign_name":"campaign name","sg_event_id":"sZROwMGMagFgnOEmSdvhig==","smtp-id":"\u003c14c5d75ce93.dfd.64b469@ismtpd-555\u003e","marketing_campaign_version":"B","marketing_campaign_id":12345,"marketing_campaign_split_id":13471,"category":"cat facts","sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"}}}""" - val actual = SendgridAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = SendgridAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/StatusGatorAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/StatusGatorAdapterSpec.scala index a2f050a8d..a26af86ab 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/StatusGatorAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/StatusGatorAdapterSpec.scala @@ -86,13 +86,13 @@ class StatusGatorAdapterSpec extends Specification with DataTables with Validate Shared.context ) ) - StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e2 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") @@ -105,7 +105,7 @@ class StatusGatorAdapterSpec extends Specification with DataTables with Validate "service_name=CloudFlare&favicon_url=https%3A%2F%2Fdwxjd9cd6rwno.cloudfront.net%2Ffavicons%2Fcloudflare.ico&status_page_url=https%3A%2F%2Fwww.cloudflarestatus.com%2F&home_page_url=http%3A%2F%2Fwww.cloudflare.com¤t_status=up&last_status=warn&occurred_at=2016-05-19T09%3A26%3A31%2B00%3A00" val payload = CollectorPayload(Shared.api, Nil, None, body.some, Shared.cljSource, Shared.context) - StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -122,7 +122,7 @@ class StatusGatorAdapterSpec extends Specification with DataTables with Validate val ct = "application/json" val payload = CollectorPayload(Shared.api, Nil, ct.some, body.some, Shared.cljSource, Shared.context) - StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -148,7 +148,7 @@ class StatusGatorAdapterSpec extends Specification with DataTables with Validate FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") ) - StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e6 = { @@ -169,6 +169,6 @@ class StatusGatorAdapterSpec extends Specification with DataTables with Validate "could not parse body: Illegal character in query at index 18: http://localhost/?{service_name=CloudFlare&favicon_url=https%3A%2F%2Fdwxjd9cd6rwno.cloudfront.net%2Ffavicons%2Fcloudflare.ico&status_page_url=https%3A%2F%2Fwww.cloudflarestatus.com%2F&home_page_url=http%3A%2F%2Fwww.cloudflare.com¤t_status=up&last_status=warn&occurred_at=2016-05-19T09%3A26%3A31%2B00%3A00" ) ) - StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + StatusGatorAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/UnbounceAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/UnbounceAdapterSpec.scala index a537c7f63..12f2ae232 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/UnbounceAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/UnbounceAdapterSpec.scala @@ -115,14 +115,14 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa Shared.context ) ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e2 = { val params = SpecHelpers.toNameValuePairs("schema" -> "iglu:com.unbounce/test/jsonschema/1-0-0") val payload = CollectorPayload(Shared.api, params, ContentType.some, None, Shared.cljSource, Shared.context) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") @@ -135,7 +135,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa "page_id=f7afd389-65a3-45fa-8bad-b7a42236044c&page_name=Test-Webhook&variant=a&page_url=http%3A%2F%2Funbouncepages.com%2Ftest-webhook-1&data.json=%7B%22email%22%3A%5B%22test%40snowplowanalytics.com%22%5D%2C%22ip_address%22%3A%5B%22200.121.220.179%22%5D%2C%22time_submitted%22%3A%5B%2204%3A17%20PM%20UTC%22%5D%7D" val payload = CollectorPayload(Shared.api, Nil, None, body.some, Shared.cljSource, Shared.context) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -152,7 +152,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa val ct = "application/json" val payload = CollectorPayload(Shared.api, Nil, ct.some, body.some, Shared.cljSource, Shared.context) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( "contentType", @@ -179,7 +179,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e6 = { @@ -198,7 +198,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa FailureDetails.AdapterFailure .InputData("data.json", None, "missing 'data.json' field in body") ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e7 = { @@ -217,7 +217,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa FailureDetails.AdapterFailure .InputData("data.json", None, "empty 'data.json' field in body") ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e8 = { @@ -239,7 +239,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa """invalid json: expected " got '{"emai...' (line 1, column 2)""" ) ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e9 = { @@ -259,7 +259,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa FailureDetails.AdapterFailure .InputData("page_id", None, "missing 'page_id' field in body") ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e10 = { @@ -278,7 +278,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa FailureDetails.AdapterFailure .InputData("page_name", None, "missing 'page_name' field in body") ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e11 = { @@ -298,7 +298,7 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa FailureDetails.AdapterFailure .InputData("variant", None, "missing 'variant' field in body") ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } def e12 = { @@ -317,6 +317,6 @@ class UnbounceAdapterSpec extends Specification with DataTables with ValidatedMa FailureDetails.AdapterFailure .InputData("page_url", None, "missing 'page_url' field in body") ) - UnbounceAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid(expected) + UnbounceAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid(expected) } } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/UrbanAirshipAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/UrbanAirshipAdapterSpec.scala index 29a477fc7..d88228647 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/UrbanAirshipAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/UrbanAirshipAdapterSpec.scala @@ -79,7 +79,7 @@ class UrbanAirshipAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - val actual = UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client) val expectedUnstructEventJson = json"""{ "schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0", @@ -128,13 +128,13 @@ class UrbanAirshipAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid + UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid } "reject unparsable json" in { val payload = CollectorPayload(Shared.api, Nil, None, """{ """.some, Shared.cljSource, Shared.context) - UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid + UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid } "reject badly formatted json" in { @@ -147,7 +147,7 @@ class UrbanAirshipAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid + UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid } "reject content types" in { @@ -159,7 +159,7 @@ class UrbanAirshipAdapterSpec extends Specification with ValidatedMatchers { Shared.cljSource, Shared.context ) - val res = UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client).value + val res = UrbanAirshipAdapter.toRawEvents(payload, SpecHelpers.client) res must beInvalid( NonEmptyList.one( diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/VeroAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/VeroAdapterSpec.scala index f33238a51..980b19b84 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/VeroAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/VeroAdapterSpec.scala @@ -78,7 +78,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.context ) ) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e2 = { @@ -106,7 +106,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.context ) ) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e3 = { @@ -134,7 +134,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.context ) ) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e4 = { @@ -162,7 +162,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.context ) ) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e5 = { @@ -190,7 +190,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.context ) ) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e6 = { @@ -218,7 +218,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.context ) ) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e7 = { @@ -246,7 +246,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.context ) ) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e8 = { @@ -274,7 +274,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche Shared.context ) ) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beValid(expected) + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beValid(expected) } def e9 = @@ -298,7 +298,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche ) val expectedJson = "{\"schema\":\"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0\",\"data\":{\"schema\":\"" + expected + "\",\"data\":{}}}" - val actual = VeroAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = VeroAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -315,7 +315,7 @@ class VeroAdapterSpec extends Specification with DataTables with ValidatedMatche def e10 = { val payload = CollectorPayload(Shared.api, Nil, ContentType.some, None, Shared.cljSource, Shared.context) - VeroAdapter.toRawEvents(payload, SpecHelpers.client).value must beInvalid( + VeroAdapter.toRawEvents(payload, SpecHelpers.client) must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure .InputData("body", None, "empty body: no events to process") diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/snowplow/SnowplowAdapterSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/snowplow/SnowplowAdapterSpec.scala index ab8c62821..3726c1a4a 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/snowplow/SnowplowAdapterSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/adapters/registry/snowplow/SnowplowAdapterSpec.scala @@ -90,7 +90,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = Tp1Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp1Adapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList .one(RawEvent(Snowplow.Tp1, Map("aid" -> "test"), None, Shared.source, Shared.context)) @@ -99,7 +99,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa def e2 = { val payload = CollectorPayload(Snowplow.Tp1, Nil, None, None, Shared.source, Shared.context) - val actual = Tp1Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp1Adapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.AdapterFailure.InputData( @@ -120,7 +120,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -146,7 +146,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -173,7 +173,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client) val rawEvent: RawEventParameters => RawEvent = params => RawEvent( @@ -203,7 +203,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -271,7 +271,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid(expected) } @@ -284,7 +284,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.TrackerProtocolViolation @@ -303,7 +303,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.TrackerProtocolViolation.IgluError( @@ -434,7 +434,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.context ) - val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client).value + val actual = Tp2Adapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid(expected) } @@ -450,7 +450,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -483,7 +483,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -517,7 +517,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -550,7 +550,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -585,7 +585,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beValid( NonEmptyList.one( RawEvent( @@ -608,7 +608,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa def e16 = { val payload = CollectorPayload(Snowplow.Tp2, Nil, None, None, Shared.source, Shared.context) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.TrackerProtocolViolation.InputData( @@ -630,7 +630,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.TrackerProtocolViolation.InputData( @@ -655,7 +655,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.TrackerProtocolViolation.NotJson( @@ -680,7 +680,7 @@ class SnowplowAdapterSpec extends Specification with DataTables with ValidatedMa Shared.source, Shared.context ) - val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client).value + val actual = RedirectAdapter.toRawEvents(payload, SpecHelpers.client) actual must beInvalid( NonEmptyList.one( FailureDetails.TrackerProtocolViolation diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/EnrichmentManagerSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/EnrichmentManagerSpec.scala index a568fa0d8..83161af81 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/EnrichmentManagerSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/EnrichmentManagerSpec.scala @@ -17,7 +17,7 @@ package enrichments import org.specs2.mutable.Specification import org.specs2.matcher.EitherMatchers -import cats.Eval +import cats.Id import cats.implicits._ import cats.data.NonEmptyList @@ -37,7 +37,7 @@ import enrichments.registry.JavascriptScriptEnrichment import enrichments.registry.YauaaEnrichment class EnrichmentManagerSpec extends Specification with EitherMatchers { - val enrichmentReg = EnrichmentRegistry[Eval](yauaa = Some(YauaaEnrichment(None))) + val enrichmentReg = EnrichmentRegistry[Id](yauaa = Some(YauaaEnrichment(None))) val client = SpecHelpers.client val processor = Processor("ssc-tests", "0.0.0") val timestamp = DateTime.now() @@ -83,7 +83,7 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { rawEvent ) - enriched.value.value must beLeft.like { + enriched.value must beLeft.like { case _: BadRow.SchemaViolations => ok case br => ko(s"bad row [$br] is not SchemaViolations") } @@ -115,7 +115,7 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { timestamp, rawEvent ) - enriched.value.value must beLeft.like { + enriched.value must beLeft.like { case _: BadRow.SchemaViolations => ok case br => ko(s"bad row [$br] is not SchemaViolations") } @@ -142,7 +142,7 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { val jsEnrichConf = JavascriptScriptEnrichment.parse(config, schemaKey).toOption.get val jsEnrich = JavascriptScriptEnrichment(jsEnrichConf.schemaKey, jsEnrichConf.rawFunction) - val enrichmentReg = EnrichmentRegistry[Eval](javascriptScript = Some(jsEnrich)) + val enrichmentReg = EnrichmentRegistry[Id](javascriptScript = Some(jsEnrich)) val parameters = Map( "e" -> "pp", @@ -157,7 +157,7 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { timestamp, rawEvent ) - enriched.value.value must beLeft.like { + enriched.value must beLeft.like { case BadRow.EnrichmentFailures( _, Failure.EnrichmentFailures( @@ -205,7 +205,7 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { val jsEnrichConf = JavascriptScriptEnrichment.parse(config, schemaKey).toOption.get val jsEnrich = JavascriptScriptEnrichment(jsEnrichConf.schemaKey, jsEnrichConf.rawFunction) - val enrichmentReg = EnrichmentRegistry[Eval](javascriptScript = Some(jsEnrich)) + val enrichmentReg = EnrichmentRegistry[Id](javascriptScript = Some(jsEnrich)) val parameters = Map( "e" -> "pp", @@ -220,7 +220,7 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { timestamp, rawEvent ) - enriched.value.value must beLeft.like { + enriched.value must beLeft.like { case BadRow.EnrichmentFailures( _, Failure.EnrichmentFailures( @@ -279,7 +279,7 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { timestamp, rawEvent ) - enriched.value.value must beRight + enriched.value must beRight } "have a preference of 'ua' query string parameter over user agent of HTTP header" >> { @@ -299,8 +299,8 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { timestamp, rawEvent ) - enriched.value.value.map(_.useragent) must beRight(qs_ua) - enriched.value.value.map(_.derived_contexts) must beRight((_: String).contains("\"agentName\":\"Firefox\"")) + enriched.value.map(_.useragent) must beRight(qs_ua) + enriched.value.map(_.derived_contexts) must beRight((_: String).contains("\"agentName\":\"Firefox\"")) } "use user agent of HTTP header if 'ua' query string parameter is not set" >> { @@ -318,7 +318,7 @@ class EnrichmentManagerSpec extends Specification with EitherMatchers { timestamp, rawEvent ) - enriched.value.value.map(_.useragent) must beRight("header-useragent") + enriched.value.map(_.useragent) must beRight("header-useragent") } } } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/CurrencyConversionEnrichmentSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/CurrencyConversionEnrichmentSpec.scala index ea83fbde1..f3cafa750 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/CurrencyConversionEnrichmentSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/CurrencyConversionEnrichmentSpec.scala @@ -13,14 +13,15 @@ package com.snowplowanalytics.snowplow.enrich.common package enrichments.registry -import cats.Eval +import cats.Id import cats.data.{NonEmptyList, Validated, ValidatedNel} -import cats.syntax.option._ -import cats.syntax.validated._ +import cats.implicits._ + import com.snowplowanalytics.forex.CreateForex._ import com.snowplowanalytics.forex.model._ import com.snowplowanalytics.iglu.core.{SchemaKey, SchemaVer} import com.snowplowanalytics.snowplow.badrows._ + import org.joda.money.CurrencyUnit import org.joda.time.DateTime import org.specs2.Specification @@ -112,7 +113,7 @@ class CurrencyConversionEnrichmentSpec extends Specification with DataTables { ) => (for { e <- CurrencyConversionConf(schemaKey, DeveloperAccount, apiKey, CurrencyUnit.EUR) - .enrichment[Eval] + .enrichment[Id] res <- e.convertCurrencies( trCurrency, trAmountTotal, @@ -122,7 +123,7 @@ class CurrencyConversionEnrichmentSpec extends Specification with DataTables { tiPrice, dateTime ) - } yield res).value must_== expected + } yield res) must_== expected } def e2 = @@ -182,10 +183,7 @@ class CurrencyConversionEnrichmentSpec extends Specification with DataTables { expected ) => (for { - c <- Eval.now( - CurrencyConversionConf(schemaKey, DeveloperAccount, apiKey, CurrencyUnit.EUR) - ) - e <- c.enrichment[Eval] + e <- CurrencyConversionConf(schemaKey, DeveloperAccount, apiKey, CurrencyUnit.EUR).enrichment[Id] res <- e.convertCurrencies( trCurrency, trAmountTotal, @@ -195,6 +193,6 @@ class CurrencyConversionEnrichmentSpec extends Specification with DataTables { tiPrice, dateTime ) - } yield res).value must_== expected + } yield res) must_== expected } } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/IpLookupsEnrichmentSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/IpLookupsEnrichmentSpec.scala index c0e8ca142..f76de4561 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/IpLookupsEnrichmentSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/IpLookupsEnrichmentSpec.scala @@ -12,12 +12,14 @@ */ package com.snowplowanalytics.snowplow.enrich.common.enrichments.registry -import cats.Eval -import cats.syntax.option._ -import cats.syntax.either._ +import cats.Id +import cats.implicits._ + import com.snowplowanalytics.iglu.core.{SchemaKey, SchemaVer} import com.snowplowanalytics.maxmind.iplookups.model.IpLocation + import io.circe.literal._ + import org.specs2.Specification import org.specs2.matcher.DataTables @@ -95,13 +97,14 @@ class IpLookupsEnrichmentSpec extends Specification with DataTables { accuracyRadius = 100 ).asRight.some |> { (_, ipAddress, expected) => (for { - e <- config.enrichment[Eval] + e <- config.enrichment[Id] res <- e.extractIpInformation(ipAddress) - } yield res.ipLocation).value.map(_.leftMap(_.getClass.getSimpleName)) must_== expected + } yield res.ipLocation).map(_.leftMap(_.getClass.getSimpleName)) must_== expected } def e2 = - config.enrichment + config + .enrichment[Id] .extractIpInformation("70.46.123.145") .isp must_== "FDN Communications".asRight.some } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/ApiRequestEnrichmentIntegrationTest.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/ApiRequestEnrichmentIntegrationTest.scala index 448312c51..2e7f815cb 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/ApiRequestEnrichmentIntegrationTest.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/ApiRequestEnrichmentIntegrationTest.scala @@ -13,7 +13,7 @@ package com.snowplowanalytics.snowplow.enrich.common package enrichments.registry.apirequest -import cats.Eval +import cats.Id import io.circe._ import io.circe.literal._ @@ -258,12 +258,12 @@ class ApiRequestEnrichmentIntegrationTest extends Specification { def e1 = { val enrichment = ApiRequestEnrichment .parse(IntegrationTests.configuration, SCHEMA_KEY) - .map(_.enrichment[Eval].value) + .map(_.enrichment[Id]) .toEither val event = new EnrichedEvent event.setApp_id("lookup-test") event.setUser_id("snowplower") - val context = enrichment.flatMap(_.lookup(event, Nil, Nil, None).value.toEither) + val context = enrichment.flatMap(_.lookup(event, Nil, Nil, None).toEither) context must beRight.like { case context => context must contain(IntegrationTests.correctResultContext) and (context must have size 1) @@ -273,7 +273,7 @@ class ApiRequestEnrichmentIntegrationTest extends Specification { def e2 = { val enrichment = ApiRequestEnrichment .parse(IntegrationTests.configuration2, SCHEMA_KEY) - .map(_.enrichment[Eval].value) + .map(_.enrichment[Id]) .toEither val event = new EnrichedEvent event.setApp_id("lookup test") @@ -286,7 +286,7 @@ class ApiRequestEnrichmentIntegrationTest extends Specification { List(IntegrationTests.weatherContext), List(IntegrationTests.customContexts), Some(IntegrationTests.unstructEvent) - ).value.toEither + ).toEither ) enrichment.flatMap( _.lookup( @@ -294,7 +294,7 @@ class ApiRequestEnrichmentIntegrationTest extends Specification { List(IntegrationTests.weatherContext), List(IntegrationTests.customContexts), Some(IntegrationTests.unstructEvent) - ).value.toEither + ).toEither ) val context = enrichment.flatMap( @@ -303,7 +303,7 @@ class ApiRequestEnrichmentIntegrationTest extends Specification { List(IntegrationTests.weatherContext), List(IntegrationTests.customContexts), Some(IntegrationTests.unstructEvent) - ).value.toEither + ).toEither ) context must beRight.like { diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/HttpApiSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/HttpApiSpec.scala index 21a13fc2f..93568490e 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/HttpApiSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/HttpApiSpec.scala @@ -14,7 +14,7 @@ package com.snowplowanalytics.snowplow.enrich.common package enrichments.registry package apirequest -import cats.Eval +import cats.Id import com.snowplowanalytics.iglu.core.{SchemaKey, SchemaVer} import org.specs2.Specification import org.specs2.matcher.ValidatedMatchers @@ -58,10 +58,10 @@ class HttpApiSpec extends Specification with ValidatedMatchers with Mockito { HttpApi("GET", "http://thishostdoesntexist31337:8123/endpoint", 1000, Authentication(None)), List(Output("", Some(JsonOutput("")))), Cache(1, 1) - ).enrichment[Eval] + ).enrichment[Id] val event = new outputs.EnrichedEvent - val request = enrichment.value.lookup(event, Nil, Nil, None).value + val request = enrichment.lookup(event, Nil, Nil, None) request must beInvalid } } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/InputSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/InputSpec.scala index 150d4ba4a..887da6e64 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/InputSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/enrichments/registry/apirequest/InputSpec.scala @@ -14,7 +14,7 @@ package com.snowplowanalytics.snowplow.enrich.common package enrichments.registry package apirequest -import cats.Eval +import cats.Id import cats.data.ValidatedNel import cats.syntax.option._ @@ -252,11 +252,11 @@ class InputSpec extends Specification with ValidatedMatchers { HttpApi("GET", uriTemplate, 1000, Authentication(None)), List(Output("iglu:someschema", JsonOutput("$").some)), Cache(10, 5) - ).enrichment[Eval] + ).enrichment[Id] val event = new outputs.EnrichedEvent event.setUser_id("chuwy") // time in true_tstamp won't be found - val request = enrichment.value.lookup(event, Nil, Nil, None).value + val request = enrichment.lookup(event, Nil, Nil, None) request must beValid.like { case response => response must be(Nil) } diff --git a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/utils/IgluUtilsSpec.scala b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/utils/IgluUtilsSpec.scala index 0ec2e0133..6ac16b54b 100644 --- a/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/utils/IgluUtilsSpec.scala +++ b/modules/common/src/test/scala/com.snowplowanalytics.snowplow.enrich.common/utils/IgluUtilsSpec.scala @@ -91,8 +91,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { "extractAndValidateUnstructEvent" should { "return None if unstruct_event field is empty" >> { IgluUtils - .extractAndValidateUnstructEvent(new EnrichedEvent, SpecHelpers.client) - .value must beValid(None) + .extractAndValidateUnstructEvent(new EnrichedEvent, SpecHelpers.client) must beValid(None) } "return a SchemaViolation.NotJson if unstruct_event does not contain a properly formatted JSON string" >> { @@ -100,8 +99,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setUnstruct_event(notJson) IgluUtils - .extractAndValidateUnstructEvent(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateUnstructEvent(input, SpecHelpers.client) must beInvalid.like { case _: FailureDetails.SchemaViolation.NotJson => ok case err => ko(s"[$err] is not NotJson") } @@ -112,8 +110,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setUnstruct_event(notIglu) IgluUtils - .extractAndValidateUnstructEvent(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateUnstructEvent(input, SpecHelpers.client) must beInvalid.like { case _: FailureDetails.SchemaViolation.NotIglu => ok case err => ko(s"[$err] is not NotIglu") } @@ -124,8 +121,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setUnstruct_event(noSchema) IgluUtils - .extractAndValidateUnstructEvent(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateUnstructEvent(input, SpecHelpers.client) must beInvalid.like { case _: FailureDetails.SchemaViolation.CriterionMismatch => ok case err => ko(s"[$err] is not CriterionMismatch") } @@ -136,8 +132,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setUnstruct_event(buildUnstruct(notJson)) IgluUtils - .extractAndValidateUnstructEvent(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateUnstructEvent(input, SpecHelpers.client) must beInvalid.like { case _: FailureDetails.SchemaViolation.NotJson => ok case err => ko(s"[$err] is not NotJson") } @@ -148,8 +143,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setUnstruct_event(buildUnstruct(notIglu)) IgluUtils - .extractAndValidateUnstructEvent(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateUnstructEvent(input, SpecHelpers.client) must beInvalid.like { case FailureDetails.SchemaViolation.IgluError(_, ValidationError(_)) => ok case ie: FailureDetails.SchemaViolation.IgluError => ko(s"IgluError [$ie] is not ValidationError") @@ -162,8 +156,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setUnstruct_event(buildUnstruct(invalidEmailSent)) IgluUtils - .extractAndValidateUnstructEvent(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateUnstructEvent(input, SpecHelpers.client) must beInvalid.like { case FailureDetails.SchemaViolation.IgluError(_, ValidationError(_)) => ok case ie: FailureDetails.SchemaViolation.IgluError => ko(s"IgluError [$ie] is not ValidationError") @@ -176,8 +169,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setUnstruct_event(buildUnstruct(noSchema)) IgluUtils - .extractAndValidateUnstructEvent(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateUnstructEvent(input, SpecHelpers.client) must beInvalid.like { case FailureDetails.SchemaViolation.IgluError(_, ResolutionError(_)) => ok case ie: FailureDetails.SchemaViolation.IgluError => ko(s"IgluError [$ie] is not ResolutionError") @@ -190,8 +182,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setUnstruct_event(buildUnstruct(emailSent1)) IgluUtils - .extractAndValidateUnstructEvent(input, SpecHelpers.client) - .value must beValid.like { + .extractAndValidateUnstructEvent(input, SpecHelpers.client) must beValid.like { case Some(sdj) if sdj.schema == emailSentSchema => ok case Some(sdj) => ko( @@ -205,8 +196,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { "extractAndValidateInputContexts" should { "return Nil if contexts field is empty" >> { IgluUtils - .extractAndValidateInputContexts(new EnrichedEvent, SpecHelpers.client) - .value must beValid(Nil) + .extractAndValidateInputContexts(new EnrichedEvent, SpecHelpers.client) must beValid(Nil) } "return a SchemaViolation.NotJson if .contexts does not contain a properly formatted JSON string" >> { @@ -214,8 +204,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(notJson) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beInvalid.like { case NonEmptyList(_: FailureDetails.SchemaViolation.NotJson, Nil) => ok case err => ko(s"[$err] is not one NotJson") } @@ -226,8 +215,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(notIglu) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beInvalid.like { case NonEmptyList(_: FailureDetails.SchemaViolation.NotIglu, Nil) => ok case err => ko(s"[$err] is not one NotIglu") } @@ -238,8 +226,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(noSchema) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beInvalid.like { case NonEmptyList(_: FailureDetails.SchemaViolation.CriterionMismatch, Nil) => ok case err => ko(s"[$err] is not one CriterionMismatch") } @@ -252,8 +239,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(notArrayContexts) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beInvalid.like { case NonEmptyList(FailureDetails.SchemaViolation.IgluError(_, ValidationError(_)), Nil) => ok case NonEmptyList(ie: FailureDetails.SchemaViolation.IgluError, Nil) => @@ -267,8 +253,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(buildInputContexts(List(invalidEmailSent))) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beInvalid.like { case NonEmptyList(FailureDetails.SchemaViolation.IgluError(_, ValidationError(_)), Nil) => ok case NonEmptyList(ie: FailureDetails.SchemaViolation.IgluError, Nil) => @@ -282,8 +267,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(buildInputContexts(List(noSchema))) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beInvalid.like { case NonEmptyList(FailureDetails.SchemaViolation.IgluError(_, ResolutionError(_)), Nil) => ok case NonEmptyList(ie: FailureDetails.SchemaViolation.IgluError, Nil) => @@ -297,8 +281,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(buildInputContexts(List(invalidEmailSent, noSchema))) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beInvalid.like { case NonEmptyList( FailureDetails.SchemaViolation.IgluError(_, ValidationError(_)), List(FailureDetails.SchemaViolation.IgluError(_, ResolutionError(_))) @@ -313,8 +296,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(buildInputContexts(List(emailSent1, noSchema))) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beInvalid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beInvalid.like { case NonEmptyList(_: FailureDetails.SchemaViolation.IgluError, Nil) => ok case err => ko(s"[$err] is not one IgluError") } @@ -325,8 +307,7 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { input.setContexts(buildInputContexts(List(emailSent1, emailSent2))) IgluUtils - .extractAndValidateInputContexts(input, SpecHelpers.client) - .value must beValid.like { + .extractAndValidateInputContexts(input, SpecHelpers.client) must beValid.like { case sdjs: List[SelfDescribingData[Json]] if sdjs.size == 2 && sdjs.forall(_.schema == emailSentSchema) => ok case res => @@ -343,7 +324,6 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { IgluUtils .validateEnrichmentsContexts(SpecHelpers.client, contexts, raw, processor, enriched) - .value .value must beLeft.like { case BadRow.EnrichmentFailures(_, failures, _) => failures.messages match { @@ -369,7 +349,6 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { IgluUtils .validateEnrichmentsContexts(SpecHelpers.client, contexts, raw, processor, enriched) - .value .value must beLeft.like { case BadRow.EnrichmentFailures(_, failures, _) => failures.messages match { @@ -403,7 +382,6 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { IgluUtils .validateEnrichmentsContexts(SpecHelpers.client, contexts, raw, processor, enriched) - .value .value must beLeft.like { case BadRow.EnrichmentFailures(_, failures, _) => failures.messages match { @@ -429,7 +407,6 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { IgluUtils .validateEnrichmentsContexts(SpecHelpers.client, contexts, raw, processor, enriched) - .value .value must beRight } } @@ -446,7 +423,6 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { raw, processor ) - .value .value must beLeft.like { case BadRow.SchemaViolations(_, failure, _) if failure.messages.size == 1 => ok case br => ko(s"bad row [$br] is not a SchemaViolations containing 1 error") @@ -464,7 +440,6 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { raw, processor ) - .value .value must beLeft.like { case BadRow.SchemaViolations(_, failure, _) if failure.messages.size == 1 => ok case br => ko(s"bad row [$br] is not a SchemaViolations containing 1 error") @@ -483,7 +458,6 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { raw, processor ) - .value .value must beLeft.like { case BadRow.SchemaViolations(_, failure, _) if failure.messages.size == 2 => ok case br => ko(s"bad row [$br] is not a SchemaViolations containing 2 errors") @@ -502,7 +476,6 @@ class IgluUtilsSpec extends Specification with ValidatedMatchers { raw, processor ) - .value .value must beRight.like { case (sdjs: List[SelfDescribingData[Json]], Some(sdj)) if sdjs.size == 2 && (sdj :: sdjs).forall(_.schema == emailSentSchema) => ok diff --git a/project/Dependencies.scala b/project/Dependencies.scala index e324da7f5..df04cfebc 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -39,7 +39,7 @@ object Dependencies { val jaywayJsonpath = "2.4.0" val iabClient = "0.2.0" val yauaa = "5.8" - val guava = "28.1-jre" //used only for InetAddress (because it doesn't do dns lookup) + val guava = "28.1-jre" val slf4j = "1.7.26" val refererParser = "1.0.0" @@ -51,7 +51,7 @@ object Dependencies { val scalaWeather = "0.5.0" val gatlingJsonpath = "0.6.14" val scalaUri = "1.4.5" - val scalaLruMap = "0.3.0" + val scalaLruMap = "0.3.1" val badRows = "1.0.0" val snowplowRawEvent = "0.1.0"