forked from apache/camel-quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
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
52273e2
commit 1a3cdd1
Showing
14 changed files
with
667 additions
and
81 deletions.
There are no files selected for viewing
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,16 @@ | ||
=== Development information | ||
|
||
* `Security` If no custom certificate is provided, splunk server creates its own one and the `SplunkTestResource` copies it from the container into `test-classes` | ||
* `Security` Server certificate has to be signed (that is the reason of using keytool in the pom.xml) | ||
* `Security` SSL connection can be verified by openssl tool | ||
``` | ||
openssl s_client -connect localhost:32825 -CAfile cacert.pem | ||
``` | ||
* `Security` Server certificate has to contain a private key, which could not be done via keytool itself. Proper way of achieving such certificate is to use Openssl tool. The `TestResource` is concatenating certificates and keys programmatically. | ||
``` | ||
openssl pkcs12 -export -out combined.p12 -inkey localhost-key.pem -in localhost.pem -certfile splunkca.pem | ||
openssl pkcs12 -in combined.p12 -out combined.pem -nodes | ||
``` | ||
* Set log level to debug for `org.apache.camel.quarkus.test.support.splunk` (by adding `quarkus.log.category.\"org.apache.camel.quarkus.test.support.splunk\".level=DEBUG` into application.properties) to see more important information from runtime. | ||
* `TestResource` is exporting configuration files, log and certificates to the `test-classes` folder. | ||
* Splunk server takes a lot of time to start. It might be handy to start a test with a different process with some timeout (like several hours) and use FakeSplunkTestResource with hardcoded ports. |
51 changes: 51 additions & 0 deletions
51
...nk/src/test/java/org/apache/camel/quarkus/test/support/splunk/FakeSplunkTestResource.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,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 org.apache.camel.quarkus.test.support.splunk; | ||
|
||
import java.util.Map; | ||
|
||
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
/** | ||
* Test Resource meant for development. Replace port numbers with the real ports of the container running in different | ||
* process. | ||
* See README.adoc for more hints. | ||
*/ | ||
public class FakeSplunkTestResource implements QuarkusTestResourceLifecycleManager { | ||
|
||
@Override | ||
public Map<String, String> start() { | ||
|
||
String banner = StringUtils.repeat("*", 50); | ||
|
||
Map<String, String> m = Map.of( | ||
SplunkConstants.PARAM_REMOTE_HOST, "localhost", | ||
SplunkConstants.PARAM_TCP_PORT, "328854", | ||
SplunkConstants.PARAM_HEC_TOKEN, "TESTTEST-TEST-TEST-TEST-TESTTESTTEST", | ||
SplunkConstants.PARAM_TEST_INDEX, SplunkTestResource.TEST_INDEX, | ||
SplunkConstants.PARAM_REMOTE_PORT, "32885", | ||
SplunkConstants.PARAM_HEC_PORT, "32886"); | ||
|
||
return m; | ||
|
||
} | ||
|
||
@Override | ||
public void stop() { | ||
} | ||
} |
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
Oops, something went wrong.