Package org.apache.jdo.tck.pc.building

Examples of org.apache.jdo.tck.pc.building.Oven


    public void testPersistBase() {
      Object id = null;
      try {
          getPM().currentTransaction().begin();
          Kitchen kitchen1 = new Kitchen(1);
          Oven oven = new Oven("Westinghouse", "Economy");
          kitchen1.setOven(oven);
          getPM().makePersistent(kitchen1);
          getPM().currentTransaction().commit();
          id = getPM().getObjectId(kitchen1);
      }
        catch (Exception e) {
            fail("Exception on persist : " + e.getMessage());
        }
      finally {
            if (getPM().currentTransaction().isActive()) {
                getPM().currentTransaction().rollback();
            }
        }

        getPM().currentTransaction().begin();
        Kitchen kitchen = (Kitchen)getPM().getObjectById(id);
        assertEquals("Id of object is incorrect", 1, kitchen.getId());
        Oven oven = kitchen.getOven();
        assertNotNull("Oven of Kitchen is null!", oven);
        assertEquals("Oven is of incorrect type", Oven.class.getName(), oven.getClass().getName());
        assertEquals("Oven make is incorrect", "Westinghouse", oven.getMake());
        assertEquals("Oven model is incorrect", "Economy", oven.getModel());
        getPM().currentTransaction().commit();
    }
View Full Code Here


        }

        getPM().currentTransaction().begin();
        Kitchen kitchen = (Kitchen)getPM().getObjectById(id);
        assertEquals("Id of object is incorrect", 1, kitchen.getId());
        Oven oven = kitchen.getOven();
        assertNotNull("Oven of Kitchen is null!", oven);
        assertEquals("Oven is of incorrect type", MultifunctionOven.class.getName(),
                oven.getClass().getName());
        MultifunctionOven multioven = (MultifunctionOven)oven;
        assertEquals("Oven make is incorrect", "Westinghouse", multioven.getMake());
        assertEquals("Oven model is incorrect", "Economy", multioven.getModel());
        assertEquals("Oven microwave setting is incorrect", true, multioven.getMicrowave());
        assertEquals("Oven capabilities is incorrect", "TIMER,CLOCK", multioven.getCapabilities());
View Full Code Here

TOP

Related Classes of org.apache.jdo.tck.pc.building.Oven

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.