@Test
 public void shouldNotCreatePackageRepositoryIfTheSpecifiedPluginTypeIsInvalid() throws Exception {
   when(packageRepositoryService.validatePluginId(packageRepository)).thenReturn(false);
   when(packageRepositoryService.validateRepositoryConfiguration(packageRepository))
       .thenReturn(true);
   CreatePackageRepositoryCommand command =
       new CreatePackageRepositoryCommand(
           goConfigService, packageRepositoryService, packageRepository, currentUser, result);
   assertFalse(command.isValid(cruiseConfig));
 }
Ejemplo n.º 2
0
 @Override
 public boolean isValid(CruiseConfig preprocessedConfig) {
   PackageRepositories repositories = preprocessedConfig.getPackageRepositories();
   this.preprocessedRepository = repositories.find(this.repository.getRepoId());
   preprocessedRepository.validate(null);
   repositories.validate(null);
   boolean isValidConfiguration =
       packageRepositoryService.validatePluginId(preprocessedRepository)
           && packageRepositoryService.validateRepositoryConfiguration(preprocessedRepository);
   BasicCruiseConfig.copyErrors(preprocessedRepository, this.repository);
   return getAllErrors(this.repository).isEmpty() && isValidConfiguration && result.isSuccessful();
 }
 @Test
 public void shouldNotUpdatePackageRepositoryIfTheSpecifiedPluginTypeIsInvalid() throws Exception {
   when(packageRepositoryService.validatePluginId(newPackageRepo)).thenReturn(false);
   when(packageRepositoryService.validateRepositoryConfiguration(newPackageRepo)).thenReturn(true);
   UpdatePackageRepositoryCommand command =
       new UpdatePackageRepositoryCommand(
           goConfigService,
           packageRepositoryService,
           newPackageRepo,
           currentUser,
           "md5",
           entityHashingService,
           result,
           repoId);
   command.update(cruiseConfig);
   assertFalse(command.isValid(cruiseConfig));
 }