Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eingang-manager
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
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
OZG-Cloud
app
eingang-manager
Commits
02ff9af0
Commit
02ff9af0
authored
11 months ago
by
Jan Zickermann
Browse files
Options
Downloads
Patches
Plain Diff
OZG-5412 XTAITCase: Remove grpcmock
parent
637af627
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pom.xml
+0
-7
0 additions, 7 deletions
pom.xml
xta-adapter/pom.xml
+0
-5
0 additions, 5 deletions
xta-adapter/pom.xml
xta-adapter/src/test/java/de/ozgcloud/eingang/xta/XtaITCase.java
+33
-66
33 additions, 66 deletions
...pter/src/test/java/de/ozgcloud/eingang/xta/XtaITCase.java
with
33 additions
and
78 deletions
pom.xml
+
0
−
7
View file @
02ff9af0
...
...
@@ -63,7 +63,6 @@
<jaxb2-plugin.version>
0.15.2
</jaxb2-plugin.version>
<jaxb3-plugin.version>
0.15.0
</jaxb3-plugin.version>
<mojo-jaxb2-plugin.version>
3.1.0
</mojo-jaxb2-plugin.version>
<grpcmock.version>
0.13.0
</grpcmock.version>
<okio.version>
3.9.0
</okio.version>
</properties>
...
...
@@ -124,12 +123,6 @@
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.grpcmock
</groupId>
<artifactId>
grpcmock-spring-boot
</artifactId>
<version>
${grpcmock.version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.squareup.okio
</groupId>
<artifactId>
okio
</artifactId>
...
...
This diff is collapsed.
Click to expand it.
xta-adapter/pom.xml
+
0
−
5
View file @
02ff9af0
...
...
@@ -87,11 +87,6 @@
<artifactId>
mockwebserver
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.grpcmock
</groupId>
<artifactId>
grpcmock-spring-boot
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
de.ozgcloud.eingang
</groupId>
<artifactId>
common
</artifactId>
...
...
This diff is collapsed.
Click to expand it.
xta-adapter/src/test/java/de/ozgcloud/eingang/xta/XtaITCase.java
+
33
−
66
View file @
02ff9af0
package
de.ozgcloud.eingang.xta
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.*;
import
static
org
.
grpcmock
.
Grpc
Mock
.*;
import
static
org
.
mockito
.
Mock
ito
.*;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
import
java.util.List
;
import
java.util.
function.Predicate
;
import
java.util.
Optional
;
import
org.grpcmock.springboot.AutoConfigureGrpcMock
;
import
org.junit.jupiter.api.AfterEach
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.DisplayName
;
import
org.junit.jupiter.api.Nested
;
import
org.junit.jupiter.params.ParameterizedTest
;
import
org.junit.jupiter.params.provider.ValueSource
;
import
org.mockito.ArgumentCaptor
;
import
org.mockito.Captor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.mock.mockito.MockBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.test.context.ActiveProfiles
;
import
de.ozgcloud.eingang.Application
;
import
de.ozgcloud.vorgang.grpc.binaryFile.BinaryFileServiceGrpc
;
import
de.ozgcloud.vorgang.grpc.binaryFile.GrpcUploadBinaryFileRequest
;
import
de.ozgcloud.vorgang.grpc.binaryFile.GrpcUploadBinaryFileResponse
;
import
de.ozgcloud.vorgang.vorgang.GrpcCreateVorgangRequest
;
import
de.ozgcloud.vorgang.vorgang.GrpcCreateVorgangResponse
;
import
de.ozgcloud.eingang.common.formdata.FormData
;
import
de.ozgcloud.eingang.router.VorgangRemoteService
;
import
de.ozgcloud.vorgang.vorgang.GrpcEingang
;
import
de.ozgcloud.vorgang.vorgang.GrpcFinishCreationResponse
;
import
de.ozgcloud.vorgang.vorgang.VorgangServiceGrpc
;
@SpringBootTest
(
classes
=
{
Application
.
class
,
XtaITCase
.
ActivateXTARunnerConfig
.
class
})
@ActiveProfiles
({
"itcase"
})
@AutoConfigureGrpcMock
(
name
=
"vorgang-manager-itcase"
,
useInProcessServer
=
true
)
class
XtaITCase
{
@Autowired
...
...
@@ -46,64 +42,29 @@ class XtaITCase {
@Autowired
private
XtaRunner
runner
;
@MockBean
private
VorgangRemoteService
vorgangRemoteService
;
@Captor
private
ArgumentCaptor
<
FormData
>
formDataArgumentCaptor
;
@Captor
private
ArgumentCaptor
<
GrpcEingang
>
eingangArgumentCaptor
;
@Captor
private
ArgumentCaptor
<
Optional
<
String
>>
organisationseinheitenIdArgumentCaptor
;
@DisplayName
(
"run get xta messages"
)
@Nested
class
TestRunGetXtaMessages
{
@BeforeEach
void
setup
()
{
mockStartVorgangCreation
();
mockUploadBinaryFiles
();
mockFinishVorgangCreation
();
}
private
void
mockStartVorgangCreation
()
{
stubFor
(
unaryMethod
(
VorgangServiceGrpc
.
getStartCreationMethod
())
.
willReturn
(
GrpcCreateVorgangResponse
.
getDefaultInstance
()));
}
private
void
mockUploadBinaryFiles
()
{
stubFor
(
clientStreamingMethod
(
BinaryFileServiceGrpc
.
getUploadBinaryFileAsStreamMethod
())
.
willReturn
(
GrpcUploadBinaryFileResponse
.
getDefaultInstance
()));
}
private
void
mockFinishVorgangCreation
()
{
stubFor
(
unaryMethod
(
VorgangServiceGrpc
.
getFinishCreationMethod
())
.
willReturn
(
GrpcFinishCreationResponse
.
getDefaultInstance
()));
when
(
vorgangRemoteService
.
createVorgang
(
any
(),
any
(),
any
())).
thenReturn
(
"vorgangId(unused)"
);
}
@AfterEach
void
teardown
()
{
try
{
expectOneVorgangCreateAndFinishCall
();
expectTwoUploadCallsForXmlRepresentations
();
}
finally
{
xtaMocker
.
teardownServer
();
resetMappings
();
}
}
private
void
expectOneVorgangCreateAndFinishCall
()
{
verifyThat
(
calledMethod
(
VorgangServiceGrpc
.
getStartCreationMethod
())
.
withRequest
(
GrpcCreateVorgangRequest:
:
hasEingang
),
times
(
1
));
verifyThat
(
calledMethod
(
VorgangServiceGrpc
.
getFinishCreationMethod
()),
times
(
1
));
}
private
void
expectTwoUploadCallsForXmlRepresentations
()
{
Predicate
<
GrpcUploadBinaryFileRequest
>
hasXMLContentType
=
request
->
request
.
hasMetadata
()
&&
request
.
getMetadata
()
.
getContentType
()
.
contains
(
"xml"
);
verifyThat
(
calledMethod
(
BinaryFileServiceGrpc
.
getUploadBinaryFileAsStreamMethod
())
.
withRequestsContaining
(
hasXMLContentType
),
times
(
2
));
xtaMocker
.
teardownServer
();
}
@DisplayName
(
"should have three representations with pdf"
)
...
...
@@ -194,12 +155,18 @@ class XtaITCase {
}
private
GrpcEingang
captureEingang
()
{
return
capturedRequestsFor
(
calledMethod
(
VorgangServiceGrpc
.
getStartCreationMethod
()))
.
getFirst
()
.
requests
()
.
getFirst
()
.
getEingang
();
verify
(
vorgangRemoteService
,
times
(
1
))
.
createVorgang
(
formDataArgumentCaptor
.
capture
(),
eingangArgumentCaptor
.
capture
(),
organisationseinheitenIdArgumentCaptor
.
capture
()
);
assertThat
(
formDataArgumentCaptor
.
getValue
()).
isNotNull
();
assertThat
(
eingangArgumentCaptor
.
getValue
()).
isNotNull
();
assertThat
(
organisationseinheitenIdArgumentCaptor
.
getValue
()).
isPresent
();
return
eingangArgumentCaptor
.
getValue
();
}
}
...
...
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