use of org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData in project ovirt-engine by oVirt.
the class OvfManagerTest method testVmOvfImportWithoutDbGeneration.
@Test
public void testVmOvfImportWithoutDbGeneration() throws Exception {
VM vm = createVM();
String xml = manager.exportVm(vm, new FullEntityOvfData(vm), Version.v3_6);
assertNotNull(xml);
final VM newVm = new VM();
assertTrue(xml.contains("Generation"));
String replacedXml = xml.replaceAll("Generation", "test_replaced");
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(newVm);
manager.importVm(replacedXml, newVm, fullEntityOvfData);
assertVm(vm, newVm, 1);
}
use of org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData in project ovirt-engine by oVirt.
the class OvfManagerTest method serializeAndDeserialize.
private VM serializeAndDeserialize(VM inputVm) throws OvfReaderException {
String xml = manager.exportVm(inputVm, new FullEntityOvfData(inputVm), Version.v3_6);
assertNotNull(xml);
final VM resultVm = new VM();
assertTrue(xml.contains("Generation"));
String replacedXml = xml.replaceAll("Generation", "test_replaced");
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(resultVm);
manager.importVm(replacedXml, resultVm, fullEntityOvfData);
return resultVm;
}
use of org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData in project ovirt-engine by oVirt.
the class OvfManagerTest method testTemplateOvfCreation.
@Test
public void testTemplateOvfCreation() throws Exception {
VmTemplate template = createVmTemplate();
String xml = manager.exportTemplate(new FullEntityOvfData(template), Version.v3_6);
assertNotNull(xml);
final VmTemplate newtemplate = new VmTemplate();
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(newtemplate);
manager.importTemplate(xml, fullEntityOvfData);
assertEquals("imported template is different than expected", newtemplate, template);
assertEquals("imported db generation is different than expected", template.getDbGeneration(), newtemplate.getDbGeneration());
}
use of org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData in project ovirt-engine by oVirt.
the class OvfManagerTest method testVmExportAndImportIdentical.
@Test
public void testVmExportAndImportIdentical() throws Exception {
VM vm = createVM();
ArrayList<DiskImage> disks = createDisksAndDiskVmElements(vm);
FullEntityOvfData fullEntityOvfDataForExport = new FullEntityOvfData(vm);
fullEntityOvfDataForExport.setDiskImages(disks);
String xml = manager.exportVm(vm, fullEntityOvfDataForExport, Version.v4_0);
assertNotNull(xml);
VM newVm = new VM();
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(newVm);
manager.importVm(xml, newVm, fullEntityOvfData);
assertVm(vm, newVm, vm.getDbGeneration());
assertCollection(vm.getInterfaces(), fullEntityOvfData.getInterfaces());
assertCollection(disks, fullEntityOvfData.getDiskImages(), diskPair -> diskPair.getFirst().getDiskVmElementForVm(vm.getId()).equals(diskPair.getSecond().getDiskVmElementForVm(vm.getId())));
}
use of org.ovirt.engine.core.common.businessentities.storage.FullEntityOvfData in project ovirt-engine by oVirt.
the class OvfManagerTest method testVmExportAndImportAndExportAgainSymmetrical.
@Test
public void testVmExportAndImportAndExportAgainSymmetrical() throws Exception {
VM vm = createVM();
ArrayList<DiskImage> disks = createDisksAndDiskVmElements(vm);
FullEntityOvfData fullEntityOvfDataForExport = new FullEntityOvfData(vm);
fullEntityOvfDataForExport.setDiskImages(disks);
String xml = manager.exportVm(vm, fullEntityOvfDataForExport, Version.v4_0);
assertNotNull(xml);
VM newVm = new VM();
FullEntityOvfData fullEntityOvfData = new FullEntityOvfData(newVm);
manager.importVm(xml, newVm, fullEntityOvfData);
FullEntityOvfData fullEntityOvfDataForExportResult = new FullEntityOvfData(vm);
fullEntityOvfDataForExportResult.setDiskImages(disks);
String newXml = manager.exportVm(vm, fullEntityOvfDataForExportResult, Version.v4_0);
assertEquals(deleteExportDateValueFromXml(xml), deleteExportDateValueFromXml(newXml));
}
Aggregations