Skip to main content
summaryrefslogtreecommitdiffstats
blob: 4fe7d36008e7f34c5137140ed0a03bd3a39eeca2 (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
/*
 * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, 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:
 *    Egidijus Vaisnora - initial API and implementation
 *    Caspar De Groot - initial API and implementation
 */
package org.eclipse.emf.cdo.tests.bugzilla;

import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
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.cdo.util.CommitException;

import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;

import java.util.Map;

/**
 * @author Egidijus Vaisnora, Caspar De Groot
 */
public class Bugzilla_337523_Test extends AbstractCDOTest
{
  public void testRootResource_loadByID() throws CommitException
  {
    CDOSession session = openSession();
    CDOTransaction transaction = session.openTransaction();

    final CDOID rootID = session.getRepositoryInfo().getRootResourceID();
    CDOObject rootResource1 = transaction.getObject(rootID);

    Map<CDOID, InternalCDOObject> objects = ((InternalCDOTransaction)transaction).getObjects();
    CDOObject rootResource2 = objects.get(rootID);

    assertNotNull(rootResource2);
    assertSame(rootResource1, rootResource2);

    transaction.commit();
    transaction.close();
  }
}

Back to the top