From a7bac3e142eef7f1a7c56f991fb2beb525c6abbb Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Tue, 2 Oct 2012 11:35:41 -0700 Subject: [PATCH] Fixed bugs in sync migration test --- .../com/todoroo/astrid/tags/Astrid44SyncMigrator.java | 2 +- .../com/todoroo/astrid/sync/Astrid44MigrationTest.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/tags/Astrid44SyncMigrator.java b/astrid/plugin-src/com/todoroo/astrid/tags/Astrid44SyncMigrator.java index 959814f29..c51a04212 100644 --- a/astrid/plugin-src/com/todoroo/astrid/tags/Astrid44SyncMigrator.java +++ b/astrid/plugin-src/com/todoroo/astrid/tags/Astrid44SyncMigrator.java @@ -146,7 +146,7 @@ public class Astrid44SyncMigrator { try { for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { instance.readPropertiesFromCursor(cursor); - if (!instance.containsNonNullValue(RemoteModel.REMOTE_ID_PROPERTY)) { + if (!instance.containsNonNullValue(RemoteModel.REMOTE_ID_PROPERTY) || instance.getValue(RemoteModel.REMOTE_ID_PROPERTY) == 0) { // No remote id exists, just create a UUID Pair uuidPair = UUIDHelper.newUUID(); instance.setValue(RemoteModel.UUID_PROPERTY, uuidPair.getLeft()); diff --git a/tests-sync/src/com/todoroo/astrid/sync/Astrid44MigrationTest.java b/tests-sync/src/com/todoroo/astrid/sync/Astrid44MigrationTest.java index 6251ed7d9..ba1485356 100644 --- a/tests-sync/src/com/todoroo/astrid/sync/Astrid44MigrationTest.java +++ b/tests-sync/src/com/todoroo/astrid/sync/Astrid44MigrationTest.java @@ -104,9 +104,9 @@ public class Astrid44MigrationTest extends NewSyncTestCase { for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { instance.clear(); instance.readPropertiesFromCursor(cursor); - BigInteger uuid = instance.getValue(RemoteModel.UUID_PROPERTY); - if (uuid == null || uuid.intValue() == 0) { - fail(instance.getClass().getName() + instance.getId() + " didn't have a uuid"); + String uuid = instance.getValue(RemoteModel.UUID_PROPERTY); + if (uuid == null || RemoteModel.NO_UUID.equals(uuid)) { + fail(instance.getClass().getName() + " " + instance.getId() + " didn't have a uuid"); } } } finally { @@ -141,8 +141,8 @@ public class Astrid44MigrationTest extends NewSyncTestCase { for (tagMetadata.moveToFirst(); !tagMetadata.isAfterLast(); tagMetadata.moveToNext()) { m.readFromCursor(tagMetadata); assertTrue(!TextUtils.isEmpty(m.getValue(TagMetadata.TAG_NAME))); - assertTrue(m.getValue(TagMetadata.TASK_UUID) != 0); - assertTrue(m.getValue(TagMetadata.TAG_UUID) != 0); + assertTrue(!RemoteModel.NO_UUID.equals(m.getValue(TagMetadata.TASK_UUID))); + assertTrue(!RemoteModel.NO_UUID.equals(m.getValue(TagMetadata.TAG_UUID))); } } finally { tagMetadata.close();