Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FIT-Connect-SDK - Java
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIT-Connect
FIT-Connect-SDK - Java
Commits
985c6f5f
Commit
985c6f5f
authored
2 years ago
by
Martin Vogel
Browse files
Options
Downloads
Patches
Plain Diff
fix: add missed test that was removed on the laste merge
parent
7872148a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/src/test/java/dev/fitko/fitconnect/client/SubscriberClientTest.java
+52
-0
52 additions, 0 deletions
...ava/dev/fitko/fitconnect/client/SubscriberClientTest.java
with
52 additions
and
0 deletions
client/src/test/java/dev/fitko/fitconnect/client/SubscriberClientTest.java
+
52
−
0
View file @
985c6f5f
...
...
@@ -357,6 +357,58 @@ class SubscriberClientTest {
assertThat
(
receivedSubmission
.
getSubmissionMetadata
().
getContentStructure
().
getData
().
getHash
().
getContent
(),
is
(
"bla"
));
}
@Test
void
testUnknownAdditionalReferenceInfoProperty
()
throws
JsonProcessingException
{
final
var
dataPayload
=
"{ some : 'data foo' }"
;
final
var
submissionId
=
UUID
.
randomUUID
();
final
CryptoService
cryptoService
=
new
JWECryptoService
(
new
HashService
());
final
Map
<
String
,
Map
<
String
,
Object
>>
metadata
=
Map
.
of
(
"contentStructure"
,
Map
.
of
(
"data"
,
Map
.
of
(
"hash"
,
Map
.
of
(
"type"
,
SignatureType
.
SHA_512
,
"content"
,
cryptoService
.
hashBytes
(
dataPayload
.
getBytes
())
),
"submissionSchema"
,
Map
.
of
(
"schemaUri"
,
URI
.
create
(
"https://dummy.schema.url"
),
"mimeType"
,
MimeType
.
APPLICATION_JSON
)
),
"attachments"
,
Collections
.
EMPTY_LIST
),
"additionalReferenceInfo"
,
Map
.
of
(
"x-sender"
,
"SOME_ADDITIONAL_UNKNOWN_PROPERTY"
,
"senderReference"
,
"sender_123"
)
);
final
byte
[]
metadataBytes
=
mapper
.
writeValueAsBytes
(
metadata
);
final
RSAKey
encryptionKey
=
privateKey
;
final
RSAKey
decryptionKey
=
encryptionKey
.
toPublicJWK
();
final
String
encryptedData
=
cryptoService
.
encryptString
(
decryptionKey
,
dataPayload
);
final
String
encryptedMetadata
=
cryptoService
.
encryptBytes
(
decryptionKey
,
metadataBytes
);
final
var
submission
=
new
Submission
();
submission
.
setSubmissionId
(
submissionId
);
submission
.
setEncryptedData
(
encryptedData
);
submission
.
setEncryptedMetadata
(
encryptedMetadata
);
when
(
subscriberMock
.
getSubmission
(
any
())).
thenReturn
(
submission
);
when
(
subscriberMock
.
validateMetadata
(
any
())).
thenReturn
(
ValidationResult
.
ok
());
when
(
subscriberMock
.
validateHashIntegrity
(
any
(),
any
())).
thenReturn
(
ValidationResult
.
ok
());
when
(
subscriberMock
.
decryptStringContent
(
encryptionKey
,
submission
.
getEncryptedData
())).
thenReturn
(
dataPayload
.
getBytes
());
when
(
subscriberMock
.
decryptStringContent
(
encryptionKey
,
submission
.
getEncryptedMetadata
())).
thenReturn
(
metadataBytes
);
// When
final
var
receivedSubmission
=
underTest
.
requestSubmission
(
submissionId
);
// Then
assertNotNull
(
receivedSubmission
.
getSubmissionMetadata
());
assertThat
(
receivedSubmission
.
getSubmissionMetadata
().
getAdditionalReferenceInfo
().
getSenderReference
(),
is
(
"sender_123"
));
}
@Test
void
testCorruptedData
()
throws
JsonProcessingException
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment