1 25 26 package org.objectweb.jonas.jtests.clients.entity; 27 28 import java.util.Enumeration ; 29 30 import javax.ejb.FinderException ; 31 32 import org.objectweb.jonas.jtests.beans.ebasic.Simple; 33 34 40 public abstract class A_BasicHomeInterfaceEC extends A_BasicHomeInterface { 41 42 public A_BasicHomeInterfaceEC(String name) { 43 super(name); 44 } 45 46 51 58 public void testFinderBetween() throws Exception { 59 int value = 991959; 60 getHome().create("991959_1", value, value); 61 getHome().create("991959_2", value, value); 62 Simple entity = null; 63 Enumeration eList = null; 64 eList = getHome().findInfo_beetwen(value, value); 65 int nb = 0; 66 while (eList.hasMoreElements()) { 67 entity = (Simple) javax.rmi.PortableRemoteObject.narrow(eList.nextElement(), Simple.class); 68 nb++; 69 assertEquals("Wrong Info value", entity.getInfo(), value); 70 assertEquals("Wrong NumTest value", entity.getNumTest(), value); 71 } 72 assertEquals("Wrong number of entities found", 2, nb); 73 getHome().remove("991959_1"); 74 getHome().remove("991959_2"); 75 } 76 77 84 public void testFinderEqualOne() throws Exception { 85 Simple entity = null; 86 Enumeration eList = null; 87 eList = getHome().findEqualOne(80); 88 int nb = 0; 89 while (eList.hasMoreElements()) { 90 entity = (Simple) javax.rmi.PortableRemoteObject.narrow(eList.nextElement(), Simple.class); 91 nb++; 92 assertEquals(80, entity.getInfo()); 93 assertEquals(80, entity.getNumTest()); 94 } 95 assertEquals(2, nb); 96 } 97 98 105 public void testFinderEqualTwo() throws Exception { 106 Simple entity = null; 107 Enumeration eList = null; 108 eList = getHome().findEqualTwo(100, 90); 109 int nb = 0; 110 while (eList.hasMoreElements()) { 111 entity = (Simple) javax.rmi.PortableRemoteObject.narrow(eList.nextElement(), Simple.class); 112 nb++; 113 assertEquals(100, entity.getInfo()); 114 assertEquals(90, entity.getNumTest()); 115 } 116 assertEquals(1, nb); 117 } 118 119 124 public void testFindOneByNum() throws Exception { 125 try { 126 Simple p = getHome().findOneByNum(4); 127 } catch (FinderException e) { 128 return; 130 } 131 fail("FinderException not thrown as expected"); 132 } 133 134 139 public void testManyOperations() throws Exception { 140 for (int i = 0; i < 100; i++) { 141 getHome().create("pkmany" + i, 20, 6); 142 Simple entity2 = getHome().findByTestName("pkmany" + i); 143 assertEquals(20, entity2.getInfo()); 144 entity2.remove(); 146 } 147 } 148 149 153 public void testHomeMethod() throws Exception { 154 getHome().globalOpe(); 155 } 156 } 157 | Popular Tags |