private DatacenterHB createDataCenter() throws PersistenceException { factorytest = HibernateDAOFactory.instance(); DataCenterDAO daoDC = factorytest.getDataCenterDAO(); factorytest.beginConnection(); DatacenterHB data = new DatacenterHB(); data.setName(DATACENTER_TEST); // XXX data.setSituation("test"); // XXX data.setRacks(racks); daoDC.makePersistent(data); factorytest.endConnection(); return data; }
/** * VirtualDataCenter Factory construction * * @throws PersistenceException */ private VirtualDataCenterHB createVirtualDataCenter( DatacenterHB dc, EnterpriseHB enterprise, HypervisorType htype) throws PersistenceException { factorytest = HibernateDAOFactory.instance(); VirtualDataCenterDAO daoVdc = factorytest.getVirtualDataCenterDAO(); factorytest.beginConnection(); VirtualDataCenterHB vdc = new VirtualDataCenterHB(); vdc.setEnterpriseHB(enterprise); vdc.setIdDataCenter(dc.getIdDataCenter()); vdc.setName("test"); vdc.setHypervisorType(htype); vdc.setNetwork(createNetwork()); daoVdc.makePersistent(vdc); factorytest.endConnection(); return vdc; }