Examples of EntityPK


Examples of org.jboss.test.cluster.ejb2.basic.interfaces.EntityPK

      try
      {
         InitialContext ctx = new InitialContext();
         Context enc = (Context) ctx.lookup("java:comp/env");
         EntityPKHome home = (EntityPKHome) enc.lookup("ejb/EntityPKHome");
         EntityPK bean = home.findByPrimaryKey(theKey);
         beanCount = bean.getOtherField();
         if( beanCount != count )
            throw new RemoteException("BeanCount: " + beanCount + " != " + count);
      }
      catch(RemoteException e)
      {
View Full Code Here

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

      getLog().debug("+++ testFindByPrimaryKey()");
      Object obj = getInitialContext().lookup(ENTITY);
      obj = PortableRemoteObject.narrow(obj, EntityHome.class);
      EntityHome home = (EntityHome) obj;
      getLog().debug("Found EntityHome @ jndiName=Entity");
      EntityPK key = new EntityPK(0);
      Entity bean = null;

      getLog().debug("Running with " + iterationCount + " instances...");
      findByPrimaryKey(key, home);
   }
View Full Code Here

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

      Object obj = getInitialContext().lookup(jndiName);
      obj = PortableRemoteObject.narrow(obj, EntityHome.class);
      EntityHome home = (EntityHome) obj;
      getLog().debug("Removing "+max+" Entity beans");
      for(int n = 0; n < max; n ++)
         home.remove(new EntityPK(n));
   }
View Full Code Here

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

      }
   }

   private EntityLocal findByPrimaryKey(int key) throws FinderException
   {
      EntityPK primaryKey = new EntityPK(key);
      return entityHome.findByPrimaryKey(primaryKey);
   }
View Full Code Here

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

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

      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

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

            Context enc = (Context) ctx.lookup("java:comp/env");
            EntityHome home = (EntityHome) enc.lookup("ejb/Entity");
            try
            {
               //Remove old entity beans from previous test runs
               Entity existing = home.findByPrimaryKey(new EntityPK(12345));
               if(existing != null)
               {
                  existing.remove();
               }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.