Source:
public void testAddFromConfigurationWithRegenerateTrue() throws Exception { setUriInfo(setUpGetMatrixConstraintsExpectations(BackendHostResource.REGENERATE_CONSTRAINT, true, "true", setUpBasicUriExpectations(), false)); setUpGetPayloadExpectations(1, 3); setUpGetBallooningExpectations(1, 3); setUpGetCertuficateExpectations(1, 3); setUpGetConsoleExpectations(new int[] { 3 }); setUpGetVirtioScsiExpectations(new int[] { 3 }); VM model = createModel(null); org.ovirt.engine.core.common.businessentities.VM returnedVM = getEntity(2); model.setInitialization(new Initialization()); model.getInitialization().setConfiguration(new Configuration()); model.getInitialization().getConfiguration().setData("asdasdasd"); model.getInitialization().getConfiguration().setType("ovf"); setUpGetEntityExpectations(VdcQueryType.GetVmFromConfiguration, GetVmFromConfigurationQueryParameters.class, new String[] { "VmConfiguration", "ConfigurationType" }, new Object[] { model.getInitialization().getConfiguration().getData(), ConfigurationType.OVF }, returnedVM); Guid newId = GUIDS[3]; setUpCreationExpectations(VdcActionType.ImportVmFromConfiguration, ImportVmParameters.class, new String[] { "Vm", "VdsGroupId", "ImportAsNewEntity" }, new Object[] { returnedVM, Guid.createGuidFromString(model.getCluster().getId()), true}, true, true, newId, VdcQueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { newId }, getEntityWithProvidedId(2, newId)); Response response = collection.add(model); assertEquals(201, response.getStatus()); assertTrue(response.getEntity() instanceof VM); VM queriedVm = (VM) response.getEntity(); assertEquals(newId.toString(), queriedVm.getId()); queriedVm.setId(GUIDS[2].toString()); verifyModel((VM) response.getEntity(), 2); }

Target:
public void testAddFromConfigurationWithRegenerateTrue() throws Exception { setUriInfo(setUpBasicUriExpectations()); setUpGetPayloadExpectations(1, 3); setUpGetBallooningExpectations(1, 3); setUpGetCertuficateExpectations(1, 3); setUpGetConsoleExpectations(new int[] { 3 }); setUpGetVmOvfExpectations(new int[] { 3 }); setUpGetVirtioScsiExpectations(new int[] { 3 }); VM model = createModel(null); org.ovirt.engine.core.common.businessentities.VM returnedVM = getEntity(2); model.setInitialization(new Initialization()); model.getInitialization().setRegenerateIds(Boolean.TRUE); model.getInitialization().setConfiguration(new Configuration()); model.getInitialization().getConfiguration().setData("asdasdasd"); model.getInitialization().getConfiguration().setType("ovf"); setUpGetEntityExpectations(VdcQueryType.GetVmFromConfiguration, GetVmFromConfigurationQueryParameters.class, new String[] { "VmConfiguration", "ConfigurationType" }, new Object[] { model.getInitialization().getConfiguration().getData(), ConfigurationType.OVF }, returnedVM); Guid newId = GUIDS[3]; setUpCreationExpectations(VdcActionType.ImportVmFromConfiguration, ImportVmParameters.class, new String[] { "Vm", "VdsGroupId", "ImportAsNewEntity" }, new Object[] { returnedVM, Guid.createGuidFromString(model.getCluster().getId()), true}, true, true, newId, VdcQueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { newId }, getEntityWithProvidedId(2, newId)); Response response = collection.add(model); assertEquals(201, response.getStatus()); assertTrue(response.getEntity() instanceof VM); VM queriedVm = (VM) response.getEntity(); assertEquals(newId.toString(), queriedVm.getId()); queriedVm.setId(GUIDS[2].toString()); verifyModel((VM) response.getEntity(), 2); }