Skip to content

Commit

Permalink
#51 Update sbt-scoverage to 1.6.1, re-enable test coverage and format…
Browse files Browse the repository at this point in the history
…ter removed unnecessary empty lines
  • Loading branch information
pwliwanow committed Nov 21, 2019
1 parent f88a7cc commit a5259f0
Show file tree
Hide file tree
Showing 31 changed files with 2 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ install:
- wget https://www.foundationdb.org/downloads/6.1.8/ubuntu/installers/foundationdb-server_6.1.8-1_amd64.deb
- sudo dpkg -i foundationdb-clients_6.1.8-1_amd64.deb foundationdb-server_6.1.8-1_amd64.deb
script:
- sbt test:scalafmt scalafmtSbt +test
- sbt test:scalafmt scalafmtSbt coverage +test coverageReport
after_success:
- bash <(curl -s https://codecov.io/bash)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import scala.concurrent.duration.FiniteDuration
* - poll subspace after it reaches the end
*/
object InfinitePollingSubspaceSource {

def from[Entity, KeyRepr](
subspace: TypedSubspace[Entity, KeyRepr],
database: Database,
Expand Down Expand Up @@ -69,7 +68,6 @@ private final class InfinitePollingSubspaceSource[Entity](
pollingInterval: FiniteDuration,
createStream: ExecutionContextExecutor => RefreshingSubspaceStream[Entity])
extends GraphStage[SourceShape[Entity]] {

private val out: Outlet[Entity] = Outlet("InfinitePollingSubspaceSource.out")

override def shape: SourceShape[Entity] = SourceShape(out)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,4 @@ private[streams] abstract class SubspaceGraphStageLogic[Entity](

private def createFailStageCallback(): AsyncCallback[Throwable] =
getAsyncCallback[Throwable](failStage)

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ object SubspaceSource {
private final class SubspaceSource[Entity](
createStream: ExecutionContextExecutor => RefreshingSubspaceStream[Entity])
extends GraphStage[SourceShape[Entity]] {

private val out: Outlet[Entity] = Outlet("SubspaceSource.out")

override def shape: SourceShape[Entity] = SourceShape(out)
Expand All @@ -73,5 +72,4 @@ private final class SubspaceSource[Entity](
override protected def endReached(): Unit = completeStage()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import com.github.pwliwanow.foundationdb4s.core.FriendEntity
import scala.concurrent.duration._

class InfinitePollingSubspaceSourceSpec extends FoundationDbStreamsSpec {

private val entity =
FriendEntity(
ofUserId = 1L,
Expand Down Expand Up @@ -42,5 +41,4 @@ class InfinitePollingSubspaceSourceSpec extends FoundationDbStreamsSpec {
private def entityFromInt(i: Int): FriendEntity = {
entity.copy(addedAt = entity.addedAt.plusSeconds(i.toLong), friendId = entity.friendId + i)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import scala.concurrent.Future
import scala.util.{Failure, Try}

class SubspaceSourceSpec extends FoundationDbStreamsSpec {

private val entity =
FriendEntity(
ofUserId = 1L,
Expand Down Expand Up @@ -92,5 +91,4 @@ class SubspaceSourceSpec extends FoundationDbStreamsSpec {
private def entityFromInt(i: Int): FriendEntity = {
entity.copy(addedAt = entity.addedAt.plusSeconds(i.toLong), friendId = entity.friendId + i)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import scala.compat.java8.FutureConverters._
* - it does not extend [[java.util.Iterator]], so it also does not expose blocking `hasNext()` operation
*/
trait AsyncIterator[A] {

def onHasNext(): Future[Boolean]

/** Similar to [[FdbAsyncIterator.hasNext]] method.
Expand All @@ -24,7 +23,6 @@ trait AsyncIterator[A] {

/** Cancels any outstanding asynchronous work associated with this [[AsyncIterator]]. */
def cancel(): Unit

}

object AsyncIterator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import scala.concurrent.{ExecutionContextExecutor, Future}
import scala.util.Try

final case class DBIO[+A] private (private val underlying: TransactionalM[Transaction, A]) {

def map[B](f: A => B): DBIO[B] = {
DBIO(underlying.map(f))
}
Expand Down Expand Up @@ -206,5 +205,4 @@ object DBIO {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import scala.concurrent.{ExecutionContextExecutor, Future}
import scala.util.Try

final case class ReadDBIO[+A] private (private val underlying: TransactionalM[ReadTransaction, A]) {

def map[B](f: A => B): ReadDBIO[B] = {
ReadDBIO(underlying.map(f))
}
Expand Down Expand Up @@ -111,5 +110,4 @@ object ReadDBIO {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,4 @@ private final class SubspaceStream(
}

private def closeTx(): Unit = Try(tx.foreach(_.close())).getOrElse(())

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import scala.util.Try
* whose Keys contain [[Versionstamp]].
*/
trait SubspaceWithVersionstampedKeys[Entity, Key] extends TypedSubspace[Entity, Key] {

protected def extractVersionstamp(key: Key): Versionstamp

override def toSubspaceKey(key: Key): Array[Byte] = {
Expand All @@ -32,5 +31,4 @@ trait SubspaceWithVersionstampedKeys[Entity, Key] extends TypedSubspace[Entity,
else Try(tx.mutate(MutationType.SET_VERSIONSTAMPED_KEY, packedKey, packedValue))
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import scala.util.Try
* otherwise it would not be possible to use [[Versionstamp]] correctly.
*/
trait SubspaceWithVersionstampedValues[Entity, Key] extends TypedSubspace[Entity, Key] {

protected def extractVersionstamp(entity: Entity): Versionstamp
protected def toTupledValue(entity: Entity): Tuple
protected def toEntity(key: Key, tupledValue: Tuple): Entity
Expand All @@ -35,5 +34,4 @@ trait SubspaceWithVersionstampedValues[Entity, Key] extends TypedSubspace[Entity
else Try(tx.mutate(MutationType.SET_VERSIONSTAMPED_VALUE, packedKey, packedValue))
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ private[foundationdb4s] object CompletableFutureHolder {

private[foundationdb4s] class CompletableFutureHolder[A](val value: CompletableFuture[A])
extends AnyVal {

def completeWithTry(result: Try[A]): Boolean = result match {
case Success(v) => value.complete(v)
case Failure(t) => value.completeExceptionally(t)
Expand Down Expand Up @@ -52,5 +51,4 @@ private[foundationdb4s] class CompletableFutureHolder[A](val value: CompletableF
def zip[B](other: CompletableFuture[B]): CompletableFuture[(A, B)] = {
value.thenCompose(a => other.thenApply(b => (a, b)))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@ private[foundationdb4s] abstract class TransactionalM[Tx <: ReadTransactionConte
}
}
}

}

private[foundationdb4s] object TransactionalM {

private[foundationdb4s] def pure[Tx <: ReadTransactionContext, A](
value: A): TransactionalM[Tx, A] = {
Pure(value)
Expand Down Expand Up @@ -103,5 +101,4 @@ private[foundationdb4s] object TransactionalM {

private final case class RaiseError[Tx <: ReadTransactionContext, A](ex: Throwable)
extends TransactionalM[Tx, A]

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import scala.concurrent.blocking
import scala.util.{Failure, Success, Try}

class DBIOSpec extends FoundationDbSpec {

private val monadLaws = MonadLaws[DBIO]
private val applicativeLaws = ApplicativeLaws[DBIO.Par]
private val parLaws = ParallelLaws[DBIO, DBIO.Par]
Expand Down Expand Up @@ -253,5 +252,4 @@ class DBIOSpec extends FoundationDbSpec {
private def assertParDbioEq[A](isEq: IsEq[DBIO.Par[A]]): Assertion = {
assertDbioEq(IsEq(Par.unwrap(isEq.lhs), Par.unwrap(isEq.rhs)))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ trait FoundationDbSpec extends FlatSpecLike with TableDrivenPropertyChecks with
case _ =>
assert(left === right)
}

}

final case class FriendEntity(ofUserId: Long, addedAt: Instant, friendId: Long, friendName: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import scala.concurrent.blocking
import scala.util.Try

class ReadDBIOSpec extends FoundationDbSpec {

private val monadLaws = MonadLaws[ReadDBIO]
private val applicativeLaws = ApplicativeLaws[ReadDBIO.Par]
private val parLaws = ParallelLaws[ReadDBIO, ReadDBIO.Par]
Expand Down Expand Up @@ -226,5 +225,4 @@ class ReadDBIOSpec extends FoundationDbSpec {
private def assertParDbioEq[A](isEq: IsEq[ReadDBIO.Par[A]]): Assertion = {
assertReadDbioEq(IsEq(ReadDBIO.Par.unwrap(isEq.lhs), ReadDBIO.Par.unwrap(isEq.rhs)))
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class RefreshingSubspaceStreamSpec
extends FoundationDbSpec
with MockitoSugar
with BeforeAndAfterAll {

private val entity =
FriendEntity(
ofUserId = 1L,
Expand Down Expand Up @@ -301,5 +300,4 @@ class RefreshingSubspaceStreamSpec
override def cancel(): Unit = underlying.cancel()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ class SubspaceWithVersionstampedKeysSpec extends FoundationDbSpec { spec =>
assert(futureResult.await === Some(Event(versionstamp, value)))
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ class SubspaceWithVersionstampedValuesSpec extends FoundationDbSpec { spec =>
assert(result === Some(Event(key, versionstamp)))
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -339,5 +339,4 @@ class TypedSubspaceSpec extends FoundationDbSpec { spec =>
val v = new Tuple().add(entity.friendId).add(entity.friendName)
k -> v
}

}
1 change: 0 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import sbt._
import scala.collection.immutable.Seq

object Dependencies {

lazy val allAkkaStreamsDependencies: Seq[ModuleID] = {
val akkaVersion = "2.5.26"
val akkaStreams = "com.typesafe.akka" %% "akka-stream" % akkaVersion
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.2.1")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.12")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ abstract class ReprDecoder[A] extends TupleDecoder[A]

/** Provides automatic derivation for HList-based structures. */
object ReprDecoder {

implicit object HnilDecoder extends ReprDecoder[HNil] {
override def decode(tuple: Tuple): HNil = HNil
override def decode(tuple: Tuple, index: Int): HNil = HNil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ abstract class ReprEncoder[A] extends TupleEncoder[A]

/** Provides automatic derivation for HList-based structures. */
object ReprEncoder {

implicit object HnilEncoder extends ReprEncoder[HNil] {
override def encode(value: HNil): Tuple = new Tuple()
override def encode(value: HNil, acc: Tuple, preceedingNulls: Int): (Tuple, Int) =
Expand All @@ -43,5 +42,4 @@ object ReprEncoder {
tEncoder.value.encode(t, hEncoded, numberOfNulls)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ trait Prefix[L <: HList, Prefix <: HList] extends Serializable {
object Prefix extends PrefixDerivation

trait PrefixDerivation {

implicit def hlistPrefixNil[L <: HList]: Prefix[L, HNil] = new Prefix[L, HNil] {
override def apply(x: L): HNil = HNil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ trait Schema { schema =>
keyDecoder: ReprDecoder[KeySchema],
valueDecoder: ReprDecoder[ValueSchema])
extends TypedSubspace[Entity, KeySchema] {

final override def toKey(entity: Entity): KeySchema = schema.toKey(entity)

final override def toRawValue(entity: Entity): Array[Byte] =
Expand Down Expand Up @@ -187,7 +186,5 @@ trait Schema { schema =>
new Range(start, end)
}
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ trait TupleDecoder[A] { self =>
}

object TupleDecoder extends BasicDecodersProtocol {

/** Derives [[TupleDecoder]] for [[A]] type parameter.
*
* Derivation will succeed only if there exist implicit
Expand All @@ -39,7 +38,6 @@ object TupleDecoder extends BasicDecodersProtocol {
}

trait BasicDecodersProtocol {

implicit object IntDecoder extends TupleDecoder[Int] {
override def decode(tuple: Tuple): Int = decode(tuple, 0)
override def decode(tuple: Tuple, index: Int): Int = decodeInt(tuple.getBytes(index))
Expand Down Expand Up @@ -101,5 +99,4 @@ trait BasicDecodersProtocol {
if (value.length != 4) throw new IllegalArgumentException("Array must be of size 4")
ByteBuffer.wrap(value).getInt
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ trait TupleEncoder[A] { self =>
}

object TupleEncoder extends BasicEncoders {

/** Derives [[TupleEncoder]] for [[A]] type parameter.
*
* Derivation will succeed only if there exist implicit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.github.pwliwanow.foundationdb4s.schema.TestCodecs.Age
import org.scalatest.FlatSpec

object TestCodecs {

case class Age(value: Int) extends AnyVal

case class Inner(age: Age)
Expand Down Expand Up @@ -42,7 +41,6 @@ object OverridenCodecs {
}

class EncoderDecoderSpec extends FlatSpec {

it should "encode and decode back values with missing values" in {
import TestCodecs._
val value =
Expand Down Expand Up @@ -262,5 +260,4 @@ class EncoderDecoderSpec extends FlatSpec {
}

private def decodeInt(bytes: Array[Byte]): Int = ByteBuffer.wrap(bytes).getInt

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ object UserSchema extends Schema {
val lastName :: city :: yearOfBirth :: HNil = key
User(UserKey(lastName, city, yearOfBirth), registeredAt)
}

}

class NamespaceSpec extends FoundationDbSpec { spec =>
Expand Down Expand Up @@ -263,5 +262,4 @@ class NamespaceSpec extends FoundationDbSpec { spec =>
}
}
}

}

0 comments on commit a5259f0

Please sign in to comment.