created TLP classes as defined in spec#97
created TLP classes as defined in spec#97anlklsim wants to merge 9 commits intoStephenOTT:masterfrom
Conversation
|
Great stuff. I am waiting for a response on this: oasis-tcs/cti-stix2#152 before merging. The extreme limitation on the TLPs is very weird, and would like to document its usage before we implement the rest of the TLPs Further tasks:
|
src/main/java/io/digitalstate/stix/datamarkings/objects/Tlps.java
Outdated
Show resolved
Hide resolved
src/main/java/io/digitalstate/stix/datamarkings/objects/Tlps.java
Outdated
Show resolved
Hide resolved
src/main/java/io/digitalstate/stix/datamarkings/objects/Tlps.java
Outdated
Show resolved
Hide resolved
| import spock.lang.Shared | ||
| import spock.lang.Specification | ||
|
|
||
| /** |
There was a problem hiding this comment.
- review usage of author javadoc tag as its starting to be deprecated in tooling like apache and gradle
| MarkingDefinition green = Tlps.TLP_GREEN; | ||
| StixInstant now = new StixInstant(); | ||
|
|
||
| Indicator ind = Indicator.builder() |
There was a problem hiding this comment.
Lets move this into a json file similar to the Bundle tests. The current test is basically a duplicate of the mock generation test. The json file tests is a "hardened" data example where the json file represents the "pure" unchanging json to test against
Conflicts: src/test/groovy/stix/datamarkings/TLPmarkingsSpec.groovy
|
@anlklsim what scenario causes the NPE that you fixed for the getCause() ? |
|
I had mistakenly called STIXParsers.parseObject on my bundle in my test, which threw an IOExeption in the method (since it was not a BundleableObject), and the if statement threw an NPE on ex.getClause() and therefore only the NPE was logged in the Junit as the error (hiding the true exception message). Stepping thru the debugger, I saw the error, added the null check, and then the true error printed out. Only then, did I notice that I was calling the wrong method. I added the same check to parseBundle to be complete. |
The STIX spec defines the exact ID and created date for the 4 TLP markings. I defined them in a class as static values and created a test Spec. It's interesting that the markings do not need to be within the bundle.
Note that the Stix Mocking for TLP Marking defs makes up custom properties, but they are not really allowed for the TLP markings.