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

Commit e3a859c

Browse files
committed
#341 Restored schemasPath property on AppConfig
DHF 4.2.2 still uses it
1 parent e29556f commit e3a859c

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

src/main/java/com/marklogic/appdeployer/AppConfig.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,4 +1334,28 @@ public List<String> getSchemaPaths() {
13341334
public void setSchemaPaths(List<String> schemaPaths) {
13351335
this.schemaPaths = schemaPaths;
13361336
}
1337+
1338+
/**
1339+
* With the 3.13.0 release, this should no longer be used, as it necessarily has to clear out the current list
1340+
* of schema paths in order to set the list to the single path passed in.
1341+
*
1342+
* @param path
1343+
*/
1344+
@Deprecated
1345+
public void setSchemasPath(String path) {
1346+
List<String> paths = new ArrayList<>();
1347+
paths.add(path);
1348+
setSchemaPaths(paths);
1349+
}
1350+
1351+
/**
1352+
* @return the last path in schemaPaths, if any exist
1353+
*/
1354+
@Deprecated
1355+
public String getSchemasPath() {
1356+
if (schemaPaths == null || schemaPaths.isEmpty()) {
1357+
return null;
1358+
}
1359+
return schemaPaths.get(schemaPaths.size() - 1);
1360+
}
13371361
}

src/test/java/com/marklogic/appdeployer/command/schemas/LoadSchemasTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import java.io.File;
1414
import java.io.FileFilter;
15+
import java.util.List;
1516

1617
public class LoadSchemasTest extends AbstractAppDeployerTest {
1718

@@ -131,6 +132,21 @@ public void multipleSchemaPaths() {
131132
assertTrue(docMgr.readMetadata("/tde/template2.json", new DocumentMetadataHandle()).getCollections().contains("http://marklogic.com/xdmp/tde"));
132133
}
133134

135+
/**
136+
* Verifying that the deprecated methods work as expected.
137+
*/
138+
@Test
139+
public void testSchemasPath() {
140+
appConfig.getSchemaPaths().add("path1");
141+
appConfig.getSchemaPaths().add("path2");
142+
assertEquals("If multiple paths exist, the last one should be return", "path2", appConfig.getSchemasPath());
143+
144+
appConfig.setSchemasPath("/some/path");
145+
List<String> paths = appConfig.getSchemaPaths();
146+
assertEquals(1, paths.size());
147+
assertEquals("Calling setSchemasPath will remove any paths already set", "/some/path", paths.get(0));
148+
}
149+
134150
private Command newCommand() {
135151
return new LoadSchemasCommand();
136152
}

0 commit comments

Comments
 (0)