Skip to content

Commit 8b07d13

Browse files
committed
fix deprecation warnings from pr #7
1 parent 0bb1569 commit 8b07d13

File tree

5 files changed

+84
-74
lines changed

5 files changed

+84
-74
lines changed

build.sbt

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name := "scala-frp"
2+
3+
organization := "io.dylemma"
4+
5+
version := "1.3"
6+
7+
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.0")
8+
9+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test"
10+
11+
scalacOptions in Compile += "-deprecation"
12+
13+
scalacOptions in (Compile, doc) += "-implicits"
14+
15+
// publishing stuff below
16+
17+
publishMavenStyle := true
18+
19+
publishTo := {
20+
val nexus = "https://oss.sonatype.org/"
21+
if(isSnapshot.value)
22+
Some("snapshots" at nexus + "content/repositories/snapshots")
23+
else
24+
Some("releases" at nexus + "service/local/staging/deploy/maven2")
25+
}
26+
27+
publishArtifact in Test := false
28+
29+
pomIncludeRepository := { _ => false }
30+
31+
pomExtra := (
32+
<url>https://github.com/dylemma/scala.frp</url>
33+
<licenses>
34+
<license>
35+
<name>MIT License</name>
36+
<url>http://opensource.org/licenses/mit-license.php</url>
37+
<distribution>repo</distribution>
38+
</license>
39+
</licenses>
40+
<scm>
41+
<url>git@github.com:dylemma/scala.frp.git</url>
42+
<connection>scm:git:git@github.com:dylemma/scala.frp.git</connection>
43+
</scm>
44+
<developers>
45+
<developer>
46+
<id>dylemma</id>
47+
<name>Dylan Halperin</name>
48+
<url>http://dylemma.io/</url>
49+
</developer>
50+
</developers>
51+
)

project/Build.scala

-53
This file was deleted.

src/main/scala/io/dylemma/frp/impl/EventStreamCombinators.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,13 @@ private[frp] class ZipWithStalenessEventStream[A](val parent: EventStream[A]) ex
303303

