@@ -1285,6 +1285,30 @@ void testAddNewDatabaseWalletDir_ReturnsExceptedResult() throws Exception {
12851285 assertArchiveInExpectedState (LIST_DATABASE_WALLETS , EMPTY_ARRAY , DATABASE_WALLET_WALLET1_CONTENTS );
12861286 }
12871287
1288+ @ Test
1289+ void testAddNewDatabaseWalletFile_ReturnsExpectedResult () throws Exception {
1290+ StringWriter outStringWriter = new StringWriter ();
1291+ StringWriter errStringWriter = new StringWriter ();
1292+ String [] args = new String []{
1293+ "add" ,
1294+ "databaseWallet" ,
1295+ "-archive_file" ,
1296+ NEW_ARCHIVE_VALUE ,
1297+ "-wallet_name" ,
1298+ "wallet1" ,
1299+ "-source" ,
1300+ getSourcePath (ArchiveEntryType .DB_WALLET , "wallet1/atpwallet.zip" )
1301+ };
1302+ int actual = -1 ;
1303+ try (PrintWriter out = new PrintWriter (outStringWriter );
1304+ PrintWriter err = new PrintWriter (errStringWriter )) {
1305+ actual = ArchiveHelper .executeCommand (out , err , args );
1306+ }
1307+
1308+ assertEquals (ExitCode .OK , actual , "expected command to exit with exit code " + ExitCode .OK );
1309+ assertEquals ("wlsdeploy/dbWallets/wallet1/atpwallet.zip" , outStringWriter .toString ().trim ());
1310+ }
1311+
12881312 @ Test
12891313 void testAddDatabaseWalletDirOverwrite_ReturnsExceptedResult () throws Exception {
12901314 StringWriter outStringWriter = new StringWriter ();
@@ -1318,6 +1342,41 @@ void testAddDatabaseWalletDirOverwrite_ReturnsExceptedResult() throws Exception
13181342 assertArchiveInExpectedState (LIST_DATABASE_WALLETS , EMPTY_ARRAY , DATABASE_WALLET_WALLET1_CONTENTS );
13191343 }
13201344
1345+ @ Test
1346+ void testAddNewDatabaseWalletFileOverwrite_ReturnsExpectedResult () throws Exception {
1347+ StringWriter outStringWriter = new StringWriter ();
1348+ StringWriter errStringWriter = new StringWriter ();
1349+ String [] args = new String []{
1350+ "add" ,
1351+ "databaseWallet" ,
1352+ "-archive_file" ,
1353+ NEW_ARCHIVE_VALUE ,
1354+ "-wallet_name" ,
1355+ "wallet1" ,
1356+ "-source" ,
1357+ getSourcePath (ArchiveEntryType .DB_WALLET , "wallet1/atpwallet.zip" )
1358+ };
1359+
1360+ int actual = -1 ;
1361+ try (PrintWriter out = new PrintWriter (outStringWriter );
1362+ PrintWriter err = new PrintWriter (errStringWriter )) {
1363+ actual = ArchiveHelper .executeCommand (out , err , args );
1364+ }
1365+
1366+ assertEquals (ExitCode .OK , actual , "expected command to exit with exit code " + ExitCode .OK );
1367+
1368+ outStringWriter = new StringWriter ();
1369+ errStringWriter = new StringWriter ();
1370+ String [] overwriteArgs = getOverwriteArgs (args );
1371+ try (PrintWriter out = new PrintWriter (outStringWriter );
1372+ PrintWriter err = new PrintWriter (errStringWriter )) {
1373+ actual = ArchiveHelper .executeCommand (out , err , overwriteArgs );
1374+ }
1375+
1376+ assertEquals (ExitCode .OK , actual , "expected command to exit with exit code " + ExitCode .OK );
1377+ assertEquals ("wlsdeploy/dbWallets/wallet1/atpwallet.zip" , outStringWriter .toString ().trim ());
1378+ }
1379+
13211380 @ Test
13221381 void testAddDatabaseWalletDirTwice_ReturnsExceptedResult () throws Exception {
13231382 StringWriter outStringWriter = new StringWriter ();
@@ -1351,6 +1410,40 @@ void testAddDatabaseWalletDirTwice_ReturnsExceptedResult() throws Exception {
13511410 DATABASE_WALLET_WALLET1_DUP_CONTENTS );
13521411 }
13531412
1413+ @ Test
1414+ void testAddDatabaseWalletFileTwice_ReturnsExceptedResult () throws Exception {
1415+ StringWriter outStringWriter = new StringWriter ();
1416+ StringWriter errStringWriter = new StringWriter ();
1417+ String [] args = new String [] {
1418+ "add" ,
1419+ "databaseWallet" ,
1420+ "-archive_file" ,
1421+ NEW_ARCHIVE_VALUE ,
1422+ "-wallet_name" ,
1423+ "wallet1" ,
1424+ "-source" ,
1425+ getSourcePath (ArchiveEntryType .DB_WALLET , "wallet1/atpwallet.zip" )
1426+ };
1427+
1428+ int actual = -1 ;
1429+ try (PrintWriter out = new PrintWriter (outStringWriter );
1430+ PrintWriter err = new PrintWriter (errStringWriter )) {
1431+ actual = ArchiveHelper .executeCommand (out , err , args );
1432+ }
1433+
1434+ assertEquals (ExitCode .OK , actual , "expected command to exit with exit code " + ExitCode .OK );
1435+
1436+ outStringWriter = new StringWriter ();
1437+ errStringWriter = new StringWriter ();
1438+ try (PrintWriter out = new PrintWriter (outStringWriter );
1439+ PrintWriter err = new PrintWriter (errStringWriter )) {
1440+ actual = ArchiveHelper .executeCommand (out , err , args );
1441+ }
1442+
1443+ assertEquals (ExitCode .OK , actual , "expected command to exit with exit code " + ExitCode .OK );
1444+ assertEquals ("wlsdeploy/dbWallets/wallet1/atpwallet(1).zip" , outStringWriter .toString ().trim ());
1445+ }
1446+
13541447 ///////////////////////////////////////////////////////////////////////////////////////////////
13551448 // $DOMAIN_HOME/bin script //
13561449 ///////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments