Package org.jboss.test.cmp2.cmr.interfaces

Examples of org.jboss.test.cmp2.cmr.interfaces.CMRBugManagerEJB


   public void testScenario2() throws Exception
   {     
      InitialContext ic = new InitialContext();
      FacadeHome fh = (FacadeHome) PortableRemoteObject.narrow(ic.lookup("Facade"), FacadeHome.class);
      Facade facade = fh.create();
      facade.createScenario2();
      facade.deleteBeans();
   }
View Full Code Here


   }

   public void testScenario1() throws Exception
   {     
      InitialContext ic = new InitialContext();
      FacadeHome fh = (FacadeHome) PortableRemoteObject.narrow(ic.lookup("Facade"), FacadeHome.class);
      Facade facade = fh.create();
      facade.createScenario1();
      facade.deleteBeans();
   }
View Full Code Here

   }

   public void testScenario2() throws Exception
   {     
      InitialContext ic = new InitialContext();
      FacadeHome fh = (FacadeHome) PortableRemoteObject.narrow(ic.lookup("Facade"), FacadeHome.class);
      Facade facade = fh.create();
      facade.createScenario2();
      facade.deleteBeans();
   }
View Full Code Here

            String root = (String)entry.getKey();

            String id = root;
            String description = (String)entry.getValue();

            CMRBugEJBLocal parent = cmrBugHome.create(id, description, null);
            entry.setValue(parent);

            while(i.hasNext())
            {
               entry = (Map.Entry)i.next();
View Full Code Here

    */
   public String[] getParentFor(String id)
   {
      try
      {
         CMRBugEJBLocal cmrBug = cmrBugHome.findByPrimaryKey(id);
         CMRBugEJBLocal parent = cmrBug.getParent();

         String[] parentIdAndDescription = null;
         if(parent != null)
         {
            parentIdAndDescription = new String[2];
            parentIdAndDescription[0] = parent.getId();
            parentIdAndDescription[1] = parent.getDescription();
         }

         return parentIdAndDescription;
      }
      catch(Exception e)
View Full Code Here

    * @ejb.transaction type="RequiresNew"
    */
   public void setupLoadFKState()
      throws Exception
   {
      CMRBugEJBLocal bug1 = cmrBugHome.create("first", null, null);
      CMRBugEJBLocal bug2 = cmrBugHome.create("second", null, null);
      CMRBugEJBLocal bug3 = cmrBugHome.create("third", null, null);
      CMRBugEJBLocal bug4 = cmrBugHome.create("forth", null, null);

      bug1.setNextNode(bug2);
      bug2.setNextNode(bug3);
      bug3.setNextNode(bug4);

      bug4.setPrevNode(bug3);
      bug3.setPrevNode(bug2);
      bug2.setPrevNode(bug1);
   }
View Full Code Here

    * @ejb.transaction type="RequiresNew"
    */
   public void moveLastNodeBack()
      throws Exception
   {
      CMRBugEJBLocal bug = cmrBugHome.findByPrimaryKey("forth");

      CMRBugEJBLocal prev = bug.getPrevNode();
      CMRBugEJBLocal next = bug.getNextNode();
      CMRBugEJBLocal prevPrev = prev.getPrevNode();

      prevPrev.setNextNode(bug);
      bug.setPrevNode(prevPrev);
      bug.setNextNode(prev);
      prev.setPrevNode(bug);
      prev.setNextNode(next);
   }
View Full Code Here

    * @ejb.transaction type="RequiresNew"
    */
   public boolean lastHasNextNode()
      throws Exception
   {
      CMRBugEJBLocal bug = cmrBugHome.findByPrimaryKey("third");
      return bug.getNextNode() != null;
   }
View Full Code Here

      CMRBugManagerEJBHome home = (CMRBugManagerEJBHome)
         PortableRemoteObject.narrow(ref, CMRBugManagerEJBHome.class);

      getLog().debug("creating CMRBugManagerEJB");
      CMRBugManagerEJB cmrBugManager = home.create();
      getLog().debug("created CMRBugManagerEJB");

      SortedMap cmrBugs = new TreeMap();
      cmrBugs.put("1", "one");
      cmrBugs.put("1.1", "one.one");
      cmrBugs.put("1.2", "one.two");
      cmrBugs.put("1.3", "one.three");

      getLog().debug("creating " + cmrBugs.size() + " CMR bugs");
      cmrBugManager.createCMRBugs(cmrBugs);
      getLog().debug("created " + cmrBugs.size() + " CMR bugs");

      Iterator i = cmrBugs.entrySet().iterator();
      while(i.hasNext())
      {
         Map.Entry entry = (Map.Entry)i.next();

         String[] parentIdAndDescription =
            cmrBugManager.getParentFor((String)entry.getKey());
         if(!entry.getKey().equals("1"))
         {
            assertTrue("Child has not Parent! cmr post create updates NOT WRITTEN! " + entry.getKey(),
               parentIdAndDescription != null);
         } // end of if ()
View Full Code Here

    */
   public void testLoadFKState() throws Exception
   {
      Object ref = getInitialContext().lookup("CMRBugManager");
      CMRBugManagerEJBHome home = (CMRBugManagerEJBHome)PortableRemoteObject.narrow(ref, CMRBugManagerEJBHome.class);
      CMRBugManagerEJB manager = home.create();

      try
      {
         // create bugs
         manager.setupLoadFKState();

         // update
         manager.moveLastNodeBack();

         // check results
         assertTrue("The last element is the last in the chain.", !manager.lastHasNextNode());
      }
      finally
      {
         manager.tearDownLoadFKState();
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.cmp2.cmr.interfaces.CMRBugManagerEJB

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.