Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 14b34b6291b3c9f14ca094eb879273b4995d7676 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * Copyright (c) 2013, 2016 Eike Stepper (Loehne, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.cdo.tests.bugzilla;

import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
import org.eclipse.emf.cdo.transaction.CDOTransaction;

import org.eclipse.emf.internal.cdo.session.SessionUtil;
import org.eclipse.emf.internal.cdo.view.CDOViewImpl;

import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.concurrent.ConcurrencyUtil;

/**
 * Bug 417844 - InvalidationRunner can die if invalidations come too early.
 *
 * @author Eike Stepper
 */
public class Bugzilla_417844_Test extends AbstractCDOTest
{
  public void testInvalidationRunnerLifecycle() throws Exception
  {
    CDOSession session = openSession();
    final CDOTransaction transaction = session.openTransaction();
    transaction.createResource(getResourcePath("res1"));

    SessionUtil.setTestDelayInViewActivation(new Runnable()
    {
      public void run()
      {
        try
        {
          transaction.commit(); // Trigger invalidation of the view below
          ConcurrencyUtil.sleep(500L);
        }
        catch (Exception ex)
        {
          throw WrappedException.wrap(ex);
        }
      }
    });

    try
    {
      CDOViewImpl view = (CDOViewImpl)session.openView();
      assertEquals(true, view.isActive());
      assertEquals(true, view.getInvalidationRunner().isActive());
    }
    finally
    {
      SessionUtil.setTestDelayInViewActivation(null);
    }
  }
}

Back to the top