-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix configuration of custom port for Elasticsearch dev services
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
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
47 changes: 47 additions & 0 deletions
47
...search/restclient/lowlevel/runtime/DevServicesElasticsearchDevModeCustomPortTestCase.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,47 @@ | ||
package io.quarkus.elasticsearch.restclient.lowlevel.runtime; | ||
|
||
import static org.hamcrest.Matchers.endsWith; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusDevModeTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class DevServicesElasticsearchDevModeCustomPortTestCase { | ||
@RegisterExtension | ||
static QuarkusDevModeTest test = new QuarkusDevModeTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClass(TestResource.class) | ||
.addAsResource(new StringAsset(""" | ||
quarkus.elasticsearch.devservices.port=19200 | ||
"""), "application.properties")); | ||
|
||
@Test | ||
public void checkConfiguredPort() { | ||
RestAssured | ||
.when().get("/fruits/configured-hosts") | ||
.then().body(endsWith(":19200")); | ||
|
||
} | ||
|
||
@Test | ||
public void testDatasource() throws Exception { | ||
var fruit = new TestResource.Fruit(); | ||
fruit.id = "1"; | ||
fruit.name = "banana"; | ||
fruit.color = "yellow"; | ||
|
||
RestAssured | ||
.given().body(fruit).contentType("application/json") | ||
.when().post("/fruits") | ||
.then().statusCode(204); | ||
|
||
RestAssured.when().get("/fruits/search?term=color&match=yellow") | ||
.then() | ||
.statusCode(200) | ||
.body(equalTo("[{\"id\":\"1\",\"name\":\"banana\",\"color\":\"yellow\"}]")); | ||
} | ||
} |
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