diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java | 380 |
1 files changed, 190 insertions, 190 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java index f9bccac2fa..08e6ada0c4 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/EnumTest.java @@ -1,190 +1,190 @@ -/*
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.tests;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.tests.model1.Category;
-import org.eclipse.emf.cdo.tests.model1.Product1;
-import org.eclipse.emf.cdo.tests.model1.VAT;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-
-/**
- * @author Eike Stepper
- */
-public class EnumTest extends AbstractCDOTest
-{
- public void testTransient() throws Exception
- {
- {
- Product1 product = getModel1Factory().createProduct1();
- product.setName("Normal Product");
- product.setVat(VAT.VAT7);
-
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
- resource.getContents().add(product);
- transaction.commit();
- session.close();
- }
-
- {
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.getResource(getResourcePath("/my/resource"));
- Product1 product = (Product1)resource.getContents().get(0);
- assertEquals(VAT.VAT7, product.getVat());
-
- product.setVat(VAT.VAT15);
- transaction.commit();
- session.close();
- }
-
- {
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.getResource(getResourcePath("/my/resource"));
- Product1 product = (Product1)resource.getContents().get(0);
- assertEquals(VAT.VAT15, product.getVat());
- session.close();
- }
- }
-
- public void testTransientFresh() throws Exception
- {
- {
- Product1 product = getModel1Factory().createProduct1();
- product.setName("Normal Product");
- product.setVat(VAT.VAT7);
-
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
- resource.getContents().add(product);
- transaction.commit();
- session.close();
- }
-
- clearCache(getRepository().getRevisionManager());
-
- {
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.getResource(getResourcePath("/my/resource"));
- Product1 product = (Product1)resource.getContents().get(0);
- assertEquals(VAT.VAT7, product.getVat());
-
- product.setVat(VAT.VAT15);
- transaction.commit();
- session.close();
- }
-
- clearCache(getRepository().getRevisionManager());
-
- {
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.getResource(getResourcePath("/my/resource"));
- Product1 product = (Product1)resource.getContents().get(0);
- assertEquals(VAT.VAT15, product.getVat());
- session.close();
- }
- }
-
- public void testAttached() throws Exception
- {
- {
- Category category = getModel1Factory().createCategory();
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
- resource.getContents().add(category);
-
- Product1 product = getModel1Factory().createProduct1();
- product.setName("Normal Product");
- product.setVat(VAT.VAT7);
- category.getProducts().add(product);
-
- transaction.commit();
- session.close();
- }
-
- {
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.getResource(getResourcePath("/my/resource"));
- Category category = (Category)resource.getContents().get(0);
- Product1 product = category.getProducts().get(0);
- assertEquals(VAT.VAT7, product.getVat());
-
- product.setVat(VAT.VAT15);
- transaction.commit();
- session.close();
- }
-
- {
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.getResource(getResourcePath("/my/resource"));
- Category category = (Category)resource.getContents().get(0);
- Product1 product = category.getProducts().get(0);
- assertEquals(VAT.VAT15, product.getVat());
- session.close();
- }
- }
-
- public void testAttachedFresh() throws Exception
- {
- {
- Category category = getModel1Factory().createCategory();
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
- resource.getContents().add(category);
-
- Product1 product = getModel1Factory().createProduct1();
- product.setName("Normal Product");
- product.setVat(VAT.VAT7);
- category.getProducts().add(product);
-
- transaction.commit();
- session.close();
- }
-
- clearCache(getRepository().getRevisionManager());
-
- {
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.getResource(getResourcePath("/my/resource"));
- Category category = (Category)resource.getContents().get(0);
- Product1 product = category.getProducts().get(0);
- assertEquals(VAT.VAT7, product.getVat());
-
- product.setVat(VAT.VAT15);
- transaction.commit();
- session.close();
- }
-
- clearCache(getRepository().getRevisionManager());
-
- {
- CDOSession session = openSession();
- CDOTransaction transaction = session.openTransaction();
- CDOResource resource = transaction.getResource(getResourcePath("/my/resource"));
- Category category = (Category)resource.getContents().get(0);
- Product1 product = category.getProducts().get(0);
- assertEquals(VAT.VAT15, product.getVat());
- session.close();
- }
- }
-}
+/* + * 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: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.tests; + +import org.eclipse.emf.cdo.eresource.CDOResource; +import org.eclipse.emf.cdo.session.CDOSession; +import org.eclipse.emf.cdo.tests.model1.Category; +import org.eclipse.emf.cdo.tests.model1.Product1; +import org.eclipse.emf.cdo.tests.model1.VAT; +import org.eclipse.emf.cdo.transaction.CDOTransaction; + +/** + * @author Eike Stepper + */ +public class EnumTest extends AbstractCDOTest +{ + public void testTransient() throws Exception + { + { + Product1 product = getModel1Factory().createProduct1(); + product.setName("Normal Product"); + product.setVat(VAT.VAT7); + + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/my/resource")); + resource.getContents().add(product); + transaction.commit(); + session.close(); + } + + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.getResource(getResourcePath("/my/resource")); + Product1 product = (Product1)resource.getContents().get(0); + assertEquals(VAT.VAT7, product.getVat()); + + product.setVat(VAT.VAT15); + transaction.commit(); + session.close(); + } + + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.getResource(getResourcePath("/my/resource")); + Product1 product = (Product1)resource.getContents().get(0); + assertEquals(VAT.VAT15, product.getVat()); + session.close(); + } + } + + public void testTransientFresh() throws Exception + { + { + Product1 product = getModel1Factory().createProduct1(); + product.setName("Normal Product"); + product.setVat(VAT.VAT7); + + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/my/resource")); + resource.getContents().add(product); + transaction.commit(); + session.close(); + } + + clearCache(getRepository().getRevisionManager()); + + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.getResource(getResourcePath("/my/resource")); + Product1 product = (Product1)resource.getContents().get(0); + assertEquals(VAT.VAT7, product.getVat()); + + product.setVat(VAT.VAT15); + transaction.commit(); + session.close(); + } + + clearCache(getRepository().getRevisionManager()); + + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.getResource(getResourcePath("/my/resource")); + Product1 product = (Product1)resource.getContents().get(0); + assertEquals(VAT.VAT15, product.getVat()); + session.close(); + } + } + + public void testAttached() throws Exception + { + { + Category category = getModel1Factory().createCategory(); + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/my/resource")); + resource.getContents().add(category); + + Product1 product = getModel1Factory().createProduct1(); + product.setName("Normal Product"); + product.setVat(VAT.VAT7); + category.getProducts().add(product); + + transaction.commit(); + session.close(); + } + + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.getResource(getResourcePath("/my/resource")); + Category category = (Category)resource.getContents().get(0); + Product1 product = category.getProducts().get(0); + assertEquals(VAT.VAT7, product.getVat()); + + product.setVat(VAT.VAT15); + transaction.commit(); + session.close(); + } + + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.getResource(getResourcePath("/my/resource")); + Category category = (Category)resource.getContents().get(0); + Product1 product = category.getProducts().get(0); + assertEquals(VAT.VAT15, product.getVat()); + session.close(); + } + } + + public void testAttachedFresh() throws Exception + { + { + Category category = getModel1Factory().createCategory(); + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.createResource(getResourcePath("/my/resource")); + resource.getContents().add(category); + + Product1 product = getModel1Factory().createProduct1(); + product.setName("Normal Product"); + product.setVat(VAT.VAT7); + category.getProducts().add(product); + + transaction.commit(); + session.close(); + } + + clearCache(getRepository().getRevisionManager()); + + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.getResource(getResourcePath("/my/resource")); + Category category = (Category)resource.getContents().get(0); + Product1 product = category.getProducts().get(0); + assertEquals(VAT.VAT7, product.getVat()); + + product.setVat(VAT.VAT15); + transaction.commit(); + session.close(); + } + + clearCache(getRepository().getRevisionManager()); + + { + CDOSession session = openSession(); + CDOTransaction transaction = session.openTransaction(); + CDOResource resource = transaction.getResource(getResourcePath("/my/resource")); + Category category = (Category)resource.getContents().get(0); + Product1 product = category.getProducts().get(0); + assertEquals(VAT.VAT15, product.getVat()); + session.close(); + } + } +} |