@Test
  public void testValuesIterationOnRR() {
    Host host = Host.getHost(0);
    VM accessor = host.getVM(0);
    VM datastore1 = host.getVM(1);
    VM datastore2 = host.getVM(2);
    initAccessorAndDataStore(accessor, datastore1, datastore2, 0);

    accessor.invoke(new SerializableCallable<Object>() {
      @Override
      public Object call() {
        Region custRegion = getCache().getRegion(CUSTOMER);
        Region rr = getCache().getRegion(D_REFERENCE);
        TXManagerImpl mgr = getCache().getTxManager();
        mgr.begin();
        CustId custId = new CustId(5);
        Customer customer = new Customer("customer5", "address5");
        custRegion.put(custId, customer);
        Set set = (Set) rr.values();
        Iterator it = set.iterator();
        int i = 0;
        while (it.hasNext()) {
          i++;
          it.next();
        }
        assertThat(i).isEqualTo(5);
        assertThat(getCustomerSet(5)).isEqualTo(set);
        assertThat(rr.values().size()).isEqualTo(5);
        rr.put(custId, customer);
        set = (Set) rr.values();
        assertThat(getCustomerSet(6)).isEqualTo(set);
        it = set.iterator();
        i = 0;
        while (it.hasNext()) {
          i++;
          it.next();
        }
        assertThat(i).isEqualTo(6);
        assertThat(rr.values().size()).isEqualTo(6);
        assertThat(rr.get(custId)).isNotNull();
        TXStateProxy tx = mgr.pauseTransaction();
        assertThat(getCustomerSet(5)).isEqualTo(rr.values());
        assertThat(rr.values().size()).isEqualTo(5);
        assertThat(rr.get(custId)).isNull();
        mgr.unpauseTransaction(tx);
        mgr.commit();
        return null;
      }
    });
  }
When we have narrowed down on a target node for a transaction, test that we throw an exception
if that node does not host primary for subsequent entries
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/RemoteTransactionDUnitTest.java