Package org.jboss.test.cmp2.optimisticlock.bug1006723.testsession

Examples of org.jboss.test.cmp2.optimisticlock.bug1006723.testsession.TestSessionRemote


   }

   public void testFKToCMPMapping()
         throws Exception
   {
      GroupLocal kv61Group = null;
      GroupLocal kv62Group = null;
      ExamenationLocal exam = null;
      try {
         kv62Group = getGroupHome().create("KV", 62, "KV-62");
         exam = getExamHome().create("kv61-1", "Math", "KV", 62);
         assertTrue("kv62Group.isIdentical(exam.getGroup())", kv62Group.isIdentical(exam.getGroup()));
         assertTrue("kv62Group.getExamenations().contains(exam)", kv62Group.getExamenations().contains(exam));

         kv61Group = getGroupHome().create("KV", 61, "KV-61");
         exam.setGroup(kv61Group);
         assertTrue("expected: exam.getGroupNumber() == 61;"
                    + " got: exam.getGroupNumber() == " + exam.getGroupNumber(),
                    exam.getGroupNumber() == 61);

         exam.setGroupNumber(62);
         assertTrue("kv62Group.isIdentical(exam.getGroup())", kv62Group.isIdentical(exam.getGroup()));
         assertTrue("kv62Group.getExamenations().contains(exam);", kv62Group.getExamenations().contains(exam));
         assertTrue("kv61Group.getExamenations().isEmpty();", kv61Group.getExamenations().isEmpty());

         exam.setDepartmentCode("KM");
         exam.setDepartmentCode2("XKM");
         assertTrue("exam.getGroup() == null", exam.getGroup() == null);
         assertTrue("kv62Group.getExamenations().isEmpty();", kv62Group.getExamenations().isEmpty());

         exam.setDepartmentCode("KV");
         exam.setDepartmentCode2("XKV");
         assertTrue("kv62Group.isIdentical(exam.getGroup())", kv62Group.isIdentical(exam.getGroup()));
         assertTrue("kv62Group.getExamenations().contains(exam);", kv62Group.getExamenations().contains(exam));
      } finally {
         removeEntity(exam);
         removeEntity(kv61Group);
         removeEntity(kv62Group);
      }
View Full Code Here


   }

   // Tests ---------------------------------------------------
   public void testStandaloneFKMapping() throws Exception
   {
      InstituteLocal institute = null;
      DepartmentLocal department = null;
      try {
         institute = getInstituteHome().create("NTUUKPI", "Natinal Technical University Of The Ukraine KPI");
         department = getDepartmentHome().create("KV", "Specialized Computer Systems");
         institute.getDepartments().add(department);
         assertTrue("department.getInstitute().isIdentical(institute)", department.getInstitute().isIdentical(institute));
         department.setInstitute(null);
         assertTrue("institute.getDepartments().isEmpty()", institute.getDepartments().isEmpty());
      } finally {
         removeEntity(institute);
         removeEntity(department);
      }
   }
View Full Code Here

      throws Exception
   {
      Long long1 = new Long(1);
      String avoka = "Avoka";
      String irene = "Irene";
      Manager manager = ManagerUtil.getHome().create();
      manager.createParent(long1, irene);

      try
      {
         manager.createChild(long1, avoka);
         fail("Should have filed as the foreign key field can't be null.");
      }
      catch(Exception expected){}

      manager.createChild(long1, avoka, long1, irene);
      manager.createChild(new Long(2), "Ataka", long1, irene);

      manager.assertChildHasMother(long1, long1, irene);
      manager.assertChildHasMother(new Long(2), long1, irene);
   }
