Fixed bugs in sync migration test

pull/14/head
Sam Bosley 12 years ago
parent 594f1976bb
commit a7bac3e142

@ -146,7 +146,7 @@ public class Astrid44SyncMigrator {
try { try {
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
instance.readPropertiesFromCursor(cursor); 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 // No remote id exists, just create a UUID
Pair<String, String> uuidPair = UUIDHelper.newUUID(); Pair<String, String> uuidPair = UUIDHelper.newUUID();
instance.setValue(RemoteModel.UUID_PROPERTY, uuidPair.getLeft()); instance.setValue(RemoteModel.UUID_PROPERTY, uuidPair.getLeft());

@ -104,9 +104,9 @@ public class Astrid44MigrationTest extends NewSyncTestCase {
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
instance.clear(); instance.clear();
instance.readPropertiesFromCursor(cursor); instance.readPropertiesFromCursor(cursor);
BigInteger uuid = instance.getValue(RemoteModel.UUID_PROPERTY); String uuid = instance.getValue(RemoteModel.UUID_PROPERTY);
if (uuid == null || uuid.intValue() == 0) { if (uuid == null || RemoteModel.NO_UUID.equals(uuid)) {
fail(instance.getClass().getName() + instance.getId() + " didn't have a uuid"); fail(instance.getClass().getName() + " " + instance.getId() + " didn't have a uuid");
} }
} }
} finally { } finally {
@ -141,8 +141,8 @@ public class Astrid44MigrationTest extends NewSyncTestCase {
for (tagMetadata.moveToFirst(); !tagMetadata.isAfterLast(); tagMetadata.moveToNext()) { for (tagMetadata.moveToFirst(); !tagMetadata.isAfterLast(); tagMetadata.moveToNext()) {
m.readFromCursor(tagMetadata); m.readFromCursor(tagMetadata);
assertTrue(!TextUtils.isEmpty(m.getValue(TagMetadata.TAG_NAME))); assertTrue(!TextUtils.isEmpty(m.getValue(TagMetadata.TAG_NAME)));
assertTrue(m.getValue(TagMetadata.TASK_UUID) != 0); assertTrue(!RemoteModel.NO_UUID.equals(m.getValue(TagMetadata.TASK_UUID)));
assertTrue(m.getValue(TagMetadata.TAG_UUID) != 0); assertTrue(!RemoteModel.NO_UUID.equals(m.getValue(TagMetadata.TAG_UUID)));
} }
} finally { } finally {
tagMetadata.close(); tagMetadata.close();

Loading…
Cancel
Save