We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
as mentioned here updating an async query containing a link will not bring latest result. UT to reproduce
public void testQueryingLink () throws Throwable { final CountDownLatch signalCallbackFinished = new CountDownLatch(1); final CountDownLatch signalClosedRealm = new CountDownLatch(1); final AtomicInteger numberOfInvocations = new AtomicInteger(0); final Realm[] realm = new Realm[1]; final Throwable[] threadAssertionError = new Throwable[1]; final Looper[] backgroundLooper = new Looper[1]; ExecutorService executorService = Executors.newSingleThreadExecutor(); executorService.submit(new Runnable() { @Override public void run() { Looper.prepare(); backgroundLooper[0] = Looper.myLooper(); try { realm[0] = openRealmInstance("testQueryingLink"); final RealmResults<Dog> allAsync = realm[0].where(Dog.class).equalTo("owner.name", "kiba").findAllAsync(); allAsync.addChangeListener(new RealmChangeListener() { @Override public void onChange() { switch (numberOfInvocations.incrementAndGet()) { case 1: { assertEquals(0, allAsync.size()); assertTrue(allAsync.isLoaded()); assertTrue(allAsync.isValid()); assertTrue(allAsync.isEmpty()); final CountDownLatch wait = new CountDownLatch(1); final RealmConfiguration configuration = realm[0].getConfiguration(); new AsyncTask() { @Override protected Object doInBackground(Object[] objects) { Realm instance = Realm.getInstance(configuration); instance.beginTransaction(); Dog dog = instance.createObject(Dog.class); dog.setAge(10); dog.setName("Akamaru"); Owner kiba = instance.createObject(Owner.class); kiba.setName("kiba"); dog.setOwner(kiba); instance.commitTransaction(); wait.countDown(); return null; } }.execute(); try { wait.await(); } catch (InterruptedException e) { e.printStackTrace(); } break; } case 2: { assertEquals(1, realm[0].allObjects(Dog.class).size()); assertEquals(1, realm[0].allObjects(Owner.class).size()); assertEquals(1, allAsync.size()); assertTrue(allAsync.isLoaded()); assertTrue(allAsync.isValid()); assertTrue(allAsync.isEmpty()); signalCallbackFinished.countDown(); break; } default: throw new IllegalStateException("invalid number of invocation"); } } }); Looper.loop(); } catch (Throwable e) { e.printStackTrace(); threadAssertionError[0] = e; } finally { if (signalCallbackFinished.getCount() > 0) { signalCallbackFinished.countDown(); } if (realm.length > 0 && realm[0] != null) { realm[0].close(); } signalClosedRealm.countDown(); } } }); exitOrThrow(executorService, signalCallbackFinished, signalClosedRealm, backgroundLooper, threadAssertionError); }
The text was updated successfully, but these errors were encountered:
adding unit test to expose the fixed issue in Core #1717
c4ad0e1
0c5995a
9970a1d
remove test
da8e895
nhachicha
No branches or pull requests
as mentioned here updating an async query containing a link will not bring latest result.
UT to reproduce
The text was updated successfully, but these errors were encountered: