Skip to content

Commit 2188d26

Browse files
georgeajitgeorgeajit
authored andcommitted
No Task - Optics test enabled for SSL runs.
1 parent fed6c1e commit 2188d26

File tree

7 files changed

+66
-31
lines changed

7 files changed

+66
-31
lines changed

test-complete/src/test/java/com/marklogic/client/functionaltest/ConnectedRESTQA.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,7 @@ public static DatabaseClient getDatabaseClient(String user, String password, Aut
23902390
* specific database on non uber port i.e., 8012 Access a specific database
23912391
* through uber server on port (specifically port 8000)
23922392
*/
2393-
public DatabaseClient getDatabaseClientOnDatabase(String hostName, int port, String databaseName, String user, String password, Authentication authType)
2393+
public static DatabaseClient getDatabaseClientOnDatabase(String hostName, int port, String databaseName, String user, String password, Authentication authType)
23942394
throws KeyManagementException, NoSuchAlgorithmException, IOException
23952395
{
23962396
DatabaseClient client = null;

test-complete/src/test/java/com/marklogic/client/functionaltest/TestOpticOnCtsQuery.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import com.fasterxml.jackson.databind.node.ObjectNode;
4040
import com.marklogic.client.DatabaseClient;
4141
import com.marklogic.client.DatabaseClientFactory;
42+
import com.marklogic.client.DatabaseClientFactory.Authentication;
4243
import com.marklogic.client.DatabaseClientFactory.DigestAuthContext;
4344
import com.marklogic.client.document.DocumentManager;
4445
import com.marklogic.client.document.DocumentWriteSet;
@@ -72,6 +73,7 @@ public class TestOpticOnCtsQuery extends BasicJavaClientREST {
7273
public static void setUp() throws KeyManagementException, NoSuchAlgorithmException, Exception
7374
{
7475
System.out.println("In TestOpticOnCtsQuery setup");
76+
DatabaseClient schemaDBclient = null;
7577

7678
configureRESTServer(dbName, fNames);
7779

@@ -128,11 +130,14 @@ public static void setUp() throws KeyManagementException, NoSuchAlgorithmExcepti
128130
// Set the schemadbName database as the Schema database.
129131
setDatabaseProperties(dbName, "schema-database", schemadbName);
130132

131-
DatabaseClient schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
132-
133-
// You can enable the triple positions index for faster near searches using
134-
// cts:triple-range-query.
135-
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
133+
if (IsSecurityEnabled()) {
134+
schemaDBclient = getDatabaseClientOnDatabase(getRestServerHostName(), getRestServerPort(), schemadbName, "admin", "admin", Authentication.DIGEST);
135+
client = getDatabaseClient("admin", "admin", Authentication.DIGEST);
136+
}
137+
else {
138+
schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
139+
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
140+
}
136141

137142
// Install the TDE templates
138143
// loadFileToDB(client, filename, docURI, collection, document format)

test-complete/src/test/java/com/marklogic/client/functionaltest/TestOpticOnLexicons.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import com.fasterxml.jackson.databind.node.ObjectNode;
4040
import com.marklogic.client.DatabaseClient;
4141
import com.marklogic.client.DatabaseClientFactory;
42+
import com.marklogic.client.DatabaseClientFactory.Authentication;
4243
import com.marklogic.client.DatabaseClientFactory.DigestAuthContext;
4344
import com.marklogic.client.document.DocumentManager;
4445
import com.marklogic.client.document.DocumentWriteSet;
@@ -72,6 +73,7 @@ public class TestOpticOnLexicons extends BasicJavaClientREST {
7273
public static void setUp() throws KeyManagementException, NoSuchAlgorithmException, Exception
7374
{
7475
System.out.println("In TestOpticOnLexicons setup");
76+
DatabaseClient schemaDBclient = null;
7577

7678
configureRESTServer(dbName, fNames);
7779

@@ -126,11 +128,14 @@ public static void setUp() throws KeyManagementException, NoSuchAlgorithmExcepti
126128
// Set the schemadbName database as the Schema database.
127129
setDatabaseProperties(dbName, "schema-database", schemadbName);
128130

129-
DatabaseClient schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
130-
131-
// You can enable the triple positions index for faster near searches using
132-
// cts:triple-range-query.
133-
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
131+
if (IsSecurityEnabled()) {
132+
schemaDBclient = getDatabaseClientOnDatabase(getRestServerHostName(), getRestServerPort(), schemadbName, "admin", "admin", Authentication.DIGEST);
133+
client = getDatabaseClient("admin", "admin", Authentication.DIGEST);
134+
}
135+
else {
136+
schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
137+
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
138+
}
134139

135140
// Install the TDE templates
136141
// loadFileToDB(client, filename, docURI, collection, document format)

test-complete/src/test/java/com/marklogic/client/functionaltest/TestOpticOnLiterals.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class TestOpticOnLiterals extends BasicJavaClientREST {
8484
public static void setUp() throws KeyManagementException, NoSuchAlgorithmException, Exception
8585
{
8686
System.out.println("In TestOpticOnLiterals setup");
87+
DatabaseClient schemaDBclient = null;
8788

8889
configureRESTServer(dbName, fNames);
8990

@@ -138,11 +139,14 @@ public static void setUp() throws KeyManagementException, NoSuchAlgorithmExcepti
138139
// Set the schemadbName database as the Schema database.
139140
setDatabaseProperties(dbName, "schema-database", schemadbName);
140141

141-
DatabaseClient schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
142-
143-
// You can enable the triple positions index for faster near searches using
144-
// cts:triple-range-query.
145-
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
142+
if (IsSecurityEnabled()) {
143+
schemaDBclient = getDatabaseClientOnDatabase(getRestServerHostName(), getRestServerPort(), schemadbName, "admin", "admin", Authentication.DIGEST);
144+
client = getDatabaseClient("admin", "admin", Authentication.DIGEST);
145+
}
146+
else {
147+
schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
148+
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
149+
}
146150
// Install the TDE templates
147151
// loadFileToDB(client, filename, docURI, collection, document format)
148152
loadFileToDB(schemaDBclient, "masterDetail.tdex", "/optic/view/test/masterDetail.tdex", "XML", new String[] { "http://marklogic.com/xdmp/tde" });
@@ -275,8 +279,10 @@ public static void setUp() throws KeyManagementException, NoSuchAlgorithmExcepti
275279
// Map and Reduce tests.
276280
createUserRolesWithPrevilages("test-eval", "xdbc:eval", "xdbc:eval-in", "xdmp:eval-in", "any-uri", "xdbc:invoke");
277281
createRESTUser("eval-user", "x", "test-eval", "rest-admin", "rest-writer", "rest-reader");
278-
279-
DatabaseClient clientRes = DatabaseClientFactory.newClient(getRestAppServerHostName(), getRestServerPort(), dbName, "eval-user", "x", Authentication.DIGEST);
282+
283+
284+
DatabaseClient clientRes = getDatabaseClient("eval-user", "x", Authentication.DIGEST);
285+
280286
resourceMgr = clientRes.newServerConfigManager().newResourceExtensionsManager();
281287
ExtensionMetadata resextMetadata = new ExtensionMetadata();
282288
resextMetadata.setTitle("BasicJSTest");
@@ -293,6 +299,7 @@ public static void setUp() throws KeyManagementException, NoSuchAlgorithmExcepti
293299
resourceMgr.writeServices("OpticsJSResourceModule", handle, resextMetadata, getParams);
294300
Thread.sleep(10000);
295301
schemaDBclient.release();
302+
clientRes.release();
296303
}
297304

298305
/**

test-complete/src/test/java/com/marklogic/client/functionaltest/TestOpticOnMixedViews.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import com.fasterxml.jackson.databind.node.ObjectNode;
4040
import com.marklogic.client.DatabaseClient;
4141
import com.marklogic.client.DatabaseClientFactory;
42+
import com.marklogic.client.DatabaseClientFactory.Authentication;
4243
import com.marklogic.client.DatabaseClientFactory.DigestAuthContext;
4344
import com.marklogic.client.document.DocumentManager;
4445
import com.marklogic.client.document.DocumentWriteSet;
@@ -70,6 +71,8 @@ public class TestOpticOnMixedViews extends BasicJavaClientREST {
7071
public static void setUp() throws KeyManagementException, NoSuchAlgorithmException, Exception
7172
{
7273
System.out.println("In TestOpticOnMixedViews setup");
74+
DatabaseClient schemaDBclient = null;
75+
7376
configureRESTServer(dbName, fNames);
7477

7578
// Add new range elements into this array
@@ -124,11 +127,14 @@ public static void setUp() throws KeyManagementException, NoSuchAlgorithmExcepti
124127
// Set the schemadbName database as the Schema database.
125128
setDatabaseProperties(dbName, "schema-database", schemadbName);
126129

127-
DatabaseClient schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
128-
129-
// You can enable the triple positions index for faster near searches using
130-
// cts:triple-range-query.
131-
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
130+
if (IsSecurityEnabled()) {
131+
schemaDBclient = getDatabaseClientOnDatabase(getRestServerHostName(), getRestServerPort(), schemadbName, "admin", "admin", Authentication.DIGEST);
132+
client = getDatabaseClient("admin", "admin", Authentication.DIGEST);
133+
}
134+
else {
135+
schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
136+
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
137+
}
132138

133139
// Install the TDE templates
134140
// loadFileToDB(client, filename, docURI, collection, document format)

test-complete/src/test/java/com/marklogic/client/functionaltest/TestOpticOnTriples.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import com.fasterxml.jackson.databind.node.ObjectNode;
4040
import com.marklogic.client.DatabaseClient;
4141
import com.marklogic.client.DatabaseClientFactory;
42+
import com.marklogic.client.DatabaseClientFactory.Authentication;
4243
import com.marklogic.client.DatabaseClientFactory.DigestAuthContext;
4344
import com.marklogic.client.document.DocumentManager;
4445
import com.marklogic.client.document.DocumentWriteSet;
@@ -74,6 +75,7 @@ public class TestOpticOnTriples extends BasicJavaClientREST {
7475
public static void setUp() throws KeyManagementException, NoSuchAlgorithmException, Exception
7576
{
7677
System.out.println("In TestOpticOnTriples setup");
78+
DatabaseClient schemaDBclient = null;
7779

7880
configureRESTServer(dbName, fNames);
7981

@@ -129,12 +131,18 @@ public static void setUp() throws KeyManagementException, NoSuchAlgorithmExcepti
129131
createForest(schemafNames[0], schemadbName);
130132
// Set the schemadbName database as the Schema database.
131133
setDatabaseProperties(dbName, "schema-database", schemadbName);
132-
133-
DatabaseClient schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
134+
if (IsSecurityEnabled()) {
135+
schemaDBclient = getDatabaseClientOnDatabase(getRestServerHostName(), getRestServerPort(), schemadbName, "admin", "admin", Authentication.DIGEST);
136+
client = getDatabaseClient("admin", "admin", Authentication.DIGEST);
137+
}
138+
else {
139+
schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
140+
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
141+
}
134142

135143
// You can enable the triple positions index for faster near searches using
136144
// cts:triple-range-query.
137-
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
145+
138146

139147
// Install the TDE templates
140148
// loadFileToDB(client, filename, docURI, collection, document format)

test-complete/src/test/java/com/marklogic/client/functionaltest/TestOpticOnViews.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public class TestOpticOnViews extends BasicJavaClientREST {
8282
public static void setUp() throws KeyManagementException, NoSuchAlgorithmException, Exception
8383
{
8484
System.out.println("In TestOpticOnViews setup");
85+
DatabaseClient schemaDBclient = null;
8586

8687
configureRESTServer(dbName, fNames);
8788

@@ -138,11 +139,14 @@ public static void setUp() throws KeyManagementException, NoSuchAlgorithmExcepti
138139
// Set the schemadbName database as the Schema database.
139140
setDatabaseProperties(dbName, "schema-database", schemadbName);
140141

141-
DatabaseClient schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
142-
143-
// You can enable the triple positions index for faster near searches using
144-
// cts:triple-range-query.
145-
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
142+
if (IsSecurityEnabled()) {
143+
schemaDBclient = getDatabaseClientOnDatabase(getRestServerHostName(), getRestServerPort(), schemadbName, "admin", "admin", Authentication.DIGEST);
144+
client = getDatabaseClient("admin", "admin", Authentication.DIGEST);
145+
}
146+
else {
147+
schemaDBclient = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), schemadbName, new DigestAuthContext("admin", "admin"));
148+
client = DatabaseClientFactory.newClient(getRestServerHostName(), getRestServerPort(), new DigestAuthContext("admin", "admin"));
149+
}
146150

147151
// Install the TDE templates into schemadbName DB
148152
// loadFileToDB(client, filename, docURI, collection, document format)

0 commit comments

Comments
 (0)