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
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ public static DatabaseClient newServerAdminClient() {
.build();
}

public static DatabaseClient newServerAdminServicesClient() {
return newClientBuilder()
.withPort(8000)
.withUsername(Common.SERVER_ADMIN_USER)
.withPassword(Common.SERVER_ADMIN_PASS)
.build();
}

public static DatabaseClient newEvalClient() {
return newEvalClient(null);
}
Expand All @@ -156,11 +164,7 @@ public static DatabaseClient newEvalClient(String databaseName) {
}

public static MarkLogicVersion getMarkLogicVersion() {
return getMarkLogicVersion(newServerAdminClient());
}

public static MarkLogicVersion getMarkLogicVersion(DatabaseClient client) {
String version = client.newServerEval().javascript("xdmp.version()").evalAs(String.class);
String version = newServerAdminServicesClient().newServerEval().javascript("xdmp.version()").evalAs(String.class);
return new MarkLogicVersion(version);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import com.marklogic.client.ForbiddenUserException;
import com.marklogic.client.MarkLogicIOException;
import com.marklogic.client.test.Common;
import com.marklogic.client.test.MarkLogicVersion;
import com.marklogic.client.test.junit5.DisabledWhenUsingReverseProxyServer;
import com.marklogic.client.test.junit5.RequireSSLExtension;
import com.marklogic.client.test.junit5.RequiresML11OrLower;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

Expand Down Expand Up @@ -85,24 +85,9 @@ void defaultSslContext() throws Exception {
assertTrue(ex.getCause() instanceof SSLException, "Unexpected cause: " + ex.getCause());
}

@ExtendWith(RequiresML11OrLower.class)
@Test
void noSslContext() throws Exception {
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
sslContext.init(null, new TrustManager[]{Common.TRUST_ALL_MANAGER}, null);
DatabaseClient sslClient = Common.newClientBuilder()
.withUsername(Common.SERVER_ADMIN_USER)
.withPassword(Common.SERVER_ADMIN_PASS)
.withSSLProtocol("TLSv1.2")
.withTrustManager(Common.TRUST_ALL_MANAGER)
.withSSLHostnameVerifier(DatabaseClientFactory.SSLHostnameVerifier.ANY)
.build();
MarkLogicVersion markLogicVersion = Common.getMarkLogicVersion(sslClient);
// Currently failing on 12-nightly due to https://progresssoftware.atlassian.net/browse/MLE-17505 .
if (markLogicVersion.getMajor() > 11) {
System.out.println("MarkLogic major version is 12 or higher, skipping test");
return;
}

DatabaseClient client = Common.newClientBuilder().build();

DatabaseClient.ConnectionResult result = client.checkConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import com.marklogic.client.eval.EvalResultIterator;
import com.marklogic.client.io.StringHandle;
import com.marklogic.client.test.Common;
import com.marklogic.client.test.MarkLogicVersion;
import com.marklogic.client.test.junit5.DisabledWhenUsingReverseProxyServer;
import com.marklogic.client.test.junit5.RequireSSLExtension;
import com.marklogic.client.test.junit5.RequiresML11OrLower;
import com.marklogic.mgmt.ManageClient;
import com.marklogic.mgmt.resource.appservers.ServerManager;
import com.marklogic.mgmt.resource.security.CertificateTemplateManager;
Expand Down Expand Up @@ -99,15 +99,9 @@ public static void teardown() {
* - When the breakpoint is hit, look for the location of the files in stdout.
* - Copy those files to a more accessible location and use them for accessing the 8012 app server.
*/
@ExtendWith(RequiresML11OrLower.class)
@Test
void digestAuthentication() throws NoSuchAlgorithmException, KeyManagementException {
MarkLogicVersion markLogicVersion = Common.getMarkLogicVersion(buildClientWithCert());
// Currently failing on 12-nightly due to https://progresssoftware.atlassian.net/browse/MLE-17505 .
if (markLogicVersion.getMajor() > 11) {
System.out.println("MarkLogic major version is 12 or higher, skipping test");
return;
}

// This client uses our Java KeyStore file with a client certificate in it, so it should work.
DatabaseClient clientWithCert = Common.newClientBuilder()
.withKeyStorePath(keyStoreFile.getAbsolutePath())
Expand Down Expand Up @@ -498,22 +492,4 @@ public void run() {
.forEach(consumer);
}
}

private DatabaseClient buildClientWithCert() {
return Common.newClientBuilder()
.withUsername(Common.SERVER_ADMIN_USER)
.withPassword(Common.SERVER_ADMIN_PASS)
.withKeyStorePath(keyStoreFile.getAbsolutePath())
.withKeyStorePassword(KEYSTORE_PASSWORD)

// Still need this as "common"/"strict" don't work for our temporary server certificate.
.withSSLHostnameVerifier(DatabaseClientFactory.SSLHostnameVerifier.ANY)

// Starting in 6.5.0, we can use a real trust manager as the server certificate is in the keystore.
.withTrustStorePath(trustStoreFile.getAbsolutePath())
.withTrustStorePassword(KEYSTORE_PASSWORD)
.withTrustStoreType("JKS")
.withTrustStoreAlgorithm("SunX509")
.build();
}
}