1 22 package org.jboss.test.ejbconf.test; 24 import java.rmi.RemoteException ; 25 import java.util.Iterator ; 26 import java.util.Collection ; 27 import junit.framework.*; 28 import org.jboss.test.JBossTestCase; 29 import org.jboss.test.ejbconf.beans.interfaces.ReadOnly; 30 import org.jboss.test.ejbconf.beans.interfaces.ReadOnlyHome; 31 import org.jboss.test.ejbconf.beans.interfaces.ReadOnlyHelper; 32 import org.jboss.test.ejbconf.beans.interfaces.ReadOnlyHelperHome; 33 34 35 44 45 public class ReadOnlyUnitTestCase extends JBossTestCase 46 { 47 public ReadOnlyUnitTestCase (String name) 48 { 49 super(name); 50 } 51 52 public static Test suite() throws Exception 53 { 54 return getDeploySetup(ReadOnlyUnitTestCase.class, "ejbconf-test.jar"); 55 } 56 57 public void testReadOnly() throws Exception 58 { 59 ReadOnlyHelperHome rohh = (ReadOnlyHelperHome)getInitialContext().lookup("ReadOnlyHelper"); 60 ReadOnlyHelper roHelper = rohh.create(); 61 roHelper.setUp(); 62 ReadOnlyHome roh = (ReadOnlyHome)getInitialContext().lookup("ReadOnly"); 63 ReadOnly ro = roh.findByPrimaryKey(new Integer (1)); 64 assertTrue("ReadOnly didn't get correct initial value", ro.getValue().equals(new Integer (1))); 65 try 66 { 67 ro.setValue(new Integer (2)); 68 fail("Was able to set read-only field"); 69 } 70 catch(RemoteException e) 71 { 72 getLog().debug("Failed to set read-only field as expected", e); 73 } 74 } 75 76 } | Popular Tags |