Skip to content

Commit 2683d03

Browse files
authored
Merge pull request #750 from marklogic/feature/22604-disable-12-tests
MLE-22604 Disabling host certificate passphrase tests unless ML 12
2 parents 368b8ac + 7708e0d commit 2683d03

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

ml-app-deployer/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,9 @@ dependencies {
3535
testImplementation 'org.springframework:spring-test:6.2.8'
3636
testImplementation 'commons-io:commons-io:2.19.0'
3737
testImplementation 'xmlunit:xmlunit:1.6'
38+
39+
testImplementation ("com.marklogic:marklogic-junit5:1.5.0") {
40+
// Use the version of ml-javaclient-util within this repository.
41+
exclude module: "ml-javaclient-util"
42+
}
3843
}

ml-app-deployer/src/test/java/com/marklogic/appdeployer/command/security/InsertHostCertificateTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
import com.marklogic.appdeployer.AbstractAppDeployerTest;
1919
import com.marklogic.appdeployer.ConfigDir;
20+
import com.marklogic.junit5.RequiresMarkLogic12;
2021
import com.marklogic.mgmt.resource.security.CertificateTemplateManager;
2122
import com.marklogic.rest.util.Fragment;
2223
import org.junit.jupiter.api.Test;
24+
import org.junit.jupiter.api.extension.ExtendWith;
2325
import org.springframework.http.HttpStatus;
2426
import org.springframework.web.client.HttpClientErrorException;
2527

@@ -108,8 +110,8 @@ void insertCertificateAndVerify() {
108110
}
109111
}
110112

111-
// TODO Ideally don't log the request when it fails.
112113
@Test
114+
@ExtendWith(RequiresMarkLogic12.class)
113115
void encryptedPrivateKey() {
114116
appConfig.setConfigDir(new ConfigDir(new File("src/test/resources/sample-app/encrypted-private-key")));
115117
appConfig.setHostCertificatePassphrases(Map.of("host3.marklogic.com", "password"));
@@ -130,6 +132,7 @@ void encryptedPrivateKey() {
130132
}
131133

132134
@Test
135+
@ExtendWith(RequiresMarkLogic12.class)
133136
void encryptedPrivateKeyWithWrongPassphrase() {
134137
appConfig.setConfigDir(new ConfigDir(new File("src/test/resources/sample-app/encrypted-private-key")));
135138
appConfig.setHostCertificatePassphrases(Map.of("host3.marklogic.com", "wrong-passphrase"));
@@ -151,6 +154,7 @@ void encryptedPrivateKeyWithWrongPassphrase() {
151154
}
152155

153156
@Test
157+
@ExtendWith(RequiresMarkLogic12.class)
154158
void encryptedPrivateKeyWithNoPassphrase() {
155159
appConfig.setConfigDir(new ConfigDir(new File("src/test/resources/sample-app/encrypted-private-key")));
156160

ml-app-deployer/src/test/java/com/marklogic/mgmt/AbstractMgmtTest.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
package com.marklogic.mgmt;
1717

1818
import com.marklogic.client.ext.helper.LoggingObject;
19+
import com.marklogic.junit5.MarkLogicVersion;
20+
import com.marklogic.junit5.MarkLogicVersionSupplier;
1921
import com.marklogic.mgmt.admin.AdminConfig;
2022
import com.marklogic.mgmt.admin.AdminManager;
23+
import com.marklogic.mgmt.resource.clusters.ClusterManager;
2124
import org.junit.jupiter.api.BeforeEach;
2225
import org.junit.jupiter.api.extension.ExtendWith;
2326
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,7 +32,7 @@
2932
*/
3033
@ExtendWith(SpringExtension.class)
3134
@ContextConfiguration(classes = {TestConfig.class})
32-
public abstract class AbstractMgmtTest extends LoggingObject {
35+
public abstract class AbstractMgmtTest extends LoggingObject implements MarkLogicVersionSupplier {
3336

3437
@Autowired
3538
protected ManageConfig manageConfig;
@@ -43,7 +46,23 @@ public abstract class AbstractMgmtTest extends LoggingObject {
4346

4447
@BeforeEach
4548
public void initializeManageClient() {
46-
manageClient = new ManageClient(manageConfig);
49+
if (manageClient == null) {
50+
manageClient = new ManageClient(manageConfig);
51+
}
4752
adminManager = new AdminManager(adminConfig);
4853
}
54+
55+
/**
56+
* Allows for marklogic-junit5 annotations to be used that control test execution based on the MarkLogic version.
57+
*
58+
* @return
59+
*/
60+
@Override
61+
public MarkLogicVersion getMarkLogicVersion() {
62+
if (manageClient == null) {
63+
manageClient = new ManageClient(manageConfig);
64+
}
65+
String version = new ClusterManager(manageClient).getVersion();
66+
return new MarkLogicVersion(version);
67+
}
4968
}

0 commit comments

Comments
 (0)