304304
private[frp] class ZippedEventStream[A, B](val leftParent: EventStream[A], val rightParent: EventStream[B])
305305
extends EventJoin[A, B, (A, B)] {
306-
import scala.collection.JavaConversions._
307-
306+
308307
private val leftQueue = new java.util.concurrent.ConcurrentLinkedQueue[A]
309308
private val rightQueue = new java.util.concurrent.ConcurrentLinkedQueue[B]
310309

311310
//if there are elements available from both queues, dequeue them and fire the pair
312311
private def tryDequeue() = {
313-
if (leftQueue.nonEmpty && rightQueue.nonEmpty) {
312+
if (!leftQueue.isEmpty && !rightQueue.isEmpty) {
314313
val l = leftQueue.remove()
315314
val r = rightQueue.remove()
316315
fire(l -> r)

src/test/scala/io/dylemma/frp/test/EventStreamDeadlineTests.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package io.dylemma.frp.test
22

3-
import org.scalatest._
4-
import org.scalatest.concurrent.AsyncAssertions
53
import io.dylemma.frp._
4+
import org.scalatest._
5+
import org.scalatest.concurrent.Waiters
6+
67
import scala.concurrent.duration._
78

8-
class EventStreamDeadlineTests extends FunSuite with TestHelpers with AsyncAssertions with Observer {
9+
class EventStreamDeadlineTests extends FunSuite with TestHelpers with Waiters with Observer {
910

1011
test("EventStream.before only encounters events before the deadline") {
1112
val w = new Waiter

src/test/scala/io/dylemma/frp/test/EventStreamFuturesTest.scala

+27-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
package io.dylemma.frp.test
22

3-
import org.scalatest._
4-
import org.scalatest.concurrent.AsyncAssertions
5-
import org.scalatest.time.SpanSugar._
63
import io.dylemma.frp._
7-
import scala.concurrent.ExecutionContext.Implicits.global
8-
import scala.util._
4+
import org.scalatest._
5+
import org.scalatest.concurrent.Waiters
96
import org.scalatest.exceptions.TestFailedException
107

11-
class EventStreamFuturesTest extends FunSuite with TestHelpers with AsyncAssertions with Observer {
8+
import scala.concurrent.ExecutionContext.Implicits.global
9+
import scala.util.{Failure, Success}
10+
11+
class EventStreamFuturesTest extends FunSuite with TestHelpers with Waiters with Observer {
1212

1313
test("EventStream.next completes successfully when the stream fires an event") {
1414
val w = new Waiter
1515
val s = EventSource[Int]()
1616

17-
s.next onSuccess { case 5 => w.dismiss }
17+
s.next foreach { case 5 => w.dismiss }
1818
s fire 5
1919
w.await(dismissals(1))
2020
}
@@ -24,15 +24,21 @@ class EventStreamFuturesTest extends FunSuite with TestHelpers with AsyncAsserti
2424
val s = EventSource[Int]()
2525

2626
s.stop() // stream stopped before `next` is called
27-
s.next onFailure { case _ => w.dismiss }
27+
s.next onComplete {
28+
case Failure(_) => w.dismiss
29+
case Success(_) =>
30+
}
2831
w.await(dismissals(1))
2932
}
3033

3134
test("EventStream.next completes with a failure if the stream stops before firing an event") {
3235
val w = new Waiter
3336
val s = EventSource[Int]()
3437

35-
s.next onFailure { case _ => w.dismiss }
38+
s.next onComplete {
39+
case Failure(_) => w.dismiss
40+
case Success(_) =>
41+
}
3642
s.stop() // stream stopped after `next` is called
3743
w.await(dismissals(1))
3844
}
@@ -58,7 +64,7 @@ class EventStreamFuturesTest extends FunSuite with TestHelpers with AsyncAsserti
5864
val w = new Waiter
5965
val s = EventSource[Int]()
6066

61-
s.last onSuccess { case 3 => w.dismiss }
67+
s.last foreach { case 3 => w.dismiss }
6268
s fire 1
6369
s fire 2
6470
s fire 3
@@ -71,7 +77,7 @@ class EventStreamFuturesTest extends FunSuite with TestHelpers with AsyncAsserti
7177
val w = new Waiter
7278
val s = EventSource[Int]()
7379

74-
s.last onSuccess { case 3 => w.dismiss }
80+
s.last foreach { case 3 => w.dismiss }
7581
s fire 1
7682
s fire 2
7783
s fire 3
@@ -87,15 +93,21 @@ class EventStreamFuturesTest extends FunSuite with TestHelpers with AsyncAsserti
8793
val s = EventSource[Int]()
8894
s.stop()
8995

90-
s.last onFailure { case _ => w.dismiss }
96+
s.last onComplete {
97+
case Failure(_) => w.dismiss
98+
case Success(_) =>
99+
}
91100
w.await(dismissals(1))
92101
}
93102

94103
test("EventStream.last should be a failure if the stream stops before firing an event") {
95104
val w = new Waiter
96105
val s = EventSource[Int]()
97106

98-
s.last onFailure { case _ => w.dismiss }
107+
s.last onComplete {
108+
case Failure(_) => w.dismiss
109+
case Success(_) =>
110+
}
99111
s.stop()
100112
w.await(dismissals(1))
101113
}
@@ -105,15 +117,15 @@ class EventStreamFuturesTest extends FunSuite with TestHelpers with AsyncAsserti
105117
val s = EventSource[Int]()
106118
s.stop()
107119

108-
s.end onSuccess { case _ => w.dismiss }
120+
s.end foreach { case _ => w.dismiss }
109121
w.await(dismissals(1))
110122
}
111123

112124
test("EventStream.end completes successfully when the stream stops") {
113125
val w = new Waiter
114126
val s = EventSource[Int]()
115127

116-
s.end onSuccess { case _ => w.dismiss }
128+
s.end foreach { case _ => w.dismiss }
117129
s.stop()
118130
w.await(dismissals(1))
119131
}

0 commit comments

Comments
 (0)