Package org.jboss.test.testbean.interfaces

Examples of org.jboss.test.testbean.interfaces.EntityPK


      EntityPKHome pkHome = (EntityPKHome) ctx.lookup("nextgen.EntityPK");
      assertTrue("pkHome != null", pkHome != null);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"Calling find on the home...");
      EntityPK pkBean = null;

      // Let's try to find the instance
      try {

         pkBean =  pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100, 1000.0, "Marc"));
      } catch (Exception e) {

         getLog().debug("not found");
         getLog().debug(++test+"- "+"Did not find the instance will create it...");
         pkBean = pkHome.create(true, 10,100, 1000.0, "Marc");
      }


      assertTrue("pkBean != null", pkBean != null);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"Retrieving other field...");
      assertTrue("pkBean.getOtherField() == 0", pkBean.getOtherField() == 0);
      getLog().debug(++test+"- "+"Setting it to 4...");
      pkBean.setOtherField(4);
      getLog().debug("ok");

      getLog().debug(++test+"- "+"Findind it again ... ") ;

      // Now we should be able to find it
      pkBean = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100,1000.0, "Marc"));

      assertTrue("pkBean != null", pkBean != null);
      getLog().debug("ok");

      // check if the other field has been saved
      getLog().debug(++test+"- "+"Retrieving other field again, should be 4...");
      int newValue = pkBean.getOtherField();
      assertTrue("pkBean.getOtherField() == 4", newValue == 4);
      getLog().debug("4, ok");

      // Get a new EJBObject for this guy
      // Now we should be able to find it
      getLog().debug(++test+"- gettting a new reference ... ") ;
      EntityPK pkBean2 = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100,1000.0, "Marc"));
      assertTrue("findByPrimaryKey AComplexPK", pkBean2 != null);
      getLog().debug("ok");
      getLog().debug(++test+"- Retrieving other field again, should be 4...");
      int newValue2 = pkBean2.getOtherField();
      assertTrue("Retrieving other field again, should be 4...", newValue2 == 4);

      // Now remove it
      getLog().debug(++test+"- "+"Removing the bean...");
      pkBean.remove();
View Full Code Here


      EntityPKHome pkHome = (EntityPKHome) ctx.lookup("nextgen_EntityPK" + getJndiSuffix());
      assertTrue("pkHome != null", pkHome != null);
      getLog().debug("ok");

      getLog().debug("Calling find on the home...");
      EntityPK pkBean = null;

      Random rnd = new Random(System.currentTimeMillis());
      int anInt = rnd.nextInt(10);
      int other = rnd.nextInt(10000);
      AComplexPK pk = new AComplexPK(true, anInt, 100, 1000.0, "Marc");
      // Let's try to find the instance
      try
      {
         pkBean =  pkHome.findByPrimaryKey(pk);
      }
      catch (Exception e)
      {
         getLog().debug("Did not find the instance will create it...");
         pkBean = pkHome.create(true, anInt, 100, 1000.0, "Marc");
      }


      assertTrue("pkBean != null", pkBean != null);
      getLog().debug("ok");

      getLog().debug("Setting otherField to " + other + "...");
      pkBean.setOtherField(other);
      getLog().debug("ok");
     
     
      // Reconfigure the cluster so the existing targets are invalid
      reconfigureCluster();
View Full Code Here

TOP

Related Classes of org.jboss.test.testbean.interfaces.EntityPK

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.