replace unicode arrows

* ⇒, →, ←
* because we don't want to show them in documentation snippets and
  then it's complicated to avoid that when snippets are
  located in src/test/scala in individual modules
* dont replace object `→` in FSM.scala and PersistentFSM.scala
This commit is contained in:
Patrik Nordwall 2019-02-09 15:25:39 +01:00
parent e4d38f92a4
commit 5c96a5f556
1521 changed files with 18846 additions and 18786 deletions

View file

@ -77,41 +77,41 @@ object ReplicatorMapDeltaSpec extends MultiNodeConfig {
def consistency(): WriteConsistency = {
rnd.nextInt(100) match {
case n if n < 90 WriteLocal
case n if n < 95 writeTwo
case n if n < 100 writeMajority
case n if n < 90 => WriteLocal
case n if n < 95 => writeTwo
case n if n < 100 => writeMajority
}
}
def rndPnCounterkey(): (PNCounterMapKey[String], String) = {
rnd.nextInt(3) match {
case 0 KeyA
case 1 KeyB
case 2 KeyC
case 0 => KeyA
case 1 => KeyB
case 2 => KeyC
}
}
def rndOrSetkeyVD(): (ORMultiMapKey[String, String], String) = {
rnd.nextInt(3) match {
case 0 KeyD
case 1 KeyE
case 2 KeyF
case 0 => KeyD
case 1 => KeyE
case 2 => KeyF
}
}
def rndOrSetkeyNoVD(): (ORMultiMapKey[String, String], String) = {
rnd.nextInt(3) match {
case 0 KeyG
case 1 KeyH
case 2 KeyI
case 0 => KeyG
case 1 => KeyH
case 2 => KeyI
}
}
def rndOrSetkeyOM(): (ORMapKey[String, ORSet[String]], String) = {
rnd.nextInt(3) match {
case 0 KeyJ
case 1 KeyK
case 2 KeyL
case 0 => KeyJ
case 1 => KeyK
case 2 => KeyL
}
}
@ -131,12 +131,12 @@ object ReplicatorMapDeltaSpec extends MultiNodeConfig {
availableForRemove.toVector(rnd.nextInt(availableForRemove.size))
}
(0 to (50 + rnd.nextInt(10))).map { _
(0 to (50 + rnd.nextInt(10))).map { _ =>
rnd.nextInt(6) match {
case 0 Delay(rnd.nextInt(500))
case 1 Incr(rndPnCounterkey(), rnd.nextInt(100), consistency())
case 2 Decr(rndPnCounterkey(), rnd.nextInt(10), consistency())
case 3
case 0 => Delay(rnd.nextInt(500))
case 1 => Incr(rndPnCounterkey(), rnd.nextInt(100), consistency())
case 2 => Decr(rndPnCounterkey(), rnd.nextInt(10), consistency())
case 3 =>
// ORMultiMap.withValueDeltas
val key = rndOrSetkeyVD()
// only removals for KeyF on node first
@ -144,7 +144,7 @@ object ReplicatorMapDeltaSpec extends MultiNodeConfig {
RemoveVD(key, rndRemoveElement(), consistency())
else
AddVD(key, rndAddElement(), consistency())
case 4
case 4 =>
// ORMultiMap - vanilla variant - without Value Deltas
val key = rndOrSetkeyNoVD()
// only removals for KeyI on node first
@ -152,7 +152,7 @@ object ReplicatorMapDeltaSpec extends MultiNodeConfig {
RemoveNoVD(key, rndRemoveElement(), consistency())
else
AddNoVD(key, rndAddElement(), consistency())
case 5
case 5 =>
// Vanilla ORMap - with ORSet inside
val key = rndOrSetkeyOM()
// only removals for KeyL on node first
@ -241,21 +241,21 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
runOn(first) {
// by setting something for each key we don't have to worry about NotFound
List(KeyA, KeyB, KeyC).foreach { key
List(KeyA, KeyB, KeyC).foreach { key =>
fullStateReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_.incrementBy(key._2, 1))
deltaReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_.incrementBy(key._2, 1))
}
List(KeyD, KeyE, KeyF).foreach { key
fullStateReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ :+ (key._2 Set("a")))
deltaReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ :+ (key._2 Set("a")))
List(KeyD, KeyE, KeyF).foreach { key =>
fullStateReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ :+ (key._2 -> Set("a")))
deltaReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ :+ (key._2 -> Set("a")))
}
List(KeyG, KeyH, KeyI).foreach { key
fullStateReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ :+ (key._2 Set("a")))
deltaReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ :+ (key._2 Set("a")))
List(KeyG, KeyH, KeyI).foreach { key =>
fullStateReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ :+ (key._2 -> Set("a")))
deltaReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ :+ (key._2 -> Set("a")))
}
List(KeyJ, KeyK, KeyL).foreach { key
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(_ :+ (key._2 (ORSet.empty :+ "a")))
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(_ :+ (key._2 (ORSet.empty :+ "a")))
List(KeyJ, KeyK, KeyL).foreach { key =>
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(_ :+ (key._2 -> (ORSet.empty :+ "a")))
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(_ :+ (key._2 -> (ORSet.empty :+ "a")))
}
}
enterBarrier("updated-1")
@ -263,28 +263,28 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
within(5.seconds) {
awaitAssert {
val p = TestProbe()
List(KeyA, KeyB, KeyC).foreach { key
List(KeyA, KeyB, KeyC).foreach { key =>
fullStateReplicator.tell(Get(key._1, ReadLocal), p.ref)
p.expectMsgType[GetSuccess[PNCounterMap[String]]].dataValue.get(key._2).get.intValue should be(1)
}
}
awaitAssert {
val p = TestProbe()
List(KeyD, KeyE, KeyF).foreach { key
List(KeyD, KeyE, KeyF).foreach { key =>
fullStateReplicator.tell(Get(key._1, ReadLocal), p.ref)
p.expectMsgType[GetSuccess[ORMultiMap[String, String]]].dataValue.get(key._2) should ===(Some(Set("a")))
}
}
awaitAssert {
val p = TestProbe()
List(KeyG, KeyH, KeyI).foreach { key
List(KeyG, KeyH, KeyI).foreach { key =>
fullStateReplicator.tell(Get(key._1, ReadLocal), p.ref)
p.expectMsgType[GetSuccess[ORMultiMap[String, String]]].dataValue.get(key._2) should ===(Some(Set("a")))
}
}
awaitAssert {
val p = TestProbe()
List(KeyJ, KeyK, KeyL).foreach { key
List(KeyJ, KeyK, KeyL).foreach { key =>
fullStateReplicator.tell(Get(key._1, ReadLocal), p.ref)
val res = p.expectMsgType[GetSuccess[ORMap[String, ORSet[String]]]].dataValue.get(key._2)
res.map(_.elements) should ===(Some(Set("a")))
@ -300,7 +300,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
val errorLogProbe = TestProbe()
system.eventStream.subscribe(errorLogProbe.ref, classOf[Error])
runOn(first) {
for (_ 1 to N; key List(KeyA, KeyB)) {
for (_ <- 1 to N; key <- List(KeyA, KeyB)) {
ordinaryReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_.incrementBy(key._2, 1))
}
}
@ -309,7 +309,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
within(5.seconds) {
awaitAssert {
val p = TestProbe()
List(KeyA, KeyB).foreach { key
List(KeyA, KeyB).foreach { key =>
ordinaryReplicator.tell(Get(key._1, ReadLocal), p.ref)
p.expectMsgType[GetSuccess[PNCounterMap[String]]].dataValue.get(key._2).get.intValue should be(N)
}
@ -330,58 +330,58 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
// perform random operations with both delta and full-state replicators
// and compare that the end result is the same
for (op operations) {
for (op <- operations) {
log.debug("operation: {}", op)
op match {
case Delay(d) Thread.sleep(d)
case Incr(key, n, _)
case Delay(d) => Thread.sleep(d)
case Incr(key, n, _) =>
fullStateReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_ incrementBy (key._2, n))
deltaReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_ incrementBy (key._2, n))
case Decr(key, n, _)
case Decr(key, n, _) =>
fullStateReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_ decrementBy (key._2, n))
deltaReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_ decrementBy (key._2, n))
case AddVD(key, elem, _)
case AddVD(key, elem, _) =>
// to have an deterministic result when mixing add/remove we can only perform
// the ORSet operations from one node
runOn((if (key == KeyF) List(first) else List(first, second, third)): _*) {
fullStateReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ addBindingBy (key._2, elem))
deltaReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ addBindingBy (key._2, elem))
}
case RemoveVD(key, elem, _)
case RemoveVD(key, elem, _) =>
runOn(first) {
fullStateReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ removeBindingBy (key._2, elem))
deltaReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ removeBindingBy (key._2, elem))
}
case AddNoVD(key, elem, _)
case AddNoVD(key, elem, _) =>
// to have an deterministic result when mixing add/remove we can only perform
// the ORSet operations from one node
runOn((if (key == KeyI) List(first) else List(first, second, third)): _*) {
fullStateReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ addBindingBy (key._2, elem))
deltaReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ addBindingBy (key._2, elem))
}
case RemoveNoVD(key, elem, _)
case RemoveNoVD(key, elem, _) =>
runOn(first) {
fullStateReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ removeBindingBy (key._2, elem))
deltaReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ removeBindingBy (key._2, elem))
}
case AddOM(key, elem, _)
case AddOM(key, elem, _) =>
// to have an deterministic result when mixing add/remove we can only perform
// the ORSet operations from one node
runOn((if (key == KeyL) List(first) else List(first, second, third)): _*) {
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om addElementToORMap(om, key._2, elem))
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om addElementToORMap(om, key._2, elem))
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om => addElementToORMap(om, key._2, elem))
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om => addElementToORMap(om, key._2, elem))
}
case RemoveOM(key, elem, _)
case RemoveOM(key, elem, _) =>
runOn(first) {
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om removeElementFromORMap(om, key._2, elem))
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om removeElementFromORMap(om, key._2, elem))
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om => removeElementFromORMap(om, key._2, elem))
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om => removeElementFromORMap(om, key._2, elem))
}
}
}
enterBarrier("updated-3")
List(KeyA, KeyB, KeyC).foreach { key
List(KeyA, KeyB, KeyC).foreach { key =>
within(5.seconds) {
awaitAssert {
val p = TestProbe()
@ -394,7 +394,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
}
}
List(KeyD, KeyE, KeyF).foreach { key
List(KeyD, KeyE, KeyF).foreach { key =>
within(5.seconds) {
awaitAssert {
val p = TestProbe()
@ -407,7 +407,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
}
}
List(KeyG, KeyH, KeyI).foreach { key
List(KeyG, KeyH, KeyI).foreach { key =>
within(5.seconds) {
awaitAssert {
val p = TestProbe()
@ -420,7 +420,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
}
}
List(KeyJ, KeyK, KeyL).foreach { key
List(KeyJ, KeyK, KeyL).foreach { key =>
within(5.seconds) {
awaitAssert {
val p = TestProbe()
@ -435,7 +435,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
enterBarrierAfterTestStep()
} catch {
case e: Throwable
case e: Throwable =>
info(s"random operations on [${myself.name}]: ${operations.mkString(", ")}")
throw e
}