View Full Code Here

   }

   public void testPartialFKToPKMapping()
         throws Exception
   {
      StudentLocal petrovStudent = null;
      StudentLocal sidorovStudent = null;
      GroupLocal group = null;
      try {
         petrovStudent = getStudentHome().create("KV", "Petrov", "Petrov works on KV department.");
         group = getGroupHome().create("KV", 62, "KV-62");
         assertTrue("petrovStudent.getGroup() == null", petrovStudent.getGroup() == null);

         petrovStudent.setGroup(group);
         assertTrue("group.isIdentical(petrovStudent.getGroup())", group.isIdentical(petrovStudent.getGroup()));
         assertTrue("group.getStudents().contains(petrovStudent)", group.getStudents().contains(petrovStudent));

         sidorovStudent = getStudentHome().create("KV", "Sidorov", "Sidorov works on KV department.");
         group.getStudents().add(sidorovStudent);
         assertTrue("sidorovStudent.getGroup().isIdentical(group)", sidorovStudent.getGroup().isIdentical(group));
         assertTrue("group.getStudents().contains(petrovStudent)", group.getStudents().contains(petrovStudent));
         assertTrue("group.getStudents().contains(sidorovStudent)", group.getStudents().contains(sidorovStudent));

         group.remove();
         group = null;
         assertTrue("petrovStudent.getGroup() == null", petrovStudent.getGroup() == null);
         assertTrue("sidorovStudent.getGroup() == null", sidorovStudent.getGroup() == null);

         /*
         group = getGroupHome().create("KV", 62, "KV-62");
         assertTrue("group.getStudents().contains(petrovStudent)", group.getStudents().contains(petrovStudent));
         assertTrue("group.isIdentical(petrovStudent.getGroup())", group.isIdentical(petrovStudent.getGroup()));
View Full Code Here

   // Tests

   public void testMain() throws Throwable
   {
      ALocal a = getALocalHome().findByPrimaryKey(new Long(1));
      int storeCount = a.getStoreCount().intValue();
      a.setIntField(new Integer(a.getIntField().intValue() + 1));
      assertEquals(storeCount + 1, a.getStoreCount().intValue());     
   }
View Full Code Here

   }

   public void testCorrectView() throws Throwable
   {
      BLocal b = getBLocalHome().create(new Long(11), "test");
      ALocal a = getALocalHome().findByPrimaryKey(new Long(1));
   }
View Full Code Here

      assertEquals(storeCount + 1, a.getStoreCount().intValue());     
   }

   public void testCorrectView() throws Throwable
   {
      BLocal b = getBLocalHome().create(new Long(11), "test");
      ALocal a = getALocalHome().findByPrimaryKey(new Long(1));
   }
View Full Code Here

public class TestSessionBean implements SessionBean{

  public Long setup() throws Exception{
    try{   
      /* Add an entity A and then add some entity Bs to it. */
      EntityALocal entityA = getEntityALocalHome().create(new Long(1));
      entityA.addEntityB(getEntityBLocalHome().create(new Long(2)));
      return entityA.getOID();
    }
    catch (Exception e){
      sessionContext.setRollbackOnly();
      throw e;
    }
View Full Code Here

    }
  }

  public void test(Long entityAOID) throws Exception{
    try{
      EntityALocal entityA = getEntityALocalHome().findByPrimaryKey
        (entityAOID);
      Iterator entityBs = entityA.listEntityBs().iterator();
      while (entityBs.hasNext()){
        ((EntityBLocal)entityBs.next()).setLastModified(new Date());
      }
    }
    catch (Exception e){
View Full Code Here

   public void testBug1006723() throws Exception
   {
      InitialContext ctx = new InitialContext();
      TestSessionRemoteHome testSessionRemoteHome = (TestSessionRemoteHome)
         PortableRemoteObject.narrow(ctx.lookup("ejb/TestSession"), TestSessionRemoteHome.class);
      TestSessionRemote testSessionRemote = testSessionRemoteHome.create();
      Long oID = testSessionRemote.setup();
      testSessionRemote.test(oID);
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.cmp2.optimisticlock.bug1006723.testsession.TestSessionRemote

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.