Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions modules/solr/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ dependencies {
// TODO use JDK's HTTP client and/or Apache HttpClient5
shaded 'com.squareup.okhttp3:okhttp:5.1.0'

testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'

testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.13.4'
testImplementation 'org.apache.solr:solr-solrj:8.11.4'
testImplementation 'org.assertj:assertj-core:3.27.3'
}
Expand All @@ -14,3 +18,7 @@ tasks.japicmp {
"org.testcontainers.containers.SolrContainer"
]
}

test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,33 @@
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.response.SolrPingResponse;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import java.io.IOException;

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(Parameterized.class)
public class SolrContainerTest {

@Parameterized.Parameters(name = "{0}")
private SolrClient client = null;

public static String[] getVersionsToTest() {
return new String[] { "solr:8.11.4", "solr:9.8.0" };
}

@Parameterized.Parameter
public String solrImage;

private SolrClient client = null;

@After
public void stopRestClient() throws IOException {
@AfterEach
void stopRestClient() throws IOException {
if (client != null) {
client.close();
client = null;
}
}

@Test
public void solrCloudTest() throws IOException, SolrServerException {
@ParameterizedTest
@MethodSource("getVersionsToTest")
void solrCloudTest(String solrImage) throws IOException, SolrServerException {
try (SolrContainer container = new SolrContainer(solrImage)) {
container.start();
SolrPingResponse response = getClient(container).ping("dummy");
Expand All @@ -44,8 +39,9 @@ public void solrCloudTest() throws IOException, SolrServerException {
}
}

@Test
public void solrStandaloneTest() throws IOException, SolrServerException {
@ParameterizedTest
@MethodSource("getVersionsToTest")
void solrStandaloneTest(String solrImage) throws IOException, SolrServerException {
try (SolrContainer container = new SolrContainer(solrImage).withZookeeper(false)) {
container.start();
SolrPingResponse response = getClient(container).ping("dummy");
Expand All @@ -54,8 +50,9 @@ public void solrStandaloneTest() throws IOException, SolrServerException {
}
}

@Test
public void solrCloudPingTest() throws IOException, SolrServerException {
@ParameterizedTest
@MethodSource("getVersionsToTest")
void solrCloudPingTest(String solrImage) throws IOException, SolrServerException {
// solrContainerUsage {
// Create the solr container.
SolrContainer container = new SolrContainer(solrImage);
Expand Down
Loading