1 25 package org.objectweb.easybeans.tests.entity; 26 27 import static org.testng.Assert.assertNotNull; 28 import static org.testng.Assert.assertNull; 29 30 import org.objectweb.easybeans.tests.common.ejbs.entity.ebstore.EBStore; 31 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.entitymanager.ItfEntityManagerTester00; 32 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.entitymanager.SLSBEntityManagerTester00; 33 import org.objectweb.easybeans.tests.common.helper.EJBHelper; 34 import org.testng.annotations.BeforeMethod; 35 import org.testng.annotations.Test; 36 37 47 public class TestEntityManager00 { 48 49 52 private static final int PRIMARY_KEY = 1; 53 54 57 private static final String ENTITY_NAME = "test"; 58 59 62 private ItfEntityManagerTester00 slsbEntityManagerTester; 63 64 68 @BeforeMethod 69 public void setup() throws Exception { 70 slsbEntityManagerTester = EJBHelper.getBeanRemoteInstance(SLSBEntityManagerTester00.class, 71 ItfEntityManagerTester00.class); 72 slsbEntityManagerTester.removeEBStore(PRIMARY_KEY); 73 } 74 75 80 @Test 81 public void createNewEntity() { 82 slsbEntityManagerTester.createEBStoreNew(PRIMARY_KEY, ENTITY_NAME); 83 EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY); 84 assertNotNull(ebstore, "The entity was not inserted in the database"); 85 } 86 87 93 @Test 94 public void createRemoved() { 95 slsbEntityManagerTester.createEBStoreRemoved(PRIMARY_KEY, ENTITY_NAME); 96 EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY); 97 assertNotNull(ebstore, "The entity was not re-inserted in the database"); 98 } 99 100 106 @Test 107 public void createManaged() { 108 slsbEntityManagerTester.createEBStoreManaged(PRIMARY_KEY, ENTITY_NAME); 109 EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY); 110 assertNotNull(ebstore, "The persist operation was not ignored."); 111 } 112 113 119 @Test 120 public void removeNew() { 121 slsbEntityManagerTester.removeEBStoreNew(PRIMARY_KEY, ENTITY_NAME); 122 EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY); 123 assertNull(ebstore, "The remove operation was not ignored."); 124 } 125 126 131 @Test 132 public void removeManaged() { 133 slsbEntityManagerTester.removeEBStoreManaged(PRIMARY_KEY, ENTITY_NAME); 134 EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY); 135 assertNull(ebstore, "The remove operation failed."); 136 } 137 138 144 @Test 145 public void removeRemoved() { 146 slsbEntityManagerTester.removeEBStoreManaged(PRIMARY_KEY, ENTITY_NAME); 147 EBStore ebstore = slsbEntityManagerTester.findEBStore(PRIMARY_KEY); 148 assertNull(ebstore, "The remove operation was not ignored."); 149 } 150 } 151 | Popular Tags |