Skip to content

Commit

Permalink
Change test setup to reflect recent change SOLR-17066/PR apache#2255
Browse files Browse the repository at this point in the history
  • Loading branch information
jdyer1 committed Feb 20, 2024
1 parent 20de4b0 commit d87b645
Showing 1 changed file with 18 additions and 17 deletions.
Expand Up @@ -100,7 +100,7 @@ public void testQueryXmlPut() throws Exception {
@Test
public void testDelete() throws Exception {
DebugServlet.clear();
String url = getBaseUrl() + "/debug/foo";
String url = getBaseUrl() + DEBUG_SERVLET_PATH;
try (HttpSolrClientJdkImpl client = builder(url).build()) {
try {
client.deleteById("id");
Expand All @@ -116,7 +116,7 @@ public void testDelete() throws Exception {
@Test
public void testDeleteXml() throws Exception {
DebugServlet.clear();
String url = getBaseUrl() + "/debug/foo";
String url = getBaseUrl() + DEBUG_SERVLET_PATH;
try (HttpSolrClientJdkImpl client =
builder(url).withResponseParser(new XMLResponseParser()).build()) {
try {
Expand All @@ -140,7 +140,7 @@ protected void testQuerySetup(SolrRequest.METHOD method, ResponseParser rp) thro
DebugServlet.addResponseHeader("Content-Type", "application/octet-stream");
DebugServlet.responseBody = javabinResponse();
}
String url = getBaseUrl() + "/debug/foo";
String url = getBaseUrl() + DEBUG_SERVLET_PATH;
SolrQuery q = new SolrQuery("foo");
q.setParam("a", "\u1234");
HttpSolrClientJdkImpl.Builder b = builder(url);
Expand All @@ -157,7 +157,7 @@ protected void testQuerySetup(SolrRequest.METHOD method, ResponseParser rp) thro
@Test
public void testGetById() throws Exception {
DebugServlet.clear();
try (HttpSolrClientJdkImpl client = builder(getBaseUrl() + "/debug/foo").build()) {
try (HttpSolrClientJdkImpl client = builder(getBaseUrl() + DEBUG_SERVLET_PATH).build()) {
super.testGetById(client);
}
}
Expand All @@ -180,7 +180,7 @@ public void test0IdleTimeout() throws Exception {
SolrQuery q = new SolrQuery("*:*");
try (HttpSolrClientJdkImpl client =
(HttpSolrClientJdkImpl)
builder(getBaseUrl() + "/debug/foo", DEFAULT_CONNECTION_TIMEOUT, 0).build()) {
builder(getBaseUrl() + DEBUG_SERVLET_PATH, DEFAULT_CONNECTION_TIMEOUT, 0).build()) {
try {
client.query(q, SolrRequest.METHOD.GET);
} catch (BaseHttpSolrClient.RemoteSolrException ignored) {
Expand Down Expand Up @@ -249,7 +249,7 @@ public void testRedirectSwapping() throws Exception {
}

public void testSolrExceptionCodeNotFromSolr() throws IOException, SolrServerException {
try (HttpSolrClientJdkImpl client = builder(getBaseUrl() + "/debug/foo").build()) {
try (HttpSolrClientJdkImpl client = builder(getBaseUrl() + DEBUG_SERVLET_PATH).build()) {
super.testSolrExceptionCodeNotFromSolr(client);
} finally {
DebugServlet.clear();
Expand All @@ -267,15 +267,15 @@ public void testSolrExceptionWithNullBaseurl() throws IOException, SolrServerExc

@Test
public void testUpdateDefault() throws Exception {
String url = getBaseUrl() + "/debug/foo";
String url = getBaseUrl() + DEBUG_SERVLET_PATH;
try (HttpSolrClientJdkImpl client = builder(url).build()) {
testUpdate(client, "javabin", "application/javabin");
}
}

@Test
public void testUpdateXml() throws Exception {
String url = getBaseUrl() + "/debug/foo";
String url = getBaseUrl() + DEBUG_SERVLET_PATH;
try (HttpSolrClientJdkImpl client =
builder(url)
.withRequestWriter(new RequestWriter())
Expand All @@ -287,7 +287,7 @@ public void testUpdateXml() throws Exception {

@Test
public void testUpdateJavabin() throws Exception {
String url = getBaseUrl() + "/debug/foo";
String url = getBaseUrl() + DEBUG_SERVLET_PATH;
try (HttpSolrClientJdkImpl client =
builder(url)
.withRequestWriter(new BinaryRequestWriter())
Expand All @@ -299,8 +299,8 @@ public void testUpdateJavabin() throws Exception {

@Test
public void testCollectionParameters() throws IOException, SolrServerException {
HttpSolrClientJdkImpl baseUrlClient = builder(getBaseUrl()).build();
HttpSolrClientJdkImpl collection1UrlClient = builder(getCoreUrl()).build();
HttpSolrClientJdkImpl baseUrlClient = builder(getBaseUrl()).withDefaultCollection(null).build();
HttpSolrClientJdkImpl collection1UrlClient = builder(getCoreUrl()).withDefaultCollection(null).build();
testCollectionParameters(baseUrlClient, collection1UrlClient);
}

Expand All @@ -314,7 +314,7 @@ public void testGetRawStream() throws Exception {
try (HttpSolrClientJdkImpl client =
(HttpSolrClientJdkImpl)
builder(
getBaseUrl() + "/debug/foo",
getBaseUrl() + DEBUG_SERVLET_PATH,
DEFAULT_CONNECTION_TIMEOUT,
DEFAULT_CONNECTION_TIMEOUT)
.build()) {
Expand All @@ -325,7 +325,7 @@ public void testGetRawStream() throws Exception {
@Test
public void testSetCredentialsExplicitly() throws Exception {
try (HttpSolrClientJdkImpl client =
builder(getBaseUrl() + "/debug/foo")
builder(getBaseUrl() + DEBUG_SERVLET_PATH)
.withBasicAuthCredentials("foo", "explicit")
.build(); ) {
super.testSetCredentialsExplicitly(client);
Expand All @@ -335,7 +335,7 @@ public void testSetCredentialsExplicitly() throws Exception {
@Test
public void testPerRequestCredentials() throws Exception {
try (HttpSolrClientJdkImpl client =
builder(getBaseUrl() + "/debug/foo")
builder(getBaseUrl() + DEBUG_SERVLET_PATH)
.withBasicAuthCredentials("foo2", "explicit")
.build(); ) {
super.testPerRequestCredentials(client);
Expand All @@ -344,7 +344,7 @@ public void testPerRequestCredentials() throws Exception {

@Test
public void testNoCredentials() throws Exception {
try (HttpSolrClientJdkImpl client = builder(getBaseUrl() + "/debug/foo").build(); ) {
try (HttpSolrClientJdkImpl client = builder(getBaseUrl() + DEBUG_SERVLET_PATH).build(); ) {
super.testNoCredentials(client);
}
}
Expand All @@ -353,7 +353,7 @@ public void testNoCredentials() throws Exception {
public void testUseOptionalCredentials() throws Exception {
// username foo, password with embedded colon separator is "expli:cit".
try (HttpSolrClientJdkImpl client =
builder(getBaseUrl() + "/debug/foo")
builder(getBaseUrl() + DEBUG_SERVLET_PATH)
.withOptionalBasicAuthCredentials("foo:expli:cit")
.build(); ) {
super.testUseOptionalCredentials(client);
Expand All @@ -363,7 +363,7 @@ public void testUseOptionalCredentials() throws Exception {
@Test
public void testUseOptionalCredentialsWithNull() throws Exception {
try (HttpSolrClientJdkImpl client =
builder(getBaseUrl() + "/debug/foo").withOptionalBasicAuthCredentials(null).build(); ) {
builder(getBaseUrl() + DEBUG_SERVLET_PATH).withOptionalBasicAuthCredentials(null).build(); ) {
super.testUseOptionalCredentialsWithNull(client);
}
}
Expand All @@ -381,6 +381,7 @@ protected String expectedUserAgent() {
new HttpSolrClientJdkImpl.Builder(url)
.withConnectionTimeout(connectionTimeout, TimeUnit.MILLISECONDS)
.withIdleTimeout(socketTimeout, TimeUnit.MILLISECONDS)
.withDefaultCollection(DEFAULT_CORE)
.withSSLContext(allTrustingSslContext);
return (B) b;
}
Expand Down

0 comments on commit d87b645

Please sign in to comment.