diff --git a/core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java b/core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java index c2504b6d4..1c01285cc 100644 --- a/core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java +++ b/core/src/main/java/oracle/weblogic/deploy/util/WLSDeployArchive.java @@ -44,6 +44,27 @@ public class WLSDeployArchive { // Deprecated top-level archive subdirectory where the opss wallet is stored. public static final String OLD_ARCHIVE_OPSS_WALLET_PATH = "opsswallet"; + /** + * The archive subdirectory name where all database wallets are stored. + */ + public static final String DB_WALLETS_DIR_NAME = "dbWallets"; + + /** + * The archive subdirectory name used by default for the database wallet for the RCU database. + */ + public static final String DEFAULT_RCU_WALLET_NAME = "rcu"; + + /** + * Top-level archive subdirectory where all database wallets are stored in subdirectories. + */ + public static final String ARCHIVE_DB_WALLETS_DIR = + String.format("%s/%s/", WLSDPLY_ARCHIVE_BINARY_DIR, DB_WALLETS_DIR_NAME); + + /** + * Default, top-level archive subdirectory where the database wallet for the RCU database is stored. + */ + public static final String DEFAULT_RCU_WALLET_PATH = ARCHIVE_DB_WALLETS_DIR + DEFAULT_RCU_WALLET_NAME; + /** * Top-level archive subdirectory where the atp wallet is stored. */ @@ -514,6 +535,14 @@ public String addApplication(String appPath) throws WLSDeployArchiveIOException return newName; } + /** + * Replace an existing application in the archive file. + * + * @param appPath the path within the archive of the app to remove + * @param tempFile the file system location of the new app to replace the existing one + * @return the archive path of the new application + * @throws WLSDeployArchiveIOException if an IOException occurred while reading or writing changes + */ public String replaceApplication(String appPath, String tempFile) throws WLSDeployArchiveIOException { final String METHOD = "replaceApplication"; LOGGER.entering(CLASS, METHOD, appPath); @@ -567,33 +596,29 @@ public List listApplications() throws WLSDeployArchiveIOException { } /** - * Extract the ATP wallet in the archive. + * Extract the named database wallet. * * @param domainHome the domain home directory + * @param walletName the name of the database wallet to extract (e.g., rcu) * @return the full path to the directory containing the extracted wallet files or null, if no wallet was found. * @throws WLSDeployArchiveIOException if an error occurs while reading or extracting the archive files. */ - public String extractATPWallet(File domainHome) throws WLSDeployArchiveIOException { - final String METHOD = "extractATPWallet"; + public String extractDatabaseWallet(File domainHome, String walletName) throws WLSDeployArchiveIOException { + final String METHOD = "extractDatabaseWallet"; - LOGGER.entering(CLASS, METHOD, domainHome); - validateExistingDirectory(domainHome, "domainHome", getArchiveFileName(), METHOD); + LOGGER.entering(CLASS, METHOD, domainHome, walletName); - // Look in the updated location first String extractPath = null; - List zipEntries = getZipFile().listZipEntries(ARCHIVE_ATP_WALLET_PATH + ZIP_SEP); - zipEntries.remove(ARCHIVE_ATP_WALLET_PATH + ZIP_SEP); - if (!zipEntries.isEmpty()) { - extractPath = ARCHIVE_ATP_WALLET_PATH + ZIP_SEP; - extractWallet(domainHome, extractPath, zipEntries, null); - extractPath = new File(domainHome, extractPath).getAbsolutePath(); + if (DEFAULT_RCU_WALLET_NAME.equals(walletName)) { + // handle archive files with deprecated path, as needed + extractPath = extractRCUWallet(domainHome); } else { - // Look in the deprecated location. - zipEntries = getZipFile().listZipEntries(OLD_ARCHIVE_ATP_WALLET_PATH + ZIP_SEP); - zipEntries.remove(OLD_ARCHIVE_ATP_WALLET_PATH + ZIP_SEP); + validateExistingDirectory(domainHome, "domainHome", getArchiveFileName(), METHOD); + List zipEntries = getZipFile().listZipEntries(ARCHIVE_DB_WALLETS_DIR + walletName + ZIP_SEP); + zipEntries.remove(ARCHIVE_DB_WALLETS_DIR + walletName + ZIP_SEP); if (!zipEntries.isEmpty()) { - extractPath = ARCHIVE_ATP_WALLET_PATH + ZIP_SEP; - extractWallet(domainHome, extractPath, zipEntries, "WLSDPLY-01427"); + extractPath = ARCHIVE_DB_WALLETS_DIR + walletName + ZIP_SEP; + extractWallet(domainHome, extractPath, zipEntries, null, null, null); extractPath = new File(domainHome, extractPath).getAbsolutePath(); } } @@ -621,7 +646,7 @@ public String extractOPSSWallet(File domainHome) throws WLSDeployArchiveIOExcept zipEntries.remove(ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP); if (!zipEntries.isEmpty()) { extractPath = ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP; - extractWallet(domainHome, extractPath, zipEntries, null); + extractWallet(domainHome, extractPath, zipEntries, null, null, null); extractPath = new File(domainHome, extractPath).getAbsolutePath(); } else { // Look in the deprecated location. @@ -629,7 +654,7 @@ public String extractOPSSWallet(File domainHome) throws WLSDeployArchiveIOExcept zipEntries.remove(OLD_ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP); if (!zipEntries.isEmpty()) { extractPath = OLD_ARCHIVE_OPSS_WALLET_PATH + ZIP_SEP; - extractWallet(domainHome, extractPath, zipEntries, "WLSDPLY-01433"); + extractWallet(domainHome, extractPath, zipEntries, "WLSDPLY-01433",null, null); extractPath = new File(domainHome, extractPath).getAbsolutePath(); } } @@ -1556,8 +1581,8 @@ protected String addUrlToZip(String zipPathPrefix, URL url, String extension, bo return newName; } - protected void extractWallet(File domainHome, String extractPath, List zipEntries, String deprecationKey) - throws WLSDeployArchiveIOException { + protected void extractWallet(File domainHome, String extractPath, List zipEntries, String deprecationKey, + String fromDir, String toDir) throws WLSDeployArchiveIOException { final String METHOD = "extractWallet"; LOGGER.entering(CLASS, METHOD, domainHome, extractPath, zipEntries, deprecationKey); @@ -1586,7 +1611,11 @@ protected void extractWallet(File domainHome, String extractPath, List z extractToLocation = new File(domainHome, WLSDPLY_ARCHIVE_BINARY_DIR); LOGGER.warning(deprecationKey, getArchiveFileName(), zipEntry, extractPath); } - extractFileFromZip(zipEntry, extractToLocation); + if (StringUtils.isEmpty(fromDir) && StringUtils.isEmpty(toDir)) { + extractFileFromZip(zipEntry, extractToLocation); + } else { + extractFileFromZip(zipEntry, fromDir, toDir, extractToLocation); + } } } } @@ -1765,6 +1794,36 @@ protected void extractFileFromZip(String itemToExtract, String fromDir, String t LOGGER.exiting(CLASS, METHOD); } + protected String extractRCUWallet(File domainHome) throws WLSDeployArchiveIOException { + final String METHOD = "extractRCUWallet"; + + LOGGER.entering(CLASS, METHOD, domainHome); + validateExistingDirectory(domainHome, "domainHome", getArchiveFileName(), METHOD); + + // Look in the updated location first + String extractPath = null; + List zipEntries = getZipFile().listZipEntries(DEFAULT_RCU_WALLET_PATH + ZIP_SEP); + zipEntries.remove(DEFAULT_RCU_WALLET_PATH + ZIP_SEP); + if (!zipEntries.isEmpty()) { + extractPath = DEFAULT_RCU_WALLET_PATH + ZIP_SEP; + extractWallet(domainHome, extractPath, zipEntries, null, null, null); + extractPath = new File(domainHome, extractPath).getAbsolutePath(); + } else { + // Look in the deprecated location. + zipEntries = getZipFile().listZipEntries(OLD_ARCHIVE_ATP_WALLET_PATH + ZIP_SEP); + zipEntries.remove(OLD_ARCHIVE_ATP_WALLET_PATH + ZIP_SEP); + if (!zipEntries.isEmpty()) { + extractPath = DEFAULT_RCU_WALLET_PATH + ZIP_SEP; + extractWallet(domainHome, extractPath, zipEntries, "WLSDPLY-01427", + OLD_ARCHIVE_ATP_WALLET_PATH, DB_WALLETS_DIR_NAME + ZIP_SEP + DEFAULT_RCU_WALLET_NAME); + extractPath = new File(domainHome, extractPath).getAbsolutePath(); + } + } + + LOGGER.exiting(CLASS, METHOD, extractPath); + return extractPath; + } + /////////////////////////////////////////////////////////////////////////// // Private Helper methods used by the protected methods above... // /////////////////////////////////////////////////////////////////////////// diff --git a/core/src/main/python/create.py b/core/src/main/python/create.py index a2bba58da..007dd555d 100644 --- a/core/src/main/python/create.py +++ b/core/src/main/python/create.py @@ -264,7 +264,7 @@ def _validate_atp_wallet_in_archive(archive_helper, is_regular_db, has_tns_admin # 2. If it is plain old regular oracle db, do nothing # 3. If it deos not have tns_admin in the model, then the wallet must be in the archive if not has_tns_admin: - wallet_path = archive_helper.extract_atp_wallet() + wallet_path = archive_helper.extract_database_wallet() if wallet_path: # update the model to add the tns_admin model[model_constants.DOMAIN_INFO][model_constants.RCU_DB_INFO][ @@ -323,7 +323,7 @@ def main(model_context): # check if there is an atpwallet and extract in the domain dir # it is to support non JRF domain but user wants to use ATP database if has_atp and archive_helper: - archive_helper.extract_atp_wallet() + archive_helper.extract_database_wallet() creator = DomainCreator(model_dictionary, model_context, aliases) creator.create() diff --git a/core/src/main/python/wlsdeploy/tool/util/archive_helper.py b/core/src/main/python/wlsdeploy/tool/util/archive_helper.py index cc4da659f..caaf80c95 100644 --- a/core/src/main/python/wlsdeploy/tool/util/archive_helper.py +++ b/core/src/main/python/wlsdeploy/tool/util/archive_helper.py @@ -349,23 +349,30 @@ def get_archive_entries(self): self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=all_entries) return all_entries - def extract_atp_wallet(self): + def extract_database_wallet(self, wallet_name=WLSDeployArchive.DEFAULT_RCU_WALLET_NAME): """ - Extract the and unzip the ATP wallet, if present, and return the path to the wallet directory. + Extract the and unzip the named database wallet, if present, and return the path to + the wallet directory. :return: the path to the extracted wallet, or None if no wallet was found :raises: BundleAwareException of the appropriate type: if an error occurs """ - _method_name = 'extract_atp_wallet' + _method_name = 'extract_database_wallet' self.__logger.entering(class_name=self.__class_name, method_name=_method_name) - wallet_path = None + resulting_wallet_path = None for archive_file in self.__archive_files[::-1]: - wallet_path = archive_file.extractATPWallet(self.__domain_home) + wallet_path = archive_file.extractDatabaseWallet(self.__domain_home, wallet_name) + # Allow iteration to continue through all archive files but + # make sure to store off the path for a wallet that was extracted. + # if wallet_path is not None: - break + # If multiple archives contain the same named wallet, they + # will all have the same path. + # + resulting_wallet_path = wallet_path - self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=wallet_path) - return wallet_path + self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=resulting_wallet_path) + return resulting_wallet_path def extract_opss_wallet(self): """ @@ -376,14 +383,20 @@ def extract_opss_wallet(self): _method_name = 'extract_opss_wallet' self.__logger.entering(class_name=self.__class_name, method_name=_method_name) - wallet_path = None + resulting_wallet_path = None for archive_file in self.__archive_files[::-1]: wallet_path = archive_file.extractOPSSWallet(self.__domain_home) + # Allow iteration to continue through all archive files but + # make sure to store off the path for a wallet that was extracted. + # if wallet_path is not None: - break + # If multiple archives contain the same named wallet, they + # will all have the same path. + # + resulting_wallet_path = wallet_path - self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=wallet_path) - return wallet_path + self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, result=resulting_wallet_path) + return resulting_wallet_path def get_manifest(self, source_path): """ diff --git a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ServerTemplate.json b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ServerTemplate.json index 782fb4a88..be5a7fd90 100644 --- a/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ServerTemplate.json +++ b/core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/ServerTemplate.json @@ -1533,7 +1533,7 @@ ], "CleanupOrphanedSessionsEnabled": [ {"version": "[12.2.1.4,)", "wlst_mode": "both", "wlst_name": "CleanupOrphanedSessionsEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean" } ], "ClientCertProxyEnabled": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "ClientCertProxyEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "boolean" } ], - "Cluster": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "get_method": "LSA", "set_method": "${MBEAN.set_server_cluster_mbean:MBEAN.set_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.ClusterMBean}" } ], + "Cluster": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "Cluster", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "get_method": "LSA", "set_method": "${:MBEAN.set_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.ClusterMBean}" } ], "ClusterWeight": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "ClusterWeight", "wlst_path": "WP001", "default_value": 100, "wlst_type": "integer" } ], "CoherenceClusterSystemResource": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "CoherenceClusterSystemResource", "wlst_path": "WP001", "default_value": null, "wlst_type": "string", "get_method": "LSA", "set_method": "${:MBEAN.set_coherence_cluster_mbean}", "set_mbean_type": "${:weblogic.management.configuration.CoherenceClusterSystemResourceMBean}" } ], "CompleteCOMMessageTimeout": [ {"version": "[12.1.2,)", "wlst_mode": "both", "wlst_name": "CompleteCOMMessageTimeout", "wlst_path": "WP001", "default_value": -1, "wlst_type": "integer" } ], diff --git a/core/src/test/java/oracle/weblogic/deploy/util/WLSDeployArchiveTest.java b/core/src/test/java/oracle/weblogic/deploy/util/WLSDeployArchiveTest.java index bbb03f941..13ac5223a 100644 --- a/core/src/test/java/oracle/weblogic/deploy/util/WLSDeployArchiveTest.java +++ b/core/src/test/java/oracle/weblogic/deploy/util/WLSDeployArchiveTest.java @@ -14,7 +14,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import static oracle.weblogic.deploy.util.WLSDeployArchive.ARCHIVE_ATP_WALLET_PATH; +import static oracle.weblogic.deploy.util.WLSDeployArchive.DEFAULT_RCU_WALLET_PATH; +import static oracle.weblogic.deploy.util.WLSDeployArchive.DEFAULT_RCU_WALLET_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -47,25 +48,25 @@ public class WLSDeployArchiveTest { private static final String BINARIES_MODEL_ZIP_TARGET_NAME = WLSDeployZipFileTest.UNIT_TEST_TARGET_DIR + '/' + ZIP_FILE_EXISTING_BINARIES_FILE; - private static final String ATP_EMPTY_ARCHIVE = "src/test/resources/atp-empty-archive.zip"; - private static final String ATP_EXPANDED_ARCHIVE = "src/test/resources/atp-expanded-archive.zip"; - private static final String ATP_ZIPPED_ARCHIVE = "src/test/resources/atp-zipped-archive.zip"; + private static final String RCU_EMPTY_WALLET_ARCHIVE = "src/test/resources/rcu-empty-wallet-archive.zip"; + private static final String RCU_EXPANDED_WALLET_ARCHIVE = "src/test/resources/rcu-expanded-wallet-archive.zip"; + private static final String RCU_ZIPPED_WALLET_ARCHIVE = "src/test/resources/rcu-zipped-wallet-archive.zip"; private static final String ATP_DEPRECATED_EMPTY_ARCHIVE = "src/test/resources/atp-deprecated-empty-archive.zip"; private static final String ATP_DEPRECATED_EXPANDED_ARCHIVE = "src/test/resources/atp-deprecated-expanded-archive.zip"; private static final String ATP_DEPRECATED_ZIPPED_ARCHIVE = "src/test/resources/atp-deprecated-zipped-archive.zip"; - private static final List ATP_EXPECTED_CONTENT = Arrays.asList( - ARCHIVE_ATP_WALLET_PATH + "/cwallet.sso", - ARCHIVE_ATP_WALLET_PATH + "/ewallet.p12", - ARCHIVE_ATP_WALLET_PATH + "/ewallet.pem", - ARCHIVE_ATP_WALLET_PATH + "/keystore.jks", - ARCHIVE_ATP_WALLET_PATH + "/ojdbc.properties", - ARCHIVE_ATP_WALLET_PATH + "/README", - ARCHIVE_ATP_WALLET_PATH + "/sqlnet.ora", - ARCHIVE_ATP_WALLET_PATH + "/tnsnames.ora", - ARCHIVE_ATP_WALLET_PATH + "/truststore.jks" + private static final List DB_WALLET_EXPECTED_CONTENT = Arrays.asList( + DEFAULT_RCU_WALLET_PATH + "/cwallet.sso", + DEFAULT_RCU_WALLET_PATH + "/ewallet.p12", + DEFAULT_RCU_WALLET_PATH + "/ewallet.pem", + DEFAULT_RCU_WALLET_PATH + "/keystore.jks", + DEFAULT_RCU_WALLET_PATH + "/ojdbc.properties", + DEFAULT_RCU_WALLET_PATH + "/README", + DEFAULT_RCU_WALLET_PATH + "/sqlnet.ora", + DEFAULT_RCU_WALLET_PATH + "/tnsnames.ora", + DEFAULT_RCU_WALLET_PATH + "/truststore.jks" ); @BeforeAll @@ -147,59 +148,59 @@ void testClearAllBinariesWithEmptyZip() throws Exception { } @Test - void testATPZippedWalletExtract() throws Exception { - WLSDeployArchive archive = new WLSDeployArchive(ATP_ZIPPED_ARCHIVE); - File domainHome = new File("target/unit-tests/atp-zipped"); + void testDatabaseZippedWalletExtract() throws Exception { + WLSDeployArchive archive = new WLSDeployArchive(RCU_ZIPPED_WALLET_ARCHIVE); + File domainHome = new File("target/unit-tests/rcu-zipped"); if (!domainHome.exists() && !domainHome.mkdirs()) { fail("Failed to create test domain home directory " + domainHome.getAbsolutePath()); } - String path = archive.extractATPWallet(domainHome); + String path = archive.extractDatabaseWallet(domainHome, DEFAULT_RCU_WALLET_NAME); - File atpWalletDir = new File(domainHome, ARCHIVE_ATP_WALLET_PATH).getCanonicalFile(); - assertEquals(atpWalletDir.getAbsolutePath(), path, "expected extractATPWallet to return correct path"); - assertTrue(atpWalletDir.exists(), "expected " + ARCHIVE_ATP_WALLET_PATH + " directory to exist"); - assertTrue(atpWalletDir.isDirectory(), "expected " + ARCHIVE_ATP_WALLET_PATH + " to be a directory"); + File rcuWalletDir = new File(domainHome, DEFAULT_RCU_WALLET_PATH).getCanonicalFile(); + assertEquals(rcuWalletDir.getAbsolutePath(), path, "expected extractDatabaseWallet to return correct path"); + assertTrue(rcuWalletDir.exists(), "expected " + DEFAULT_RCU_WALLET_NAME + " directory to exist"); + assertTrue(rcuWalletDir.isDirectory(), "expected " + DEFAULT_RCU_WALLET_NAME + " to be a directory"); - for (String atpExpectedFile : ATP_EXPECTED_CONTENT) { - File walletFile = new File(domainHome, atpExpectedFile); - assertTrue(walletFile.exists(), "expected " + atpExpectedFile + " to exist"); + for (String walletExpectedFile : DB_WALLET_EXPECTED_CONTENT) { + File walletFile = new File(domainHome, walletExpectedFile); + assertTrue(walletFile.exists(), "expected " + walletExpectedFile + " to exist"); } } @Test - void testATPExpandedWalletExtract() throws Exception { - WLSDeployArchive archive = new WLSDeployArchive(ATP_EXPANDED_ARCHIVE); - File domainHome = new File("target/unit-tests/atp-unzipped"); + void testDatabaseExpandedWalletExtract() throws Exception { + WLSDeployArchive archive = new WLSDeployArchive(RCU_EXPANDED_WALLET_ARCHIVE); + File domainHome = new File("target/unit-tests/rcu-unzipped"); if (!domainHome.exists() && !domainHome.mkdirs()) { fail("Failed to create test domain home directory " + domainHome.getAbsolutePath()); } - String path = archive.extractATPWallet(domainHome); + String path = archive.extractDatabaseWallet(domainHome, DEFAULT_RCU_WALLET_NAME); - File atpWalletDir = new File(domainHome, ARCHIVE_ATP_WALLET_PATH).getCanonicalFile(); - assertEquals(atpWalletDir.getAbsolutePath(), path, "expected extractATPWallet to return correct path"); - assertTrue(atpWalletDir.exists(), "expected " + ARCHIVE_ATP_WALLET_PATH + " directory to exist"); - assertTrue(atpWalletDir.isDirectory(), "expected " + ARCHIVE_ATP_WALLET_PATH + " to be a directory"); + File rcuWalletDir = new File(domainHome, DEFAULT_RCU_WALLET_PATH).getCanonicalFile(); + assertEquals(rcuWalletDir.getAbsolutePath(), path, "expected extractATPWallet to return correct path"); + assertTrue(rcuWalletDir.exists(), "expected " + DEFAULT_RCU_WALLET_PATH + " directory to exist"); + assertTrue(rcuWalletDir.isDirectory(), "expected " + DEFAULT_RCU_WALLET_PATH + " to be a directory"); - for (String atpExpectedFile : ATP_EXPECTED_CONTENT) { - File walletFile = new File(domainHome, atpExpectedFile); - assertTrue(walletFile.exists(), "expected " + atpExpectedFile + " to exist"); + for (String walletExpectedFile : DB_WALLET_EXPECTED_CONTENT) { + File walletFile = new File(domainHome, walletExpectedFile); + assertTrue(walletFile.exists(), "expected " + walletExpectedFile + " to exist"); } } @Test - void testATPEmptyWalletExtract() throws Exception { - WLSDeployArchive archive = new WLSDeployArchive(ATP_EMPTY_ARCHIVE); - File domainHome = new File("target/unit-tests/atp-empty"); + void testDatabaseEmptyWalletExtract() throws Exception { + WLSDeployArchive archive = new WLSDeployArchive(RCU_EMPTY_WALLET_ARCHIVE); + File domainHome = new File("target/unit-tests/rcu-empty"); if (!domainHome.exists() && !domainHome.mkdirs()) { fail("Failed to create test domain home directory " + domainHome.getAbsolutePath()); } - String path = archive.extractATPWallet(domainHome); - assertNull(path, "expected extractATPWallet to return null"); - File atpWalletDir = new File(domainHome, ARCHIVE_ATP_WALLET_PATH).getCanonicalFile(); - assertFalse(atpWalletDir.exists(), "expected " + ARCHIVE_ATP_WALLET_PATH + " directory to not exist"); + String path = archive.extractDatabaseWallet(domainHome, DEFAULT_RCU_WALLET_NAME); + assertNull(path, "expected extractDatabaseWallet to return null"); + File rcuWalletDir = new File(domainHome, DEFAULT_RCU_WALLET_PATH).getCanonicalFile(); + assertFalse(rcuWalletDir.exists(), "expected " + DEFAULT_RCU_WALLET_PATH + " directory to not exist"); } @Test @@ -210,16 +211,16 @@ void testDeprecatedATPZippedWalletExtract() throws Exception { fail("Failed to create test domain home directory " + domainHome.getAbsolutePath()); } - String path = archive.extractATPWallet(domainHome); + String path = archive.extractDatabaseWallet(domainHome, DEFAULT_RCU_WALLET_NAME); - File atpWalletDir = new File(domainHome, ARCHIVE_ATP_WALLET_PATH).getCanonicalFile(); - assertEquals(atpWalletDir.getAbsolutePath(), path, "expected extractATPWallet to return correct path"); - assertTrue(atpWalletDir.exists(), "expected " + ARCHIVE_ATP_WALLET_PATH + " directory to exist"); - assertTrue(atpWalletDir.isDirectory(), "expected " + ARCHIVE_ATP_WALLET_PATH + " to be a directory"); + File rcuWalletDir = new File(domainHome, DEFAULT_RCU_WALLET_PATH).getCanonicalFile(); + assertEquals(rcuWalletDir.getAbsolutePath(), path, "expected extractDatabaseWallet to return correct path"); + assertTrue(rcuWalletDir.exists(), "expected " + DEFAULT_RCU_WALLET_PATH + " directory to exist"); + assertTrue(rcuWalletDir.isDirectory(), "expected " + DEFAULT_RCU_WALLET_PATH + " to be a directory"); - for (String atpExpectedFile : ATP_EXPECTED_CONTENT) { - File walletFile = new File(domainHome, atpExpectedFile); - assertTrue(walletFile.exists(), "expected " + atpExpectedFile + " to exist"); + for (String walletExpectedFile : DB_WALLET_EXPECTED_CONTENT) { + File walletFile = new File(domainHome, walletExpectedFile); + assertTrue(walletFile.exists(), "expected " + walletExpectedFile + " to exist"); } } @@ -231,16 +232,16 @@ void testDeprecatedATPExpandedWalletExtract() throws Exception { fail("Failed to create test domain home directory " + domainHome.getAbsolutePath()); } - String path = archive.extractATPWallet(domainHome); + String path = archive.extractDatabaseWallet(domainHome, DEFAULT_RCU_WALLET_NAME); - File atpWalletDir = new File(domainHome, ARCHIVE_ATP_WALLET_PATH).getCanonicalFile(); - assertEquals(atpWalletDir.getAbsolutePath(), path, "expected extractATPWallet to return correct path"); - assertTrue(atpWalletDir.exists(), "expected " + ARCHIVE_ATP_WALLET_PATH + " directory to exist"); - assertTrue(atpWalletDir.isDirectory(), "expected " + ARCHIVE_ATP_WALLET_PATH + " to be a directory"); + File rcuWalletDir = new File(domainHome, DEFAULT_RCU_WALLET_PATH).getCanonicalFile(); + assertEquals(rcuWalletDir.getAbsolutePath(), path, "expected extractDatabaseWallet to return correct path"); + assertTrue(rcuWalletDir.exists(), "expected " + DEFAULT_RCU_WALLET_PATH + " directory to exist"); + assertTrue(rcuWalletDir.isDirectory(), "expected " + DEFAULT_RCU_WALLET_PATH + " to be a directory"); - for (String atpExpectedFile : ATP_EXPECTED_CONTENT) { - File walletFile = new File(domainHome, atpExpectedFile); - assertTrue(walletFile.exists(), "expected " + atpExpectedFile + " to exist"); + for (String walletExpectedFile : DB_WALLET_EXPECTED_CONTENT) { + File walletFile = new File(domainHome, walletExpectedFile); + assertTrue(walletFile.exists(), "expected " + walletExpectedFile + " to exist"); } } @@ -252,9 +253,9 @@ void testDeprecatedATPEmptyWalletExtract() throws Exception { fail("Failed to create test domain home directory " + domainHome.getAbsolutePath()); } - String path = archive.extractATPWallet(domainHome); - assertNull(path, "expected extractATPWallet to return null"); - File atpWalletDir = new File(domainHome, ARCHIVE_ATP_WALLET_PATH).getCanonicalFile(); - assertFalse(atpWalletDir.exists(), "expected " + ARCHIVE_ATP_WALLET_PATH + " directory to not exist"); + String path = archive.extractDatabaseWallet(domainHome, DEFAULT_RCU_WALLET_NAME); + assertNull(path, "expected extractDatabaseWallet to return null"); + File atpWalletDir = new File(domainHome, DEFAULT_RCU_WALLET_PATH).getCanonicalFile(); + assertFalse(atpWalletDir.exists(), "expected " + DEFAULT_RCU_WALLET_PATH + " directory to not exist"); } } diff --git a/core/src/test/resources/atp-empty-archive.zip b/core/src/test/resources/atp-empty-archive.zip deleted file mode 100644 index ec441c8ba..000000000 Binary files a/core/src/test/resources/atp-empty-archive.zip and /dev/null differ diff --git a/core/src/test/resources/rcu-empty-wallet-archive.zip b/core/src/test/resources/rcu-empty-wallet-archive.zip new file mode 100644 index 000000000..f1f3fc824 Binary files /dev/null and b/core/src/test/resources/rcu-empty-wallet-archive.zip differ diff --git a/core/src/test/resources/atp-expanded-archive.zip b/core/src/test/resources/rcu-expanded-wallet-archive.zip similarity index 86% rename from core/src/test/resources/atp-expanded-archive.zip rename to core/src/test/resources/rcu-expanded-wallet-archive.zip index 087962db7..1a7f00fd4 100644 Binary files a/core/src/test/resources/atp-expanded-archive.zip and b/core/src/test/resources/rcu-expanded-wallet-archive.zip differ diff --git a/core/src/test/resources/atp-zipped-archive.zip b/core/src/test/resources/rcu-zipped-wallet-archive.zip similarity index 98% rename from core/src/test/resources/atp-zipped-archive.zip rename to core/src/test/resources/rcu-zipped-wallet-archive.zip index 966bd5fde..c34ee182b 100644 Binary files a/core/src/test/resources/atp-zipped-archive.zip and b/core/src/test/resources/rcu-zipped-wallet-archive.zip differ