|
11 | 11 | import com.marklogic.appdeployer.command.restapis.DeployRestApiServersCommand; |
12 | 12 | import com.marklogic.client.DatabaseClient; |
13 | 13 | import com.marklogic.client.document.GenericDocumentManager; |
| 14 | +import com.marklogic.client.io.DocumentMetadataHandle; |
14 | 15 |
|
15 | | -public class LoadSchemasTest extends AbstractAppDeployerTest { |
| 16 | +public class LoadSchemasTest extends AbstractAppDeployerTest { |
16 | 17 |
|
17 | | - @Test |
18 | | - public void testSchemaLoading() { |
19 | | - initializeAppDeployer(new DeploySchemasDatabaseCommand(), |
20 | | - new DeployTriggersDatabaseCommand(), |
21 | | - new DeployContentDatabasesCommand(1), |
22 | | - new DeployRestApiServersCommand(), |
23 | | - newCommand()); |
| 18 | + @Test |
| 19 | + public void testSchemaLoading() { |
| 20 | + initializeAppDeployer(new DeploySchemasDatabaseCommand(), new DeployTriggersDatabaseCommand(), |
| 21 | + new DeployContentDatabasesCommand(1), new DeployRestApiServersCommand(), newCommand()); |
24 | 22 | appDeployer.deploy(appConfig); |
25 | | - |
| 23 | + |
26 | 24 | DatabaseClient client = appConfig.newSchemasDatabaseClient(); |
27 | | - |
| 25 | + |
28 | 26 | GenericDocumentManager docMgr = client.newDocumentManager(); |
29 | | - |
| 27 | + |
30 | 28 | assertNull("Rules document loaded", docMgr.exists("notExists")); |
31 | 29 | assertNotNull("Rules document loaded", docMgr.exists("my.rules").getUri()); |
32 | 30 | assertNotNull("XSD document loaded", docMgr.exists("x.xsd").getUri()); |
33 | | - } |
34 | | - |
35 | | - @Test |
36 | | - public void testSchemaCustomSchemasPath() { |
37 | | - initializeAppDeployer(new DeploySchemasDatabaseCommand(), |
38 | | - new DeployTriggersDatabaseCommand(), |
39 | | - new DeployContentDatabasesCommand(1), |
40 | | - new DeployRestApiServersCommand(), |
41 | | - newCommand()); |
| 31 | + } |
| 32 | + |
| 33 | + @Test |
| 34 | + public void testSchemaCustomSchemasPath() { |
| 35 | + initializeAppDeployer(new DeploySchemasDatabaseCommand(), new DeployTriggersDatabaseCommand(), |
| 36 | + new DeployContentDatabasesCommand(1), new DeployRestApiServersCommand(), newCommand()); |
42 | 37 | appConfig.setSchemasPath("src/test/resources/schemas-marklogic9"); |
43 | 38 | appDeployer.deploy(appConfig); |
44 | | - |
45 | | - |
| 39 | + |
46 | 40 | DatabaseClient client = appConfig.newSchemasDatabaseClient(); |
47 | | - |
| 41 | + |
48 | 42 | GenericDocumentManager docMgr = client.newDocumentManager(); |
49 | | - |
| 43 | + |
50 | 44 | assertNotNull("TDEXML document loaded", docMgr.exists("x.tdex").getUri()); |
51 | 45 | assertNotNull("TDEJSON document loaded", docMgr.exists("x.tdej").getUri()); |
52 | | - } |
53 | | - |
54 | | - @After |
55 | | - public void cleanup() { |
| 46 | + |
| 47 | + for (String uri : new String[] { "x.tdex", "x.tdej" }) { |
| 48 | + DocumentMetadataHandle h = docMgr.readMetadata(uri, new DocumentMetadataHandle()); |
| 49 | + assertEquals("Files ending in tdex and tdej go into a special collection", "http://marklogic.com/xdmp/tde", |
| 50 | + h.getCollections().iterator().next()); |
| 51 | + } |
| 52 | + } |
| 53 | + |
| 54 | + @After |
| 55 | + public void cleanup() { |
56 | 56 | undeploySampleApp(); |
57 | 57 | } |
58 | 58 |
|
59 | | - private Command newCommand() { |
60 | | - return new LoadSchemasCommand(); |
61 | | - } |
62 | | - |
| 59 | + private Command newCommand() { |
| 60 | + return new LoadSchemasCommand(); |
| 61 | + } |
| 62 | + |
63 | 63 | } |
0 commit comments