private void testCDORevisionPrefetchOnBranch(CDOSession session, CDOBranch cdoBranch)
      throws Exception {
    CDOTransaction view = session.openTransaction(cdoBranch);
    ISignalProtocol<?> protocol =
        ((org.eclipse.emf.cdo.net4j.CDONet4jSession) session).options().getNet4jProtocol();
    SignalCounter signalCounter = new SignalCounter(protocol);
    assertEquals(0, signalCounter.getCountFor(LoadRevisionsRequest.class));

    String resourcePath = getResourcePath(RESOURCE_NAME);
    List<String> pathSegments = CDOURIUtil.analyzePath(resourcePath);
    CDOResource resource = view.getResource(resourcePath);
    assertEquals(pathSegments.size(), signalCounter.getCountFor(LoadRevisionsRequest.class));
    resource.cdoPrefetch(CDORevision.DEPTH_INFINITE);

    assertEquals(pathSegments.size() + 1, signalCounter.getCountFor(LoadRevisionsRequest.class));

    Company company = (Company) resource.getContents().get(0);
    CDOID companyCDOID = CDOUtil.getCDOObject(company).cdoID();

    assertEquals(pathSegments.size() + 1, signalCounter.getCountFor(LoadRevisionsRequest.class));

    view.getRevision(companyCDOID);

    assertEquals(pathSegments.size() + 1, signalCounter.getCountFor(LoadRevisionsRequest.class));

    view.getResourceSet().eAdapters().add(new EContentAdapter());

    assertEquals(pathSegments.size() + 1, signalCounter.getCountFor(LoadRevisionsRequest.class));

    protocol.removeListener(signalCounter);
  }
  private void testCDORevisionFetchWithChangesOnAllBranches(
      CDOSession session,
      CDOBranch currentBranch,
      SignalCounter signalCounter,
      CDOID companyCDOID,
      int expectedNbCategories,
      boolean prefetch) {
    CDOView view = session.openView(currentBranch);
    assertEquals(0, signalCounter.getCountFor(LoadRevisionsRequest.class));

    String resourcePath = getResourcePath(RESOURCE_NAME);
    List<String> pathSegments = CDOURIUtil.analyzePath(resourcePath);
    CDOResource resource = view.getResource(resourcePath);
    assertEquals(pathSegments.size(), signalCounter.getCountFor(LoadRevisionsRequest.class));

    if (prefetch) {
      resource.cdoPrefetch(CDORevision.DEPTH_INFINITE);
    }
    assertEquals(RESOURCE_NAME, resource.getName());
    EObject eObject = resource.getContents().get(0);
    Assert.assertTrue(eObject instanceof Company);
    Company company = (Company) eObject;
    assertEquals(pathSegments.size() + 1, signalCounter.getCountFor(LoadRevisionsRequest.class));
    Assert.assertEquals(expectedNbCategories, company.getCategories().size());

    view.getRevision(companyCDOID);

    assertEquals(pathSegments.size() + 1, signalCounter.getCountFor(LoadRevisionsRequest.class));

    view.getResourceSet().eAdapters().add(new EContentAdapter());

    assertEquals(pathSegments.size() + 1, signalCounter.getCountFor(LoadRevisionsRequest.class));

    view.close();
    signalCounter.clearCounts();
  }