Skip to content

Commit 93a8849

Browse files
committed
Applied Scalafix rule(s) github:typelevel/cats-effect/v3_0_0?sha=v3.0.0
1 parent 6bd8165 commit 93a8849

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

oauth2-cache-ce2/src/main/scala/com/ocadotechnology/sttp/oauth2/cache/ce2/CachingAccessTokenProvider.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import cats.Monad
44
import cats.data.OptionT
55
import cats.effect.Clock
66
import cats.effect.Concurrent
7-
import cats.effect.concurrent.Semaphore
87
import cats.syntax.all._
98
import org.polyvariant.sttp.oauth2.cache.ExpiringCache
109
import org.polyvariant.sttp.oauth2.cache.ce2.CachingAccessTokenProvider.TokenWithExpirationTime
@@ -15,6 +14,7 @@ import org.polyvariant.sttp.oauth2.Secret
1514

1615
import java.time.Instant
1716
import scala.concurrent.duration.Duration
17+
import cats.effect.std.Semaphore
1818

1919
final class CachingAccessTokenProvider[F[_]: Monad: Clock](
2020
delegate: AccessTokenProvider[F],

oauth2-cache-ce2/src/main/scala/com/ocadotechnology/sttp/oauth2/cache/ce2/CatsRefExpiringCache.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ package org.polyvariant.sttp.oauth2.cache.ce2
22

33
import cats.Monad
44
import cats.data.OptionT
5-
import cats.effect.concurrent.Ref
65
import cats.effect.Clock
76
import cats.effect.Sync
87
import cats.implicits._
98
import org.polyvariant.sttp.oauth2.cache.ExpiringCache
109
import org.polyvariant.sttp.oauth2.cache.ce2.CatsRefExpiringCache.Entry
1110

1211
import java.time.Instant
12+
import cats.effect.Ref
1313

1414
final class CatsRefExpiringCache[F[_]: Monad: Clock, K, V] private (ref: Ref[F, Map[K, Entry[V]]]) extends ExpiringCache[F, K, V] {
1515

oauth2-cache-ce2/src/test/scala/com/ocadotechnology/sttp/oauth2/cache/ce2/CachingAccessTokenProviderParallelSpec.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package org.polyvariant.sttp.oauth2.cache.ce2
22

33
import cats.FlatMap
4-
import cats.effect.ContextShift
54
import cats.effect.IO
6-
import cats.effect.Timer
7-
import cats.effect.concurrent.Ref
85
import cats.syntax.all._
96
import org.polyvariant.sttp.oauth2.ClientCredentialsToken.AccessTokenResponse
107
import org.polyvariant.sttp.oauth2.cache.ExpiringCache
@@ -19,11 +16,12 @@ import org.scalatest.wordspec.AnyWordSpec
1916
import java.time.Instant
2017
import scala.concurrent.ExecutionContext
2118
import scala.concurrent.duration._
19+
import cats.effect.{ Ref, Temporal }
2220

2321
class CachingAccessTokenProviderParallelSpec extends AnyWordSpec with Matchers {
2422
private val ec: ExecutionContext = ExecutionContext.global
2523
implicit lazy val cs: ContextShift[IO] = IO.contextShift(ec)
26-
implicit val clock: Timer[IO] = IO.timer(ec)
24+
implicit val clock: Temporal[IO] = IO.timer(ec)
2725

2826
private val testScope: Option[Scope] = Scope.of("test-scope")
2927
private val token = AccessTokenResponse(Secret("secret"), None, 10.seconds, testScope)
@@ -60,11 +58,11 @@ class CachingAccessTokenProviderParallelSpec extends AnyWordSpec with Matchers {
6058
def runTest(test: ((TestAccessTokenProvider[IO], AccessTokenProvider[IO])) => IO[Assertion]): Assertion =
6159
prepareTest.flatMap(test).unsafeRunSync()
6260

63-
class DelayingCache[F[_]: Timer: FlatMap, K, V](delegate: ExpiringCache[F, K, V]) extends ExpiringCache[F, K, V] {
61+
class DelayingCache[F[_]: Temporal: FlatMap, K, V](delegate: ExpiringCache[F, K, V]) extends ExpiringCache[F, K, V] {
6462
override def get(key: K): F[Option[V]] = delegate.get(key)
6563

6664
override def put(key: K, value: V, expirationTime: Instant): F[Unit] =
67-
Timer[F].sleep(sleepDuration) *> delegate.put(key, value, expirationTime)
65+
Temporal[F].sleep(sleepDuration) *> delegate.put(key, value, expirationTime)
6866

6967
override def remove(key: K): F[Unit] = delegate.remove(key)
7068
}

oauth2-cache-ce2/src/test/scala/com/ocadotechnology/sttp/oauth2/cache/ce2/CachingAccessTokenProviderSpec.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package org.polyvariant.sttp.oauth2.cache.ce2
22

3-
import cats.effect.ContextShift
43
import cats.effect.IO
5-
import cats.effect.Timer
6-
import cats.effect.concurrent.Ref
74
import cats.effect.laws.util.TestContext
85
import org.polyvariant.sttp.oauth2.ClientCredentialsToken.AccessTokenResponse
96
import org.polyvariant.sttp.oauth2.Secret
@@ -15,11 +12,12 @@ import org.scalatest.Assertion
1512

1613
import scala.concurrent.duration._
1714
import org.polyvariant.sttp.oauth2.AccessTokenProvider
15+
import cats.effect.{ Ref, Temporal }
1816

1917
class CachingAccessTokenProviderSpec extends AnyWordSpec with Matchers {
2018
implicit lazy val testContext: TestContext = TestContext.apply()
2119
implicit lazy val cs: ContextShift[IO] = IO.contextShift(testContext)
22-
implicit lazy val ioTimer: Timer[IO] = testContext.timer[IO]
20+
implicit lazy val ioTimer: Temporal[IO] = testContext.timer[IO]
2321

2422
private val testScope: Option[Scope] = Scope.of("test-scope")
2523
private val token = AccessTokenResponse(Secret("secret"), None, 10.seconds, testScope)

oauth2-cache-ce2/src/test/scala/com/ocadotechnology/sttp/oauth2/cache/ce2/CatsRefExpiringCacheSpec.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package org.polyvariant.sttp.oauth2.cache.ce2
22

33
import cats.effect.Clock
4-
import cats.effect.ContextShift
54
import cats.effect.IO
6-
import cats.effect.Timer
75
import cats.effect.laws.util.TestContext
86
import org.scalatest.matchers.should.Matchers
97
import org.scalatest.wordspec.AnyWordSpec
108
import scala.concurrent.duration._
9+
import cats.effect.Temporal
1110

1211
class CatsRefExpiringCacheSpec extends AnyWordSpec with Matchers {
1312
implicit lazy val testContext: TestContext = TestContext.apply()
1413
implicit lazy val cs: ContextShift[IO] = IO.contextShift(testContext)
15-
implicit lazy val ioTimer: Timer[IO] = testContext.timer[IO]
14+
implicit lazy val ioTimer: Temporal[IO] = testContext.timer[IO]
1615

1716
private val someKey = "key"
1817
private val someValue = 1

oauth2-cache-ce2/src/test/scala/com/ocadotechnology/sttp/oauth2/cache/ce2/TestAccessTokenProvider.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package org.polyvariant.sttp.oauth2.cache.ce2
22

33
import cats.Functor
4-
import cats.effect.concurrent.Ref
54
import cats.syntax.all._
65
import org.polyvariant.sttp.oauth2.ClientCredentialsToken
76
import org.polyvariant.sttp.oauth2.Introspection
87
import org.polyvariant.sttp.oauth2.Secret
98
import org.polyvariant.sttp.oauth2.common.Scope
109
import org.polyvariant.sttp.oauth2.AccessTokenProvider
10+
import cats.effect.Ref
1111

1212
trait TestAccessTokenProvider[F[_]] extends AccessTokenProvider[F] {
1313
def setToken(scope: Option[Scope], token: ClientCredentialsToken.AccessTokenResponse): F[Unit]

0 commit comments

Comments
 (0)