jamesnetherton commented on code in PR #5730: URL: https://github.com/apache/camel-quarkus/pull/5730#discussion_r1481464311
########## poms/bom-test/pom.xml: ########## @@ -178,6 +178,17 @@ <artifactId>camel-quarkus-integration-tests-support-custom-type-converter</artifactId> <version>${camel-quarkus.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-integration-tests-support-splunk</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-integration-tests-support-splunk</artifactId> + <version>${camel-quarkus.version}</version> + <type>test-jar</type> Review Comment: As per previous comments about the `test-jar` dependency. ########## integration-tests/splunk-hec/pom.xml: ########## @@ -51,9 +55,49 @@ <artifactId>rest-assured</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-integration-tests-support-splunk</artifactId> + <type>test-jar</type> Review Comment: Do we need this given it's already added as a compile scope dependency? ########## integration-tests/splunk-hec/src/test/java/org/apache/camel/quarkus/component/splunk/hec/it/SplunkHecTest.java: ########## @@ -0,0 +1,129 @@ +/* + * 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.component.splunk.hec.it; + +import java.util.Calendar; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; +import org.apache.camel.quarkus.test.support.splunk.SplunkConstants; +import org.apache.camel.quarkus.test.support.splunk.SplunkTestResource; +import org.eclipse.microprofile.config.ConfigProvider; +import org.junit.jupiter.api.Test; +import org.testcontainers.shaded.org.awaitility.Awaitility; +import org.testcontainers.shaded.org.hamcrest.core.StringContains; + +@QuarkusTest +@QuarkusTestResource(SplunkTestResource.class) +class SplunkHecTest { + + @Test + public void produce() throws InterruptedException { + + String url = String.format("http://%s:%d", + getConfigValue(SplunkConstants.PARAM_REMOTE_HOST, String.class), + getConfigValue(SplunkConstants.PARAM_REMOTE_PORT, Integer.class)); + + RestAssured.given() + .body("Hello Sheldon") + .post("/splunk-hec/send") + .then() + .statusCode(200); + + //there might a delay between the data written and received by the search, therefore await() + Awaitility.await().atMost(1, TimeUnit.SECONDS).until( + () -> RestAssured.given() + .request() + .formParam("search", "search index=\"testindex\"") + .formParam("exec_mode", "oneshot") + .relaxedHTTPSValidation() + .auth().basic("admin", "password") + .post(url + "/services/search/jobs") + .then().statusCode(200) + .extract().asString(), + StringContains.containsString("Hello Sheldon")); + + } + + @Test + public void testIndexTime() throws InterruptedException { + String url = String.format("http://%s:%d", + getConfigValue(SplunkConstants.PARAM_REMOTE_HOST, String.class), + getConfigValue(SplunkConstants.PARAM_REMOTE_PORT, Integer.class)); + + //get time one day ago + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DAY_OF_MONTH, -1); + + //send an event with text 'Hello Time 01' + RestAssured.given() + .body("Hello time 01") + .post("/splunk-hec/send") + .then() + .statusCode(200); + + //wait a few seconds + Thread.sleep(3000); Review Comment: Do we need to sleep given the results are checked via Awaitility below? ########## integration-tests/splunk/pom.xml: ########## @@ -60,19 +64,9 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.testcontainers</groupId> - <artifactId>testcontainers</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-junit4-mock</artifactId> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-integration-tests-support-splunk</artifactId> Review Comment: Same comment as previous. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org