1515 */
1616package com .marklogic .bootstrap ;
1717
18- import com .marklogic .appdeployer .command .CommandContext ;
1918import com .marklogic .client .DatabaseClient ;
19+ import com .marklogic .client .admin .QueryOptionsManager ;
20+ import com .marklogic .client .admin .ServerConfigurationManager ;
2021import com .marklogic .client .ext .modulesloader .impl .PropertiesModuleManager ;
2122import com .marklogic .client .io .DOMHandle ;
23+ import com .marklogic .client .io .QueryOptionsListHandle ;
2224import com .marklogic .hub .*;
2325import org .apache .commons .io .FileUtils ;
2426import org .custommonkey .xmlunit .XMLUnit ;
4042import java .net .URL ;
4143import java .nio .file .Path ;
4244import java .nio .file .Paths ;
45+ import java .util .Set ;
4346
4447import static org .custommonkey .xmlunit .XMLAssert .assertXMLEqual ;
4548import static org .junit .jupiter .api .Assertions .*;
@@ -64,7 +67,7 @@ public class DataHubInstallTest extends HubTestBase
6467 public void setDataHub (DataHub dataHub ){
6568 DataHubInstallTest .dataHub = dataHub ;
6669 }
67-
70+
6871 @ BeforeAll
6972 public static void setupOnce () {
7073 new Installer ().deleteProjectDir ();
@@ -167,7 +170,7 @@ public void testProjectScaffolding() throws IOException
167170 assertXMLEqual (expectedXml , actualXml );
168171 actualXml = finalSchemasClient .newDocumentManager ().read ("/tde/tdedoc.xml" ).next ().getContent (new DOMHandle ()).get ();
169172 assertXMLEqual (expectedXml , actualXml );
170-
173+
171174 //checking if triggers are written
172175 assertTrue (stagingTriggersClient .newServerEval ().xquery ("fn:count(fn:doc())" ).eval ().next ().getNumber ().intValue () == 6 );
173176 //we write 5 triggers as part of installation
@@ -182,10 +185,22 @@ public void testInstallHubModules() throws IOException
182185
183186 assertTrue (getModulesFile ("/com.marklogic.hub/config.xqy" ).startsWith (getResource ("data-hub-test/core-modules/config.xqy" )));
184187
185- assertTrue (getModulesFile ("/Default/data-hub-JOBS/rest-api/options/traces.xml" ).length () > 0 , "trace options not installed" );
186- assertTrue (getModulesFile ("/Default/data-hub-JOBS/rest-api/options/jobs.xml" ).length () > 0 , "jobs options not installed" );
187- assertTrue (getModulesFile ("/Default/data-hub-STAGING/rest-api/options/default.xml" ).length () > 0 , "staging options not installed" );
188- assertTrue (getModulesFile ("/Default/data-hub-FINAL/rest-api/options/default.xml" ).length () > 0 , "final options not installed" );
188+ ServerConfigurationManager jobsConfigMgr = adminHubConfig .newJobDbClient ().newServerConfigManager ();
189+ QueryOptionsManager jobsOptionsManager = jobsConfigMgr .newQueryOptionsManager ();
190+ Set <String > jobsOptions = jobsOptionsManager .optionsList (new QueryOptionsListHandle ()).getValuesMap ().keySet ();
191+ assertTrue (jobsOptions .contains ("traces" ), "trace options not installed" );
192+ assertTrue (jobsOptions .contains ("jobs" ), "jobs options not installed" );
193+
194+ ServerConfigurationManager stagingConfigMgr = adminHubConfig .newStagingClient ().newServerConfigManager ();
195+ QueryOptionsManager stagingOptionsManager = stagingConfigMgr .newQueryOptionsManager ();
196+ Set <String > stagingOptions = stagingOptionsManager .optionsList (new QueryOptionsListHandle ()).getValuesMap ().keySet ();
197+
198+ assertTrue (stagingOptions .contains ("default" ), "staging options not installed" );
199+
200+ ServerConfigurationManager finalConfigMgr = adminHubConfig .newFinalClient ().newServerConfigManager ();
201+ QueryOptionsManager finalOptionsManager = finalConfigMgr .newQueryOptionsManager ();
202+ Set <String > finalOptions = finalOptionsManager .optionsList (new QueryOptionsListHandle ()).getValuesMap ().keySet ();
203+ assertTrue (finalOptions .contains ("default" ), "final options not installed" );
189204 }
190205
191206 @ Test
@@ -283,13 +298,19 @@ public void testInstallUserModules() throws IOException, ParserConfigurationExce
283298 getXmlFromResource ("data-hub-test/hl7.xml" ),
284299 getModulesDocument ("/entities/test-entity/input/hl7/hl7.xml" ));
285300
301+ ServerConfigurationManager stagingConfigMgr = adminHubConfig .newStagingClient ().newServerConfigManager ();
302+ QueryOptionsManager stagingOptionsManager = stagingConfigMgr .newQueryOptionsManager ();
303+
286304 assertXMLEqual (
287305 getXmlFromResource ("data-hub-test/plugins/entities/test-entity/input/REST/options/doctors.xml" ),
288- getModulesDocument ("/Default/" + HubConfig .DEFAULT_STAGING_NAME + "/rest-api/options/doctors.xml" ));
306+ stagingOptionsManager .readOptions ("doctors" , new DOMHandle ()).get ());
307+
308+ ServerConfigurationManager finalConfigMgr = adminHubConfig .newFinalClient ().newServerConfigManager ();
309+ QueryOptionsManager finalOptionsManager = finalConfigMgr .newQueryOptionsManager ();
289310
290311 assertXMLEqual (
291312 getXmlFromResource ("data-hub-test/plugins/entities/test-entity/harmonize/REST/options/patients.xml" ),
292- getModulesDocument ( "/Default/" + HubConfig . DEFAULT_FINAL_NAME + "/rest-api/options/patients.xml" ));
313+ finalOptionsManager . readOptions ( "patients" , new DOMHandle ()). get ( ));
293314
294315 assertXMLEqual (
295316 getXmlFromResource ("data-hub-helpers/test-conf-metadata.xml" ),
0 commit comments