ConfigurationUtils { public static String processMultiConfigZipFile(IbisContext ibisContext, String datasource, boolean activate_config, boolean automatic_reload, InputStream file, String ruser) throws IOException, ConfigurationException { String result = ""; if (file.available() > 0) { try (ZipInputStream zipInputStream = new ZipInputStream(file)) { int counter = 1; ZipEntry zipEntry; while ((zipEntry = zipInputStream.getNextEntry()) != null) { String entryName = zipEntry.getName(); String fileName = "file_zipentry" + counter; if (StringUtils.isNotEmpty(result)) { result += "\n"; } result += entryName + ":" + ConfigurationUtils.addConfigToDatabase(ibisContext, datasource, activate_config, automatic_reload, fileName, zipInputStream, ruser); counter++; } } } return result; }  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 processMultiConfigZipFile() throws Exception { mockDatabase(); URL zip = ConfigurationUtilsTest.class.getResource("/ConfigurationUtils/multiConfig.zip"); assertNotNull("multiConfig.zip not found", zip); ConfigurationUtils.ADDITIONAL_PROPERTIES_FILE_SUFFIX = ""; String result = ConfigurationUtils.processMultiConfigZipFile(ibisContext, "fakeDataSource", false, false, zip.openStream(), "user"); assertNotNull("file uploaded to mock database", result); assertEquals("buildInfoZip.jar:true", result.trim()); 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")); assertEquals("ACTIVECONFIG does not match", "FALSE", parameters.get("ACTIVECONFIG")); assertEquals("AUTORELOAD does not match", "FALSE", parameters.get("AUTORELOAD")); assertEquals("RUSER does not match", "user", parameters.get("RUSER")); assertNotNull("FILENAME not set", parameters.get("FILENAME")); }