Package org.jboss.test.cmp2.keygen.ejb

Examples of org.jboss.test.cmp2.keygen.ejb.UnknownPKLocal


   }

   // 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


   }

   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 void testUUIDKeyGenerator() throws Exception
   {
      UnknownPKLocalHome home = getUnknownPKHome("local/TestUUIDKeyGenEJB");
      UnknownPKLocal ejb1 = home.create("testUUIDKeyGenerator");
      UnknownPKLocal ejb2 = home.create("testUUIDKeyGenerator");
      try
      {
         UnknownPKLocal ejb1a = home.findByPrimaryKey(ejb1.getPrimaryKey());
         assertTrue(ejb1.isIdentical(ejb1a));
         assertTrue(ejb1.isIdentical(ejb2) == false);
         assertTrue(ejb1.getPrimaryKey().equals(ejb2.getPrimaryKey()) == false);
      }
      finally
View Full Code Here

   }

   public void testPkSQLKeyGenerator() throws Exception
   {
      UnknownPKLocalHome home = getUnknownPKHome("local/TestPkSqlEJB");
      UnknownPKLocal ejb1 = home.create("testPkSQLKeyGenerator");
      Thread.sleep(50);
      UnknownPKLocal ejb2 = home.create("testPkSQLKeyGenerator");
      try
      {
         UnknownPKLocal ejb1a = home.findByPrimaryKey(ejb1.getPrimaryKey());
         assertTrue(ejb1.isIdentical(ejb1a));
         assertTrue(ejb1.isIdentical(ejb2) == false);
         assertTrue(ejb1.getPrimaryKey().equals(ejb2.getPrimaryKey()) == false);
      }
      finally
View Full Code Here

   }

   public void testHsqldbKeyGenerator() throws Exception
   {
      UnknownPKLocalHome home = getUnknownPKHome("local/TestHsqldbEJB");
      UnknownPKLocal ejb1 = home.create("testHsqldbKeyGenerator");
      UnknownPKLocal ejb2 = home.create("testHsqldbKeyGenerator");
      try
      {
         UnknownPKLocal ejb1a = home.findByPrimaryKey(ejb1.getPrimaryKey());
         assertTrue(ejb1.isIdentical(ejb1a));
         assertTrue(ejb1.isIdentical(ejb2) == false);
         assertTrue(ejb1.getPrimaryKey().equals(ejb2.getPrimaryKey()) == false);
      }
      finally
View Full Code Here

   public void testHsqldbIntegerKeyGenerator() throws Exception
   {
      Context ctx = new InitialContext();
      IntegerPKLocalHome home = (IntegerPKLocalHome) ctx.lookup("java:comp/env/local/TestHsqldbIntegerEJB");
      UnknownPKLocal ejb1 = home.create("testHsqldbIntegerKeyGenerator");
      UnknownPKLocal ejb2 = home.create("testHsqldbIntegerKeyGenerator");
      try
      {
         Integer key = (Integer) ejb1.getPrimaryKey();
         UnknownPKLocal ejb1a = home.findByPrimaryKey(key);
         assertTrue(ejb1.isIdentical(ejb1a));
         assertTrue(ejb1.isIdentical(ejb2) == false);
         assertTrue(ejb1.getPrimaryKey().equals(ejb2.getPrimaryKey()) == false);
      }
      finally
View Full Code Here

   {
      Context ctx = new InitialContext();
      IntegerPKLocalHome home = (IntegerPKLocalHome) ctx.lookup("java:comp/env/local/InvalidHsqldbIntegerEJB");
      try
      {
         UnknownPKLocal ejb1 = home.create("testInvalidHsqldbIntegerKeyGenerator");
         Object key = ejb1.getPrimaryKey();
         assertTrue("InvalidHsqldbIntegerEJB key != null", key != null);
      }
      catch(Exception e)
      {
         log.debug("create failed as expected", e);
         // Remove the bean that was inserted into the table
         Collection beans = home.findAll();
         UnknownPKLocal ejb1 = (UnknownPKLocal) beans.iterator().next();
         ejb1.remove();
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.cmp2.keygen.ejb.UnknownPKLocal

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.