Skip to content

Commit 6a9e64b

Browse files
authored
Merge pull request #1785 from marklogic/feature/17505-test-fix
MLE-17505 Updated test for MarkLogic 12
2 parents 1b329f1 + 5a2fdd0 commit 6a9e64b

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

marklogic-client-api/src/test/java/com/marklogic/client/test/ssl/OneWaySSLTest.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
import com.marklogic.client.test.junit5.RequiresML12;
1414
import com.marklogic.mgmt.ManageClient;
1515
import com.marklogic.mgmt.resource.appservers.ServerManager;
16-
import org.junit.jupiter.api.*;
16+
import org.junit.jupiter.api.AfterEach;
17+
import org.junit.jupiter.api.Assertions;
18+
import org.junit.jupiter.api.BeforeAll;
19+
import org.junit.jupiter.api.Test;
1720
import org.junit.jupiter.api.condition.DisabledOnJre;
1821
import org.junit.jupiter.api.condition.JRE;
1922
import org.junit.jupiter.api.extension.ExtendWith;
@@ -119,7 +122,9 @@ void noSslContext() {
119122

120123
DatabaseClient.ConnectionResult result = client.checkConnection();
121124
assertEquals("Forbidden", result.getErrorMessage(), "MarkLogic is expected to return a 403 Forbidden when the " +
122-
"user tries to access an HTTPS app server using HTTP");
125+
"user tries to access an HTTPS app server using HTTP. This behavior changes in MarkLogic 12, and it may " +
126+
"be considered a bit surprising with MarkLogic 11 and earlier - that is, the user probably shouldn't get " +
127+
"any response back since a connection cannot be made without using SSL.");
123128
assertEquals(403, result.getStatusCode());
124129

125130
ForbiddenUserException ex = assertThrows(ForbiddenUserException.class,
@@ -133,6 +138,17 @@ void noSslContext() {
133138
);
134139
}
135140

141+
@ExtendWith(RequiresML12.class)
142+
@Test
143+
void noSslContextWithMarkLogic12() {
144+
DatabaseClient client = Common.newClientBuilder().build();
145+
146+
MarkLogicIOException ex = assertThrows(MarkLogicIOException.class, () -> client.checkConnection());
147+
assertTrue(ex.getMessage().contains("unexpected end of stream"), "Per MLE-17505, a change in the openssl " +
148+
"library used by the server results in an IO exception when the client tries to connect to an " +
149+
"app server that requires SSL, but the client does not use SSL. Actual message: " + ex.getMessage());
150+
}
151+
136152
@Test
137153
void tLS13ClientWithTLS12Server() {
138154
DatabaseClient client = buildTrustAllClientWithSSLProtocol(SSLUtil.DEFAULT_PROTOCOL);

0 commit comments

Comments
 (0)