diff options
author | vlad <vlad@driver.xyz> | 2017-06-13 16:15:07 -0700 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-06-13 16:15:07 -0700 |
commit | 91a4120b4253dc4a1e9552ec39fcb25c303a21e1 (patch) | |
tree | 9173797ed8e3d780f98ac8d0f85507eeb10c8016 /src/test/scala/xyz/driver/pdsuicommon/concurrent | |
parent | cd1b635b2ae90d9ac2d8b1779183a1fbd8c5fd5c (diff) | |
download | rest-query-d55b202095f733138d5583966984c22e102c08f8.tar.gz rest-query-d55b202095f733138d5583966984c22e102c08f8.tar.bz2 rest-query-d55b202095f733138d5583966984c22e102c08f8.zip |
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuicommon/concurrent')
-rw-r--r-- | src/test/scala/xyz/driver/pdsuicommon/concurrent/BridgeUploadQueueRepositoryAdapterSuite.scala | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/src/test/scala/xyz/driver/pdsuicommon/concurrent/BridgeUploadQueueRepositoryAdapterSuite.scala b/src/test/scala/xyz/driver/pdsuicommon/concurrent/BridgeUploadQueueRepositoryAdapterSuite.scala index c0bb1a2..48a4eaf 100644 --- a/src/test/scala/xyz/driver/pdsuicommon/concurrent/BridgeUploadQueueRepositoryAdapterSuite.scala +++ b/src/test/scala/xyz/driver/pdsuicommon/concurrent/BridgeUploadQueueRepositoryAdapterSuite.scala @@ -29,11 +29,11 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { "a new interval should be greater than the previous one if the limit not reached" in { val previous = strategy.on(1) - val current = strategy.on(2) + val current = strategy.on(2) (previous, current) match { case (OnAttempt.Continue(a), OnAttempt.Continue(b)) => assert(a < b) - case x => fail(s"Unexpected result: $x") + case x => fail(s"Unexpected result: $x") } } @@ -52,11 +52,12 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { "should return an updated item" in { val repository = new BridgeUploadQueueRepository { - override def update(draft: EntityT): EntityT = draft - override def delete(id: IdT): Unit = {} - override def add(draft: EntityT): EntityT = fail("add should not be used!") + override def update(draft: EntityT): EntityT = draft + override def delete(id: IdT): Unit = {} + override def add(draft: EntityT): EntityT = fail("add should not be used!") override def getById(id: LongId[EntityT]): Option[EntityT] = fail("getById should not be used!") - override def isCompleted(kind: String, tag: String): Future[Boolean] = fail("isCompleted should not be used!") + override def isCompleted(kind: String, tag: String): Future[Boolean] = + fail("isCompleted should not be used!") override def getOne(kind: String): Future[Option[Item]] = fail("getOne should not be used!") } @@ -67,7 +68,7 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { ) val item = defaultItem - val r = adapter.tryRetry(item).futureValue + val r = adapter.tryRetry(item).futureValue assert(r.isDefined) assert(!r.contains(item)) } @@ -80,10 +81,11 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { assert(draft.attempts === (item.attempts + 1), "repository.add") draft } - override def delete(id: IdT): Unit = {} - override def add(draft: EntityT): EntityT = fail("add should not be used!") + override def delete(id: IdT): Unit = {} + override def add(draft: EntityT): EntityT = fail("add should not be used!") override def getById(id: LongId[EntityT]): Option[EntityT] = fail("getById should not be used!") - override def isCompleted(kind: String, tag: String): Future[Boolean] = fail("isCompleted should not be used!") + override def isCompleted(kind: String, tag: String): Future[Boolean] = + fail("isCompleted should not be used!") override def getOne(kind: String): Future[Option[Item]] = fail("getOne should not be used!") } @@ -104,9 +106,10 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { override def delete(id: IdT): Unit = { assert(id == item.id, "repository.delete") } - override def add(draft: EntityT): EntityT = fail("add should not be used!") + override def add(draft: EntityT): EntityT = fail("add should not be used!") override def getById(id: LongId[EntityT]): Option[EntityT] = fail("getById should not be used!") - override def isCompleted(kind: String, tag: String): Future[Boolean] = fail("isCompleted should not be used!") + override def isCompleted(kind: String, tag: String): Future[Boolean] = + fail("isCompleted should not be used!") override def getOne(kind: String): Future[Option[Item]] = fail("getOne should not be used!") } @@ -127,10 +130,11 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { assert(draft.nextAttempt.isAfter(item.nextAttempt), "repository.add") draft } - override def delete(id: IdT): Unit = {} - override def add(draft: EntityT): EntityT = fail("add should not be used!") + override def delete(id: IdT): Unit = {} + override def add(draft: EntityT): EntityT = fail("add should not be used!") override def getById(id: LongId[EntityT]): Option[EntityT] = fail("getById should not be used!") - override def isCompleted(kind: String, tag: String): Future[Boolean] = fail("isCompleted should not be used!") + override def isCompleted(kind: String, tag: String): Future[Boolean] = + fail("isCompleted should not be used!") override def getOne(kind: String): Future[Option[Item]] = fail("getOne should not be used!") } @@ -151,11 +155,12 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { "should not return an item" in { val repository = new BridgeUploadQueueRepository { - override def delete(id: IdT): Unit = {} - override def update(entity: EntityT): EntityT = fail("update should not be used!") - override def add(draft: EntityT): EntityT = fail("add should not be used!") + override def delete(id: IdT): Unit = {} + override def update(entity: EntityT): EntityT = fail("update should not be used!") + override def add(draft: EntityT): EntityT = fail("add should not be used!") override def getById(id: LongId[EntityT]): Option[EntityT] = fail("getById should not be used!") - override def isCompleted(kind: String, tag: String): Future[Boolean] = fail("isCompleted should not be used!") + override def isCompleted(kind: String, tag: String): Future[Boolean] = + fail("isCompleted should not be used!") override def getOne(kind: String): Future[Option[Item]] = fail("getOne should not be used!") } @@ -171,11 +176,12 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { "should not add any item to the queue" in { val repository = new BridgeUploadQueueRepository { - override def update(draft: EntityT): EntityT = throw new IllegalAccessException("add should not be called") - override def delete(id: IdT): Unit = {} - override def add(draft: EntityT): EntityT = fail("add should not be used!") + override def update(draft: EntityT): EntityT = throw new IllegalAccessException("add should not be called") + override def delete(id: IdT): Unit = {} + override def add(draft: EntityT): EntityT = fail("add should not be used!") override def getById(id: LongId[EntityT]): Option[EntityT] = fail("getById should not be used!") - override def isCompleted(kind: String, tag: String): Future[Boolean] = fail("isCompleted should not be used!") + override def isCompleted(kind: String, tag: String): Future[Boolean] = + fail("isCompleted should not be used!") override def getOne(kind: String): Future[Option[Item]] = fail("getOne should not be used!") } @@ -193,10 +199,11 @@ class BridgeUploadQueueRepositoryAdapterSuite extends BaseSuite { override def delete(id: IdT): Unit = { assert(id == defaultItem.id, "repository.delete") } - override def update(entity: EntityT): EntityT = fail("update should not be used!") - override def add(draft: EntityT): EntityT = fail("add should not be used!") + override def update(entity: EntityT): EntityT = fail("update should not be used!") + override def add(draft: EntityT): EntityT = fail("add should not be used!") override def getById(id: LongId[EntityT]): Option[EntityT] = fail("getById should not be used!") - override def isCompleted(kind: String, tag: String): Future[Boolean] = fail("isCompleted should not be used!") + override def isCompleted(kind: String, tag: String): Future[Boolean] = + fail("isCompleted should not be used!") override def getOne(kind: String): Future[Option[Item]] = fail("getOne should not be used!") } |