-
Notifications
You must be signed in to change notification settings - Fork 625
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
16 changed files
with
143 additions
and
40 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
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
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,24 @@ | ||
# This is a sample configuration for the database cloner tool | ||
|
||
# Configuration of the source database (same format as in application.conf) | ||
from.db.janusgraph { | ||
storage { | ||
// backend: cql | ||
// hostname: ["ip1", "ip2"] | ||
} | ||
index.search { | ||
backend: lucene | ||
directory: /opt/thp/thehive/index | ||
} | ||
} | ||
# Configuration of the target database | ||
to.db.janusgraph { | ||
storage { | ||
// backend: cql | ||
// hostname: ["ip1", "ip2"] | ||
} | ||
index.search { | ||
backend: lucene | ||
directory: /opt/thp/thehive/otherIndex | ||
} | ||
} |
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 |
---|---|---|
|
@@ -117,3 +117,4 @@ to { | |
} | ||
} | ||
batchSize: 100 | ||
force: false |
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
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
34 changes: 34 additions & 0 deletions
34
thehive/test/org/thp/thehive/services/CaseNumberTest.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.thp.thehive.services | ||
|
||
import akka.actor.ExtendedActorSystem | ||
import akka.actor.typed.ActorSystem | ||
import akka.actor.typed.scaladsl.Behaviors | ||
import org.thp.thehive.TestAppBuilder | ||
import play.api.test.PlaySpecification | ||
|
||
class CaseNumberTest extends PlaySpecification with TestAppBuilder { | ||
|
||
"case number actor" should { | ||
"serialize and deserialize messages" in withActorSystem { system => | ||
val ref = system.deadLetters[CaseNumberActor.Response] | ||
val sut = new CaseNumberSerializer(system.classicSystem.asInstanceOf[ExtendedActorSystem]) | ||
|
||
val messages = Seq( | ||
CaseNumberActor.GetNextNumber(ref), | ||
CaseNumberActor.NextNumber(42), | ||
CaseNumberActor.NextNumber(Int.MaxValue) | ||
) | ||
val out = messages.map(message => sut.toBinary(message)) | ||
|
||
val result = out.map(bin => sut.fromBinary(bin)) | ||
|
||
result must beEqualTo(messages) | ||
} | ||
} | ||
|
||
private def withActorSystem[T](body: ActorSystem[Nothing] => T) = { | ||
val system = ActorSystem(Behaviors.empty, "test") | ||
try body(system) | ||
finally system.terminate() | ||
} | ||
} |