@Test public void testValidateForCreate_WhenDistributedApplianceIsValid_ValidationSucceeds() throws Exception { DistributedApplianceDto newDaDto= createDistributedApplianceDto(); newDaDto.setName(DA_NAME_NEW_DA); newDaDto.setApplianceId(this.app.getId()); newDaDto.setMcId(this.amc.getId()); for (VirtualSystemDto vsDto : newDaDto.getVirtualizationSystems()) { vsDto.setVcId(this.vc.getId()); vsDto.setDomainId(this.domain.getId()); } this.validator.validateForCreate(newDaDto); }
@Override public void validateForCreate(DistributedApplianceDto dto) throws Exception { validate(dto); OSCEntityManager<DistributedAppliance> emgr = new OSCEntityManager<DistributedAppliance>(DistributedAppliance.class, this.em, this.txBroadcastUtil); if (emgr.isExisting("name", dto.getName())) { throw new VmidcBrokerValidationException("Distributed Appliance Name: " + dto.getName() + " already exists."); } }
DistributedApplianceDtoValidator implements DtoValidator<DistributedApplianceDto, DistributedAppliance> { @Override public void validateForCreate(DistributedApplianceDto dto) throws Exception { validate(dto); OSCEntityManager<DistributedAppliance> emgr = new OSCEntityManager<DistributedAppliance>(DistributedAppliance.class, this.em, this.txBroadcastUtil); if (emgr.isExisting("name", dto.getName())) { throw new VmidcBrokerValidationException("Distributed Appliance Name: " + dto.getName() + " already exists."); } } }
DistributedApplianceDtoValidator implements DtoValidator<DistributedApplianceDto, DistributedAppliance> { @Override public void validateForCreate(DistributedApplianceDto dto) throws Exception { validate(dto); OSCEntityManager<DistributedAppliance> emgr = new OSCEntityManager<DistributedAppliance>(DistributedAppliance.class, this.em, this.txBroadcastUtil); if (emgr.isExisting("name", dto.getName())) { throw new VmidcBrokerValidationException("Distributed Appliance Name: " + dto.getName() + " already exists."); } }  }
DistributedApplianceDtoValidator implements DtoValidator<DistributedApplianceDto, DistributedAppliance> { @Override public void validateForCreate(DistributedApplianceDto dto) throws Exception { validate(dto); OSCEntityManager<DistributedAppliance> emgr = new OSCEntityManager<DistributedAppliance>(DistributedAppliance.class, this.em, this.txBroadcastUtil); if (emgr.isExisting("name", dto.getName())) { throw new VmidcBrokerValidationException("Distributed Appliance Name: " + dto.getName() + " already exists."); } }  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 void validateForCreate(DistributedApplianceDto dto) throws Exception { validate(dto); OSCEntityManager<DistributedAppliance> emgr = new OSCEntityManager<DistributedAppliance>(DistributedAppliance.class, this.em, this.txBroadcastUtil); if (emgr.isExisting("name", dto.getName())) { throw new VmidcBrokerValidationException("Distributed Appliance Name: " + dto.getName() + " already exists."); } }  DistributedApplianceDtoValidator create(EntityManager em); @Override void validateForCreate(DistributedApplianceDto dto); @Override DistributedAppliance validateForUpdate(DistributedApplianceDto dto); static void checkForNullFields(DistributedApplianceDto dto); static void checkFieldLength(DistributedApplianceDto dto);  }