-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove InstantSerializer from methods as it was causing json conversi…
…on issues
- Loading branch information
1 parent
f8cb78f
commit 1704d7f
Showing
11 changed files
with
49 additions
and
15 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package stix.end2end | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import io.digitalstate.stix.bundle.Bundle | ||
import io.digitalstate.stix.json.StixParsers | ||
import io.digitalstate.stix.sdo.objects.AttackPattern | ||
import io.digitalstate.stix.sdo.objects.Indicator | ||
import io.digitalstate.stix.sdo.objects.IndicatorSdo | ||
import io.digitalstate.stix.sdo.objects.Report | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
import java.time.Instant | ||
|
||
class IndicatorSdoSpec extends Specification { | ||
|
||
@Shared ObjectMapper mapper = new ObjectMapper() | ||
|
||
def "Create Indicator SDO and cycle from object to Json back to object"() { | ||
|
||
when: "a objects are created," | ||
IndicatorSdo indicator1 = Indicator.builder() | ||
.addLabels("malicious-activity") | ||
.name("some name") | ||
.validFrom(Instant.now()) | ||
.pattern("some pattern") | ||
.build() | ||
|
||
then: "Create a Report and Add Attack Patterns as Report Objects" | ||
|
||
println indicator1.toJsonString() | ||
String indicator1Json = indicator1.toJsonString() | ||
|
||
println StixParsers.parseObject(indicator1Json).inspect() | ||
|
||
and: "Create a bundle with the indicator" | ||
Bundle bundle = Bundle.builder() | ||
.addObjects(indicator1) | ||
.build() | ||
|
||
println bundle.toJsonString() | ||
|
||
println StixParsers.parseBundle(bundle.toJsonString()).inspect() | ||
|
||
} | ||
|
||
} |