ConfigurationUtils { public static boolean addConfigToDatabase(IbisContext ibisContext, String datasource, boolean activate_config, boolean automatic_reload, String fileName, InputStream file, String ruser) throws ConfigurationException { ConfigurationValidator configDefails = new ConfigurationValidator(file); return addConfigToDatabase(ibisContext, datasource, activate_config, automatic_reload, configDefails.getName(), configDefails.getVersion(), fileName, configDefails.getJar(), ruser); }  static boolean isConfigurationStubbed(ClassLoader classLoader); static String getStubbedConfiguration(Configuration configuration, String originalConfig); static String getActivatedConfiguration(Configuration configuration, String originalConfig); static String getCanonicalizedConfiguration(Configuration configuration, String originalConfig); static String transformConfiguration(Configuration configuration, String originalConfig, String xslt, Map<String, Object> parameters); static String getConfigurationFile(ClassLoader classLoader, String currentConfigurationName); static String getConfigurationVersion(ClassLoader classLoader); static String getApplicationVersion(); static Map<String, Object> getConfigFromDatabase(IbisContext ibisContext, String name); static Map<String, Object> getConfigFromDatabase(IbisContext ibisContext, String name, String jmsRealm); static Map<String, Object> getConfigFromDatabase(IbisContext ibisContext, String name, String jmsRealm, String version); static boolean addConfigToDatabase(IbisContext ibisContext, String datasource, boolean activate_config, boolean automatic_reload, String fileName, InputStream file, String ruser); static String processMultiConfigZipFile(IbisContext ibisContext, String datasource, boolean activate_config, boolean automatic_reload, InputStream file, String ruser); static boolean addConfigToDatabase(IbisContext ibisContext, String datasource, boolean activate_config, boolean automatic_reload, String name, String version, String fileName, InputStream file, String ruser); static void removeConfigFromDatabase(IbisContext ibisContext, String name, String jmsRealm, String version); static boolean activateConfig(IbisContext ibisContext, String name, String version, boolean value, String jmsRealm); static boolean autoReloadConfig(IbisContext ibisContext, String name, String version, boolean booleanValue, String jmsRealm); static Map<String, String> retrieveAllConfigNames(IbisContext ibisContext); static List<String> retrieveConfigNamesFromDatabase(IbisContext ibisContext, String jmsRealm); static List<String> retrieveConfigNamesFromDatabase(IbisContext ibisContext, String jmsRealm, boolean onlyAutoReload); @Deprecated static String[] retrieveBuildInfo(InputStream inputStream); static String ADDITIONAL_PROPERTIES_FILE_SUFFIX; static final String DEFAULT_CONFIGURATION_FILE; }
@Test public void addConfigToDatabaseOld() throws Exception { mockDatabase(); URL zip = ConfigurationUtilsTest.class.getResource("/ConfigurationUtils/buildInfoZip.jar"); assertNotNull("BuildInfoZip not found", zip); boolean result = ConfigurationUtils.addConfigToDatabase(ibisContext, "fakeDataSource", false, false, "ConfigurationName", "001_20191002-1300", "fileName", zip.openStream(), "dummy-user"); assertTrue("file uploaded to mock database", result); Map<String, Object> parameters = stmt.getNamedParameters(); assertEquals("buildInfo name does not match", "ConfigurationName", parameters.get("NAME")); assertEquals("buildInfo version does not match", "001_20191002-1300", parameters.get("VERSION")); }
@Test public void addConfigToDatabaseNew() throws Exception { mockDatabase(); ConfigurationUtils.ADDITIONAL_PROPERTIES_FILE_SUFFIX = ""; URL zip = ConfigurationUtilsTest.class.getResource("/ConfigurationUtils/buildInfoZip.jar"); assertNotNull("BuildInfoZip not found", zip); boolean result = ConfigurationUtils.addConfigToDatabase(ibisContext, "fakeDataSource", false, false, "fileName", zip.openStream(), "dummy-user"); assertTrue("file uploaded to mock database", result); Map<String, Object> parameters = stmt.getNamedParameters(); assertEquals("buildInfo name does not match", "ConfigurationName", parameters.get("NAME")); assertEquals("buildInfo version does not match", "001_20191002-1300", parameters.get("VERSION")); }
@Test public void addConfigToDatabaseNewBuildInfoSC() throws Exception { mockDatabase(); URL zip = ConfigurationUtilsTest.class.getResource("/ConfigurationUtils/buildInfoZip.jar"); assertNotNull("BuildInfoZip not found", zip); ConfigurationUtils.ADDITIONAL_PROPERTIES_FILE_SUFFIX = "_SC"; boolean result = ConfigurationUtils.addConfigToDatabase(ibisContext, "fakeDataSource", false, false, "fileName", zip.openStream(), "dummy-user"); assertTrue("file uploaded to mock database", result); Map<String, Object> parameters = stmt.getNamedParameters(); assertEquals("buildInfo name does not match", "ConfigurationName", parameters.get("NAME")); assertEquals("buildInfo version does not match", "123_20181002-1300", parameters.get("VERSION")); }
@Test public void addConfigToDatabaseNewBuildInfoSPECIAL() throws Exception { mockDatabase(); URL zip = ConfigurationUtilsTest.class.getResource("/ConfigurationUtils/buildInfoZip.jar"); assertNotNull("BuildInfoZip not found", zip); ConfigurationUtils.ADDITIONAL_PROPERTIES_FILE_SUFFIX = "_SPECIAL"; boolean result = ConfigurationUtils.addConfigToDatabase(ibisContext, "fakeDataSource", false, false, "fileName", zip.openStream(), "dummy-user"); assertTrue("file uploaded to mock database", result); Map<String, Object> parameters = stmt.getNamedParameters(); assertEquals("buildInfo name does not match", "ConfigurationName", parameters.get("NAME")); assertEquals("buildInfo version does not match", "789_20171002-1300", parameters.get("VERSION")); }