@Test @Ignore public void testValidateForUpdate_WhenDistributedApplianceExists_ExpectsCorrespondentDa() throws Exception { DistributedApplianceDto daDto = createDistributedApplianceDto(); daDto.setId(DA_ID_EXISTING_DA); DistributedAppliance da = this.validator.validateForUpdate(daDto); Assert.assertNotNull("The returned da should not be null.", da); Assert.assertEquals("The id of the returned da was different than expected.", this.da.getId(), da.getId()); }
@Override public DistributedAppliance validateForUpdate(DistributedApplianceDto dto) throws Exception { BaseDtoValidator.checkForNullId(dto); DistributedAppliance da = this.em.find(DistributedAppliance.class, dto.getId()); if (da == null) { throw new VmidcBrokerValidationException("Distributed Appliance entry with name: " + dto.getName() + ") is not found."); } ValidateUtil.checkMarkedForDeletion(da, da.getName()); if (!dto.getMcId().equals(da.getApplianceManagerConnector().getId())) { throw new VmidcBrokerValidationException("Appliance Manager Connector change is not allowed."); } validate(dto, false, da); return da; }
DistributedApplianceDtoValidator implements DtoValidator<DistributedApplianceDto, DistributedAppliance> { @Override public DistributedAppliance validateForUpdate(DistributedApplianceDto dto) throws Exception { BaseDtoValidator.checkForNullId(dto); DistributedAppliance da = this.em.find(DistributedAppliance.class, dto.getId()); if (da == null) { throw new VmidcBrokerValidationException("Distributed Appliance entry with name: " + dto.getName() + ") is not found."); } ValidateUtil.checkMarkedForDeletion(da, da.getName()); if (!dto.getMcId().equals(da.getApplianceManagerConnector().getId())) { throw new VmidcBrokerValidationException("Appliance Manager Connector change is not allowed."); } validate(dto, false, da); return da; } }
DistributedApplianceDtoValidator implements DtoValidator<DistributedApplianceDto, DistributedAppliance> { @Override public DistributedAppliance validateForUpdate(DistributedApplianceDto dto) throws Exception { BaseDtoValidator.checkForNullId(dto); DistributedAppliance da = this.em.find(DistributedAppliance.class, dto.getId()); if (da == null) { throw new VmidcBrokerValidationException("Distributed Appliance entry with name: " + dto.getName() + ") is not found."); } ValidateUtil.checkMarkedForDeletion(da, da.getName()); if (!dto.getMcId().equals(da.getApplianceManagerConnector().getId())) { throw new VmidcBrokerValidationException("Appliance Manager Connector change is not allowed."); } validate(dto, false, da); return da; }  }
DistributedApplianceDtoValidator implements DtoValidator<DistributedApplianceDto, DistributedAppliance> { @Override public DistributedAppliance validateForUpdate(DistributedApplianceDto dto) throws Exception { BaseDtoValidator.checkForNullId(dto); DistributedAppliance da = this.em.find(DistributedAppliance.class, dto.getId()); if (da == null) { throw new VmidcBrokerValidationException("Distributed Appliance entry with name: " + dto.getName() + ") is not found."); } ValidateUtil.checkMarkedForDeletion(da, da.getName()); if (!dto.getMcId().equals(da.getApplianceManagerConnector().getId())) { throw new VmidcBrokerValidationException("Appliance Manager Connector change is not allowed."); } validate(dto, false, da); return da; }  DistributedApplianceDtoValidator create(EntityManager em); @Override void validateForCreate(DistributedApplianceDto dto); @Override DistributedAppliance validateForUpdate(DistributedApplianceDto dto); static void checkForNullFields(DistributedApplianceDto dto); static void checkFieldLength(DistributedApplianceDto dto); }
DistributedApplianceDtoValidator implements DtoValidator<DistributedApplianceDto, DistributedAppliance> { @Override public DistributedAppliance validateForUpdate(DistributedApplianceDto dto) throws Exception { BaseDtoValidator.checkForNullId(dto); DistributedAppliance da = this.em.find(DistributedAppliance.class, dto.getId()); if (da == null) { throw new VmidcBrokerValidationException("Distributed Appliance entry with name: " + dto.getName() + ") is not found."); } ValidateUtil.checkMarkedForDeletion(da, da.getName()); if (!dto.getMcId().equals(da.getApplianceManagerConnector().getId())) { throw new VmidcBrokerValidationException("Appliance Manager Connector change is not allowed."); } validate(dto, false, da); return da; }  DistributedApplianceDtoValidator create(EntityManager em); @Override void validateForCreate(DistributedApplianceDto dto); @Override DistributedAppliance validateForUpdate(DistributedApplianceDto dto); static void checkForNullFields(DistributedApplianceDto dto); static void checkFieldLength(DistributedApplianceDto dto);  }