Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix test #273

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ lazy val exampleCommon = exampleProject("example-common")
lazy val exampleTest = exampleProject("example-test")
.dependsOn(exampleReview, exampleState)
.settings(
libraryDependencies ++= Seq(Dependencies.weaver, Dependencies.fs2Process).map(_ % Test),
libraryDependencies ++= Seq(
Dependencies.weaver,
Dependencies.fs2Process,
Dependencies.nuProcess).map(_ % Test),
testFrameworks += new TestFramework("weaver.framework.CatsEffect")
)

Expand All @@ -113,7 +116,7 @@ def newProject(name: String) =

lazy val commonSettings = Seq(
scalacOptions ++= Seq("-deprecation", "-feature"),
scalacOptions += "-target:jvm-1.8",
scalacOptions ++= Seq("-release", "8"),
javacOptions ++= Seq("-source", "8", "-target", "8")
)

Expand Down
7 changes: 3 additions & 4 deletions example/common/src/main/scala/common/Server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cats.data.NonEmptyList
import cats.effect._
import cats.implicits._
import com.comcast.ip4s._
import fs2.io.net.Network
import io.circe.Json
import org.http4s._
import org.http4s.circe._
Expand All @@ -13,7 +14,7 @@ import org.http4s.headers.Location
import org.http4s.implicits._
import org.http4s.server.{Router, Server}
import org.typelevel.ci.CIString
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.{Logger, LoggerFactory}
import sangria.execution.Middleware
import sangria.federation.tracing.ApolloFederationTracing

Expand All @@ -26,8 +27,7 @@ object Server {
Header.Raw(name, "ftv1")
}

def resource[F[_]: Async, Ctx](
logger: Logger[F],
def resource[F[_]: Async: Network: LoggerFactory, Ctx](
graphQL: GraphQL[F, Ctx],
port: Port
): Resource[F, Server] = {
Expand Down Expand Up @@ -59,7 +59,6 @@ object Server {
.withHost(host"localhost")
.withPort(port)
.withHttpApp(Router("/" -> routes).orNotFound)
.withLogger(logger)
.build
}
}
10 changes: 5 additions & 5 deletions example/review/src/main/scala/review/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import cats.implicits._
import com.comcast.ip4s._
import common.{CustomDirectives, GraphQL, Server}
import io.circe.Json
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.slf4j.Slf4jLogger
import org.typelevel.log4cats.LoggerFactory
import org.typelevel.log4cats.slf4j.Slf4jFactory
import sangria.federation.v2.{CustomDirectivesDefinition, Federation, Spec}
import sangria.schema.Schema

Expand All @@ -25,7 +25,7 @@ object Main extends IOApp.Simple {
GraphQL(schema, env.pure[F])(Async[F], um)
}

override def run: IO[Unit] = run(Slf4jLogger.getLogger[IO])
def run(logger: Logger[IO]): IO[Unit] =
Server.resource[IO, ReviewService](logger, graphQL, port"9082").use(_ => IO.never)
override def run: IO[Unit] = run()(Slf4jFactory.create[IO])
def run()(implicit logger: LoggerFactory[IO]): IO[Unit] =
Server.resource[IO, ReviewService](graphQL, port"9082").use(_ => IO.never)
}
10 changes: 5 additions & 5 deletions example/state/src/main/scala/state/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import cats.implicits._
import com.comcast.ip4s._
import common.{GraphQL, Server}
import io.circe.Json
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.slf4j.Slf4jLogger
import org.typelevel.log4cats.{Logger, LoggerFactory}
import org.typelevel.log4cats.slf4j.{Slf4jFactory, Slf4jLogger}
import sangria.federation.v1.Federation
import sangria.schema.Schema

Expand All @@ -25,7 +25,7 @@ object Main extends IOApp.Simple {
GraphQL(schema, env.pure[F])(Async[F], um)
}

override def run: IO[Unit] = run(Slf4jLogger.getLogger[IO])
def run(logger: Logger[IO]): IO[Unit] =
Server.resource[IO, StateService](logger, graphQL, port"9081").use(_ => IO.never)
override def run: IO[Unit] = run()(Slf4jFactory.create[IO])
def run()(implicit logger: LoggerFactory[IO]): IO[Unit] =
Server.resource[IO, StateService](graphQL, port"9081").use(_ => IO.never)
}
69 changes: 0 additions & 69 deletions example/test/src/test/scala/ExampleSpec.scala

This file was deleted.

3 changes: 2 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object Dependencies {
object V {
val circe = "0.15.0-M1"
val circeOptics = "0.14.1"
val http4s = "1.0.0-M30"
val http4s = "1.0.0-M40"
}

val sangria = "org.sangria-graphql" %% "sangria" % "4.0.2"
Expand All @@ -25,4 +25,5 @@ object Dependencies {
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
val weaver = "com.disneystreaming" %% "weaver-cats" % "0.8.3"
val fs2Process = "eu.monniot" %% "fs2-process" % "0.4.4"
val nuProcess = "com.zaxxer" % "nuprocess" % "2.0.6"
}