Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3f7861dc77117a3f3023a1e874e7e627857f5c1c (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
/*
 * Copyright (c) 2012 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.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.tests.AbstractCDOTest;
import org.eclipse.emf.cdo.tests.model6.PropertiesMap;
import org.eclipse.emf.cdo.tests.model6.PropertiesMapEntryValue;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.view.CDOView;

/**
 * @author Eike Stepper
 */
public class Bugzilla_376075_Test extends AbstractCDOTest
{
  public void testTransientPut() throws Throwable
  {
    PropertiesMap properties = getModel6Factory().createPropertiesMap();

    CDOSession session = openSession();
    CDOTransaction transaction = session.openTransaction();
    CDOResource resource = transaction.createResource(getResourcePath("/res"));
    resource.getContents().add(properties);
    transaction.commit();

    PropertiesMapEntryValue value = getModel6Factory().createPropertiesMapEntryValue();
    value.setLabel("value");

    CDOView view = session.openView();
    properties = view.getObject(properties);
    properties.getTransientMap().put("key", value);
  }

  public void testTransientRemove() throws Throwable
  {
    PropertiesMapEntryValue value = getModel6Factory().createPropertiesMapEntryValue();
    value.setLabel("value");

    PropertiesMap properties = getModel6Factory().createPropertiesMap();
    properties.getTransientMap().put("key", value);

    CDOSession session = openSession();
    CDOTransaction transaction = session.openTransaction();
    CDOResource resource = transaction.createResource(getResourcePath("/res"));
    resource.getContents().add(properties);
    transaction.commit();

    CDOView view = session.openView();
    properties = view.getObject(properties);
    properties.getTransientMap().remove("key");
  }
}

Back to the top