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
7a6ba42e
Commit
7a6ba42e
authored
2 years ago
by
Martin Vogel
Browse files
Options
Downloads
Patches
Plain Diff
#414 Add new sample calls for clients with minimal steps to send and receive a submission
parent
6cd9ffdf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!2
#414 Remaining changes from MR
,
!1
planning#414 Methoden Signaturen (Zwischenstand)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/src/main/java/de/fitko/fitconnect/TestRunner.java
+19
-17
19 additions, 17 deletions
client/src/main/java/de/fitko/fitconnect/TestRunner.java
with
19 additions
and
17 deletions
client/src/main/java/de/fitko/fitconnect/TestRunner.java
+
19
−
17
View file @
7a6ba42e
package
de.fitko.fitconnect
;
import
de.fitko.fitconnect.api.domain.model.
submission.CreatedSubmission
;
import
de.fitko.fitconnect.
client.*
;
import
de.fitko.fitconnect.client.
di.FluentSenderClient
;
import
de.fitko.fitconnect.api.domain.model.
metadata.attachment.Attachment
;
import
de.fitko.fitconnect.
api.domain.model.submission.SubmissionForPickup
;
import
de.fitko.fitconnect.client.
ClientFactory
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.UUID
;
public
class
TestRunner
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
final
String
[]
args
)
{
senderSample
();
subscriberSample
();
}
private
static
void
senderSample
()
{
//
No DI
//
Straight call in one go
ClientFactory
.
senderClient
().
send
(
UUID
.
randomUUID
(),
Collections
.
emptyList
());
// With Guice DI straight call in one go
FluentSenderClient
.
build
().
send
(
UUID
.
randomUUID
(),
Collections
.
emptyList
());
FluentSenderClient
.
build
().
send
(
UUID
.
randomUUID
(),
Collections
.
emptyList
(),
"some json or xml"
);
ClientFactory
.
senderClient
().
send
(
UUID
.
randomUUID
(),
Collections
.
emptyList
(),
"some json or xml"
);
// Without data
FluentS
enderClient
.
build
()
ClientFactory
.
s
enderClient
()
.
withDestination
(
UUID
.
randomUUID
())
.
withAttachments
(
Collections
.
emptyList
())
.
submit
();
// With data
FluentS
enderClient
.
build
()
ClientFactory
.
s
enderClient
()
.
withDestination
(
UUID
.
randomUUID
())
.
withAttachments
(
Collections
.
emptyList
())
.
withData
(
"some json or xml"
)
...
...
@@ -39,13 +38,16 @@ public class TestRunner {
private
static
void
subscriberSample
()
{
var
client
=
ClientFactory
.
subscriberClient
();
List
<
CreatedSubmission
>
submissions
=
client
.
getAvailableSubmissions
(
UUID
.
randomUUID
(),
0
,
100
);
// filter submissions for requested one
CreatedSubmission
submission
=
client
.
requestSubmission
(
UUID
.
fromString
(
"123"
));
final
var
client
=
ClientFactory
.
subscriberClient
();
final
var
submissions
=
client
.
getAvailableSubmissions
(
UUID
.
randomUUID
());
final
List
<
Attachment
>
attachments
=
client
.
requestSubmission
(
getFirstSubmission
(
submissions
))
.
getAttachments
();
}
private
static
UUID
getFirstSubmission
(
final
List
<
SubmissionForPickup
>
submissions
)
{
final
Optional
<
SubmissionForPickup
>
submission
=
submissions
.
stream
().
findFirst
();
return
submission
.
isPresent
()
?
submission
.
get
().
getSubmissionId
()
:
null
;
}
}
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