Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 1d3327a

Browse files
author
Hideki Itakura
authored
Merge pull request #981 from couchbase/feature/fix_windows_upgradedb_test
Fixed #980 : Upgrade db test failed on Windows
2 parents 151c25a + 7c36044 commit 1d3327a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/androidTest/java/com/couchbase/lite/ManagerTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,13 +770,13 @@ public void validate(Database db) throws CouchbaseLiteException, IOException {
770770
}
771771

772772
private void _testUpgradeDatabaseV1WithFakeTempDb(String zipFile, String dbname, ValidateDatabaseCallback callback) throws Exception {
773-
// close manager
773+
// Close manager
774774
if (manager != null) {
775775
manager.close();
776776
manager = null;
777777
}
778778

779-
// clean folder & generate new context
779+
// Clean folder & generate new context
780780
Context ctx = getTestContext(zipFile, true);
781781
assertNotNull(ctx);
782782

@@ -785,18 +785,22 @@ private void _testUpgradeDatabaseV1WithFakeTempDb(String zipFile, String dbname,
785785
File srcDir = new File(rootDir, zipFile);
786786
FileDirUtils.deleteRecursive(srcDir);
787787

788-
// create temporary database which is fake upgrage temporary file
788+
// Create temporary database to fake pending upgrade temporary file
789789
Manager mgr = new Manager(ctx, new ManagerOptions());
790790
DatabaseOptions opt = new DatabaseOptions();
791791
opt.setCreate(true);
792+
792793
Database tmpDB = mgr.openDatabase(dbname + ".tmp", opt);
793794
assertNotNull(tmpDB);
794795
Document tmpDoc = tmpDB.createDocument();
795796
Map<String, Object> props = new HashMap<String, Object>();
796797
props.put("tmp", "Temporary");
797798
tmpDoc.putProperties(props);
798799

799-
// make sure temporary db exists
800+
// Close the temporary database
801+
tmpDB.close();
802+
803+
// Make sure temporary db exists
800804
File tmpDbDir = new File(ctx.getFilesDir(), dbname+".tmp.cblite2");
801805
assertTrue(tmpDbDir.isDirectory());
802806
assertTrue(tmpDbDir.exists());
@@ -813,6 +817,7 @@ private void _testUpgradeDatabaseV1WithFakeTempDb(String zipFile, String dbname,
813817
Database db = mgr.getExistingDatabase(dbname);
814818
assertNotNull(db);
815819
assertTrue(db.exists());
820+
816821
// validate upgrade db
817822
callback.validate(db);
818823

0 commit comments

Comments
 (0)