Skip to content

Commit 1d4d9c5

Browse files
authored
Merge pull request #1806 from marklogic/feature/test-fix
MLE-12345 clearDB now uses admin user
2 parents fff16f8 + 379f7c6 commit 1d4d9c5

File tree

1 file changed

+5
-30
lines changed
  • marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest

1 file changed

+5
-30
lines changed

marklogic-client-api-functionaltests/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.marklogic.client.impl.SSLUtil;
1818
import com.marklogic.client.io.DocumentMetadataHandle;
1919
import com.marklogic.client.io.DocumentMetadataHandle.Capability;
20-
import com.marklogic.client.query.QueryManager;
2120
import com.marklogic.mgmt.ManageClient;
2221
import com.marklogic.mgmt.ManageConfig;
2322
import com.marklogic.mgmt.resource.appservers.ServerManager;
@@ -54,15 +53,12 @@ public abstract class ConnectedRESTQA {
5453
protected static String http_port = null;
5554
protected static String fast_http_port = null;
5655
protected static String basePath = null;
57-
private static String admin_port = null;
5856
// This needs to be a FQDN when SSL is enabled. Else localhost
5957
private static String host_name = null;
6058
// This needs to be a FQDN when SSL is enabled. Else localhost
6159
private static String ssl_host_name = null;
6260
private static String admin_user = null;
6361
private static String admin_password = null;
64-
private static String mlRestReadUser = null;
65-
private static String mlRestReadPassword = null;
6662
private static String ml_certificate_password = null;
6763
private static String ml_certificate_file = null;
6864
private static String mlDataConfigDirPath = null;
@@ -317,7 +313,11 @@ public static void deleteDB(String dbName) {
317313
}
318314

319315
public static void clearDB(int port) {
320-
try (DatabaseClient client = newDatabaseClientBuilder().withPort(port).build()) {
316+
DatabaseClientBuilder builder = newDatabaseClientBuilder()
317+
.withDigestAuth(admin_user, admin_password)
318+
.withPort(port);
319+
320+
try (DatabaseClient client = builder.build()) {
321321
// Trying an eval instead of a "DELETE v1/search", which leads to intermittent errors on Jenkins involving
322322
// a "clear" operation on a forest failing.
323323
String count = client.newServerEval()
@@ -848,15 +848,6 @@ public static void configureRESTServer(String dbName, String[] fNames) throws Ex
848848
}
849849
}
850850

851-
//Configure a SSL or non SSL enabled REST Server based on the build.gradle
852-
public static void configureRESTServer(String dbName, String[] fNames, boolean bAssociateDB) throws Exception {
853-
loadGradleProperties();
854-
if (IsSecurityEnabled())
855-
setupJavaRESTServer(dbName, fNames[0], restSslServerName, getRestServerPort(), bAssociateDB);
856-
else
857-
setupJavaRESTServer(dbName, fNames[0], restServerName, getRestServerPort(), bAssociateDB);
858-
}
859-
860851
// Removes the database and forest from a REST server.
861852
public static void cleanupRESTServer(String dbName) {
862853
if (IsSecurityEnabled())
@@ -980,7 +971,6 @@ public static void loadGradleProperties() {
980971
https_port = properties.getProperty("httpsPort");
981972
http_port = properties.getProperty("httpPort");
982973
fast_http_port = properties.getProperty("marklogic.client.port");
983-
admin_port = "8002"; // No need yet for a property for this
984974
basePath = properties.getProperty("marklogic.client.basePath");
985975

986976
// Machine names where ML Server runs
@@ -991,9 +981,6 @@ public static void loadGradleProperties() {
991981
admin_user = properties.getProperty("mlAdminUser");
992982
admin_password = properties.getProperty("mlAdminPassword");
993983

994-
mlRestReadUser = properties.getProperty("mlRestReadUser");
995-
mlRestReadPassword = properties.getProperty("mlRestReadPassword");
996-
997984
// Security and Certificate properties.
998985
ssl_enabled = properties.getProperty("restSSLset");
999986
ml_certificate_password = properties.getProperty("ml_certificate_password");
@@ -1025,14 +1012,6 @@ public static String getAdminPassword() {
10251012
return admin_password;
10261013
}
10271014

1028-
public static String getRestReaderUser() {
1029-
return mlRestReadUser;
1030-
}
1031-
1032-
public static String getRestReaderPassword() {
1033-
return mlRestReadPassword;
1034-
}
1035-
10361015
public static String getSslEnabled() {
10371016
return ssl_enabled;
10381017
}
@@ -1063,10 +1042,6 @@ private static int getHttpPort() {
10631042
return (Integer.parseInt(http_port));
10641043
}
10651044

1066-
public static int getAdminPort() {
1067-
return (Integer.parseInt(admin_port));
1068-
}
1069-
10701045
/*
10711046
* This needs to be a FQDN when SSL is enabled. Else localhost.
10721047
*/

0 commit comments

Comments
 (0)