Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 4b7af0e

Browse files
authored
Merge pull request #155 from marklogic-community/feature/test-fixes
Test fixes
2 parents 03cbbff + ed981d8 commit 4b7af0e

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ target
1414
gradle-local.properties
1515
snyk
1616
.vscode
17+
src/test/resources/user.properties

src/test/java/com/marklogic/client/ext/AbstractIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected DatabaseClient newClient(String database) {
5454

5555
@Configuration
5656
@Import(value = {SpringDatabaseClientConfig.class})
57-
@PropertySource("classpath:application.properties")
57+
@PropertySource(value = { "classpath:test.properties", "classpath:user.properties" }, ignoreResourceNotFound = true)
5858
class TestConfig {
5959

6060
/**

src/test/java/com/marklogic/client/ext/modulesloader/impl/LoadModulesTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ public void invalidRestModule() {
133133
modulesLoader.loadModules(dir, new DefaultModulesFinder(), client);
134134
fail("Loading modules should have failed because of an invalid REST options file");
135135
} catch (RuntimeException re) {
136-
assertTrue(re.getMessage().contains("Unexpected character"));
136+
assertTrue(re.getMessage().contains("RESTAPI-INVALIDCONTENT"),
137+
"Unexpected message: " + re.getMessage());
137138
}
138139

139140
// This should now succeed since DefaultModulesLoader won't rethrow the REST module failure

src/test/java/com/marklogic/client/ext/schemasloader/impl/ValidateTdeTemplatesTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ public void setup() {
2929
public void badJsonFile() {
3030
final String path = Paths.get("src", "test", "resources", "bad-schemas", "bad-json").toString();
3131
if (TdeUtil.templateBatchInsertSupported(client)) {
32-
FailedRequestException ex = assertThrows(FailedRequestException.class, () -> loader.loadSchemas(path));
33-
logger.info(ex.getMessage());
32+
RuntimeException ex = assertThrows(RuntimeException.class, () -> loader.loadSchemas(path));
33+
FailedRequestException fre = (FailedRequestException)ex.getCause();
34+
assertTrue(fre.getMessage().contains("failed to apply resource at eval: Internal Server Error"),
35+
"Unfortunately, the FailedRequestException does not capture why the tde.templateBatchInsert failed; " +
36+
"JAVA-224 has been opened to improve this; unexpected message: " + fre.getMessage());
3437
} else {
3538
try {
3639
loader.loadSchemas(path);
@@ -59,8 +62,12 @@ public void goodTemplateThatsThenUpdatedViaJavascript() {
5962
public void badXmlFile() {
6063
final String path = Paths.get("src", "test", "resources", "bad-schemas", "bad-xml").toString();
6164
if (TdeUtil.templateBatchInsertSupported(client)) {
62-
FailedRequestException ex = assertThrows(FailedRequestException.class, () -> loader.loadSchemas(path));
63-
logger.info(ex.getMessage());
65+
RuntimeException ex = assertThrows(RuntimeException.class, () -> loader.loadSchemas(path));
66+
FailedRequestException fre = (FailedRequestException)ex.getCause();
67+
assertTrue(fre.getMessage().contains("failed to apply resource at eval: Internal Server Error"),
68+
"Unfortunately, the FailedRequestException does not capture why the tde.templateBatchInsert failed; " +
69+
"JAVA-224 has been opened to improve this; unexpected message: " + fre.getMessage());
70+
6471
} else {
6572
try {
6673
loader.loadSchemas(path);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<options xmlns="http://marklogic.com/appservices/search">
2-
<TheseAre>invalid</TheseAre
2+
<TheseAre>invalid</TheseAre>
33
</options>
File renamed without changes.

0 commit comments

Comments
 (0)