-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3c1497
commit f93f4de
Showing
5 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
log-sink/src/test/java/dev/knative/eventing/connector/ssl/LogSinkSSLTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.knative.eventing.connector.ssl; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
import org.citrusframework.TestCaseRunner; | ||
import org.citrusframework.annotations.CitrusResource; | ||
import org.citrusframework.http.client.HttpClient; | ||
import org.citrusframework.http.endpoint.builder.HttpEndpoints; | ||
import org.citrusframework.http.security.HttpSecureConnection; | ||
import org.citrusframework.quarkus.ApplicationPropertiesSupplier; | ||
import org.citrusframework.quarkus.CitrusSupport; | ||
import org.citrusframework.spi.BindToRegistry; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.http.HttpStatus; | ||
|
||
import static org.citrusframework.http.actions.HttpActionBuilder.http; | ||
|
||
@QuarkusTest | ||
@CitrusSupport(applicationPropertiesSupplier = LogSinkSSLTest.class) | ||
public class LogSinkSSLTest implements ApplicationPropertiesSupplier { | ||
|
||
@CitrusResource | ||
private TestCaseRunner tc; | ||
|
||
@BindToRegistry | ||
public HttpClient knativeTrigger = HttpEndpoints.http() | ||
.client() | ||
.requestUrl("https://localhost:8444") | ||
.secured(HttpSecureConnection.ssl() | ||
.keyStore("classpath:keystore/server.jks", "changeit") | ||
.trustStore("classpath:keystore/truststore.jks", "changeit")) | ||
.build(); | ||
|
||
@Test | ||
public void shouldConsumeEvents() { | ||
tc.when( | ||
http().client(knativeTrigger) | ||
.send() | ||
.post("/") | ||
.message() | ||
.body("Secure timer source event!") | ||
.header("ce-id", "@matches([0-9A-Z]{15}-[0-9]{16})@") | ||
.header("ce-type", "dev.knative.eventing.timer") | ||
.header("ce-source", "dev.knative.eventing.timer-source") | ||
.header("ce-subject", "secure-timer-source") | ||
); | ||
|
||
tc.then( | ||
http().client(knativeTrigger) | ||
.receive() | ||
.response(HttpStatus.NO_CONTENT) | ||
); | ||
} | ||
|
||
@Override | ||
public Map<String, String> get() { | ||
Map<String, String> conf = new HashMap<>(); | ||
conf.put("quarkus.http.ssl.certificate.files", "keystore/server.crt"); | ||
conf.put("quarkus.http.ssl.certificate.key-files", "keystore/server.key"); | ||
return conf; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDOTCCAiGgAwIBAgIUNxr4lmSJ5ffRc4U0LtcUcKikqY8wDQYJKoZIhvcNAQEL | ||
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM | ||
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDEyMTMxNDA2MTFaFw0yNTEy | ||
MTMxNDA2MTFaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw | ||
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB | ||
AQUAA4IBDwAwggEKAoIBAQCd6me4LD8b7v6hGgwrQ0LE6GvZeJVlBLePLWI5e82r | ||
wz8BdP7IyduNP/AnYr01aD/kIK5DZfBNa1YZ3epQdhslRkNqRpuMzvZ+jlJqTXxj | ||
PNthSSFL+i2FQlVAHRj7vfd5ttejBfbCdrFEcvwcSahf1mQUIdtYR43Res99I67Z | ||
2Z26Yx2LEZP8vyX6TZhbCnxWnkHsVEa+Uz/va1TgibFJk8ca3Y0m+ADWDA/tOTy2 | ||
qCikhf+KoykjGC0B+wU/fQSVaI1ZY23V3icxPMAqusNmxzQIBesvohz5LLr2pyN9 | ||
t93CPj4Txhqj/GlG6uzHQxt95lF9+USLtkPZQ+uX2LeXAgMBAAGjITAfMB0GA1Ud | ||
DgQWBBQCAwfofUKkgx7VerAGTb+LUFjozjANBgkqhkiG9w0BAQsFAAOCAQEAM4GI | ||
KTxKto/ZAuBc16MOPlH1gjISi7f+Ur8DBW/Rr2yIjERd+uxzrg7lVGHPRY7MVnHE | ||
jL/OCFdqnZ5NTW70gVOKmNn8+gkDS66xLS7iz7xMEtC2AFg7TT+OJYWI6JpV19M8 | ||
eJUANMvI8MMbGzZM5p8yxwqLjnpgqoseJh45J1x6LJRQeUNlSLkip//CiLTdezn0 | ||
H3C7X+AOldcFOo2RNXcGYOoZGIApjo4PTTqsbODm2UFJo8FmfjpdtR9dtSo/Z+N3 | ||
QsAqX5ItNpiVNSQBYQ78QEOIf8z7PRZUfqqabF8NbFX+szvJhwsPwlrwm9XeD6ti | ||
dx069Thegj/2s3G39A== | ||
-----END CERTIFICATE----- |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BE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Cqh9v4Ac1g+TUin1fxhUDjvHO | ||
70CSha8es6aNF4DYZYmtbTuhgBsuS5XUbykIfTNgDPG6a6Etd4ENQ6gF8Lb2e7/e | ||
I4l2FPjysQKBgF55YKNHPFMs6xwv416bTXDh6/bwZqvig95v7G6DnS72zvt7XaJ3 | ||
vdVvum2FKqSZeh8hL3tJqWXGL834G7CL8m+h8se9LI/zuubRQex6JdWMgFxS0L7d | ||
VwPIIoL4KvMbNZqTb6erEok3Cs1zFwzFb84MmySDmGxoUYPsfdRffff5AoGADmSo | ||
85cCjgM70CULBUl/lEh/8lA+KP07QxKnl2sf0klLmAre3EtB5Au/5lOmo0N3Yjou | ||
vj4QXSmir6qUZNAOo4TvINXfJBujJhToy3mflZ8XvbapyCZ7gAIQtAekFQDCb3MD | ||
mSlBKKFY1scuCr5SRJmRIIUHcjdDPRs9vvL6NMECgYBJdbC+BSqY8HSEIiwlZiPr | ||
1siiq8jOESCu528kTh/NLWrz6CfnXDa8o+jtS8YvTLtzdupPtCQiTMnGFWvmnAQO | ||
FHS89mDebS8EsEdCOydfAAyENTZIUSOqZNXVhs1hBbP3C7IB1ZS4C87zi4y83MtD | ||
MkY1gMZWnzaf0Egv1e4fhg== | ||
-----END PRIVATE KEY----- |
Binary file not shown.