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
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
0c9ed63f
Commit
0c9ed63f
authored
1 year ago
by
Jan Zickermann
Browse files
Options
Downloads
Patches
Plain Diff
OZG-5412 Avoid mocking with https (okhttp-tls)
parent
9aab3232
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
xta-adapter/pom.xml
+0
-6
0 additions, 6 deletions
xta-adapter/pom.xml
xta-adapter/src/test/java/de/ozgcloud/eingang/xta/XtaServiceITCase.java
+6
-25
6 additions, 25 deletions
...c/test/java/de/ozgcloud/eingang/xta/XtaServiceITCase.java
with
6 additions
and
31 deletions
xta-adapter/pom.xml
+
0
−
6
View file @
0c9ed63f
...
@@ -94,12 +94,6 @@
...
@@ -94,12 +94,6 @@
<version>
${okio.version}
</version>
<version>
${okio.version}
</version>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.squareup.okhttp3
</groupId>
<artifactId>
okhttp-tls
</artifactId>
<version>
${okio.version}
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
This diff is collapsed.
Click to expand it.
xta-adapter/src/test/java/de/ozgcloud/eingang/xta/XtaServiceITCase.java
+
6
−
25
View file @
0c9ed63f
...
@@ -13,7 +13,6 @@ import org.junit.jupiter.api.DisplayName;
...
@@ -13,7 +13,6 @@ import org.junit.jupiter.api.DisplayName;
import
org.junit.jupiter.api.Nested
;
import
org.junit.jupiter.api.Nested
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.ActiveProfiles
;
...
@@ -21,8 +20,7 @@ import de.ozgcloud.eingang.Application;
...
@@ -21,8 +20,7 @@ import de.ozgcloud.eingang.Application;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
okhttp3.mockwebserver.MockResponse
;
import
okhttp3.mockwebserver.MockResponse
;
import
okhttp3.mockwebserver.MockWebServer
;
import
okhttp3.mockwebserver.MockWebServer
;
import
okhttp3.tls.HandshakeCertificates
;
import
okhttp3.mockwebserver.internal.duplex.DuplexResponseBody
;
import
okhttp3.tls.HeldCertificate
;
@ActiveProfiles
({
"itcase"
,
"local"
})
@ActiveProfiles
({
"itcase"
,
"local"
})
@SpringBootTest
(
classes
=
Application
.
class
)
@SpringBootTest
(
classes
=
Application
.
class
)
...
@@ -36,34 +34,16 @@ class XtaServiceITCase {
...
@@ -36,34 +34,16 @@ class XtaServiceITCase {
@Autowired
@Autowired
private
XtaProperties
properties
;
private
XtaProperties
properties
;
@Autowired
@Qualifier
(
"xtaKeyStore"
)
KeyStore
xtaKeyStore
;
@BeforeEach
@BeforeEach
@SneakyThrows
@SneakyThrows
public
void
createServer
()
{
public
void
createServer
()
{
nachrichtenBrokerMock
=
new
MockWebServer
();
nachrichtenBrokerMock
=
new
MockWebServer
();
nachrichtenBrokerMock
.
requireClientAuth
();
{
// Setup trust between client and the NachrichtenbrokerMock for HTTPS
// (See https://github.com/square/okhttp/blob/master/okhttp-tls/README.md)
HeldCertificate
localhostCertificate
=
new
HeldCertificate
.
Builder
()
.
addSubjectAlternativeName
(
"localhost"
)
.
build
();
HandshakeCertificates
serverCertificates
=
new
HandshakeCertificates
.
Builder
()
.
heldCertificate
(
localhostCertificate
)
.
addTrustedCertificate
((
X509Certificate
)
xtaKeyStore
.
getCertificate
(
"xtatestkey"
))
.
build
();
xtaKeyStore
.
setCertificateEntry
(
"nachrichtenbroker"
,
localhostCertificate
.
certificate
());
nachrichtenBrokerMock
.
useHttps
(
serverCertificates
.
sslSocketFactory
(),
false
);
}
nachrichtenBrokerMock
.
start
(
InetAddress
.
getByName
(
"127.0.0.1"
),
0
);
nachrichtenBrokerMock
.
start
(
InetAddress
.
getByName
(
"127.0.0.1"
),
0
);
properties
.
getServer
().
setAddress
(
nachrichtenBrokerMock
.
getHostName
()
+
":"
+
nachrichtenBrokerMock
.
getPort
());
var
serverProperties
=
properties
.
getServer
();
serverProperties
.
setAddress
(
nachrichtenBrokerMock
.
getHostName
()
+
":"
+
nachrichtenBrokerMock
.
getPort
());
serverProperties
.
setProtocol
(
"http"
);
}
}
@AfterEach
@AfterEach
...
@@ -78,7 +58,8 @@ class XtaServiceITCase {
...
@@ -78,7 +58,8 @@ class XtaServiceITCase {
@BeforeEach
@BeforeEach
void
enqueueResponse
()
{
void
enqueueResponse
()
{
nachrichtenBrokerMock
.
enqueue
(
new
MockResponse
().
setBody
(
"<some/>"
));
var
response
=
new
MockResponse
().
setBody
(
"<some/>"
);
nachrichtenBrokerMock
.
enqueue
(
response
);
}
}
@AfterEach
@AfterEach
...
...
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