-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
45 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,7 @@ project/plugins/project/ | |
.worksheet | ||
|
||
.idea/ | ||
project/ | ||
project/ | ||
.metals | ||
.bsp | ||
.bloop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"files.watcherExclude": { | ||
"**/target": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package de.khamrakulov.followermaze.controller | |
|
||
import java.util.concurrent.ConcurrentHashMap | ||
|
||
import scala.collection.convert.decorateAsScala._ | ||
import scala.jdk.CollectionConverters._ | ||
|
||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
|
@@ -12,7 +12,7 @@ object ClientController { | |
} | ||
|
||
class ClientController { | ||
val clients = new ConcurrentHashMap[Int, Client]().asScala | ||
val clients = new ConcurrentHashMap[Int, Client]().asScala | ||
|
||
def get(id: Int) = clients.get(id) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package de.khamrakulov.followermaze.controller | |
|
||
import java.util.concurrent.{ConcurrentHashMap, ConcurrentSkipListSet} | ||
|
||
import scala.collection.convert.decorateAsScala._ | ||
import scala.jdk.CollectionConverters._ | ||
|
||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
|
7 changes: 4 additions & 3 deletions
7
src/test/scala/de/khamrakulov/followermaze/controller/ClientControllerSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
package de.khamrakulov.followermaze.controller | ||
|
||
import de.khamrakulov.followermaze.nio.NioClientImpl | ||
import org.scalatest.mockito.MockitoSugar | ||
import org.scalatest.{FlatSpec, Matchers} | ||
import org.scalatestplus.mockito.MockitoSugar | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
*/ | ||
class ClientControllerSpec extends FlatSpec with Matchers with MockitoSugar { | ||
class ClientControllerSpec extends AnyFlatSpec with Matchers with MockitoSugar { | ||
"ClientController" should "add and get clients" in { | ||
val controller = ClientController() | ||
val client = mock[NioClientImpl] | ||
|
5 changes: 3 additions & 2 deletions
5
src/test/scala/de/khamrakulov/followermaze/controller/FollowControllerSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
package de.khamrakulov.followermaze.controller | ||
|
||
import org.scalatest.{FlatSpec, Matchers} | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
*/ | ||
class FollowControllerSpec extends FlatSpec with Matchers { | ||
class FollowControllerSpec extends AnyFlatSpec with Matchers { | ||
"FollowController" should "add, get and remove follow relations" in { | ||
val controller = FollowController() | ||
controller.add(1, 2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,15 @@ package de.khamrakulov.followermaze.controller | |
|
||
import de.khamrakulov.followermaze.{Broadcast, TypedEvent} | ||
import org.mockito.Mockito | ||
import org.scalatest.mockito.MockitoSugar | ||
import org.scalatest.{FlatSpec, Matchers} | ||
import org.scalatestplus.mockito.MockitoSugar | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
|
||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
*/ | ||
class TypedEventSeqControllerSpec extends FlatSpec with Matchers with MockitoSugar { | ||
class TypedEventSeqControllerSpec extends AnyFlatSpec with Matchers with MockitoSugar { | ||
"TypedEventSeqController" should "provide events in correct order" in { | ||
type Handler = TypedEvent => Unit | ||
val handler = mock[Handler] | ||
|
7 changes: 4 additions & 3 deletions
7
src/test/scala/de/khamrakulov/followermaze/event/ParserSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package de.khamrakulov.followermaze.event | ||
|
||
import de.khamrakulov.followermaze._ | ||
import org.scalatest._ | ||
|
||
import org.scalatestplus.mockito.MockitoSugar | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
*/ | ||
class ParserSpec extends FlatSpec with Matchers { | ||
class ParserSpec extends AnyFlatSpec with Matchers { | ||
val followString = "666|F|60|50" | ||
val unfollowString = "666|U|60|50" | ||
val broadcastString = "666|B" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,14 @@ import de.khamrakulov.followermaze._ | |
import de.khamrakulov.followermaze.controller.{ClientController, FollowController} | ||
import de.khamrakulov.followermaze.nio.NioClientImpl | ||
import org.mockito.Mockito | ||
import org.scalatest.mockito.MockitoSugar | ||
import org.scalatest.{FlatSpec, Matchers} | ||
import org.scalatestplus.mockito.MockitoSugar | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
*/ | ||
class RouterSpec extends FlatSpec with Matchers with MockitoSugar { | ||
class RouterSpec extends AnyFlatSpec with Matchers with MockitoSugar { | ||
"Router" should "correctly route events" in { | ||
val service = Executors.newSingleThreadExecutor() | ||
val in = new LinkedBlockingQueue[TypedEvent]() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,14 +7,15 @@ import java.util.concurrent.{LinkedBlockingQueue, TimeUnit, Future => JFuture} | |
import de.khamrakulov.followermaze.UntypedEvent | ||
import org.mockito.invocation.InvocationOnMock | ||
import org.mockito.stubbing.Answer | ||
import org.mockito.{Mockito, Matchers => M} | ||
import org.scalatest.mockito.MockitoSugar | ||
import org.scalatest.{FlatSpec, Matchers} | ||
import org.mockito.{Mockito, ArgumentMatchers => M} | ||
import org.scalatestplus.mockito.MockitoSugar | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
*/ | ||
class UntypedEventSourceSpec extends FlatSpec with Matchers with MockitoSugar { | ||
class UntypedEventSourceSpec extends AnyFlatSpec with Matchers with MockitoSugar { | ||
def getSocket(output1: String, output2: String) = { | ||
val stringBytes1 = output1.getBytes("utf-8") | ||
val stringBytes2 = output2.getBytes("utf-8") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,13 @@ package de.khamrakulov.followermaze.event.transformer | |
import java.util.concurrent.{Executors, LinkedBlockingQueue, TimeUnit} | ||
|
||
import de.khamrakulov.followermaze._ | ||
import org.scalatest.{FlatSpec, Matchers} | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
/** | ||
* @author Timur Khamrakulov <[email protected]>. | ||
*/ | ||
class ToTypedEventTransformerSpec extends FlatSpec with Matchers { | ||
class ToTypedEventTransformerSpec extends AnyFlatSpec with Matchers { | ||
"ToTypedEventTransformer" should "correctly transform events" in { | ||
val in = new LinkedBlockingQueue[UntypedEvent]() | ||
in.add(UntypedEvent("1|F|2|3")) | ||
|