@Test public void dockerOnceRetention1() throws Descriptor.FormException { final DockerSlaveTemplate template = new DockerSlaveTemplate("id"); template.setRetentionStrategy(new DockerOnceRetentionStrategy(3)); assertThat(notAllowedStrategy(template), is(false)); }
@VisibleForTesting protected static boolean notAllowedStrategy(DockerSlaveTemplate template) { if (isNull(template)) { LOG.debug("Skipping DockerProvisioningStrategy because: template is null"); return true; } final RetentionStrategy retentionStrategy = template.getRetentionStrategy(); if (isNull(retentionStrategy)) { LOG.debug("Skipping DockerProvisioningStrategy because: strategy is null for {}", template); } if (retentionStrategy instanceof DockerOnceRetentionStrategy) { if (template.getNumExecutors() == 1) { LOG.debug("Applying faster provisioning for single executor template {}", template); return false; } else { LOG.debug("Skipping DockerProvisioningStrategy because: numExecutors is {} for {}", template.getNumExecutors(), template); return true; } } if (retentionStrategy instanceof RetentionStrategy.Demand) { LOG.debug("Applying faster provisioning for Demand strategy for template {}", template); return false; } LOG.trace("Skipping YAD provisioning for unknown mix of configuration for {}", template); return true; }
DockerProvisioningStrategy extends NodeProvisioner.Strategy { @VisibleForTesting protected static boolean notAllowedStrategy(DockerSlaveTemplate template) { if (isNull(template)) { LOG.debug("Skipping DockerProvisioningStrategy because: template is null"); return true; } final RetentionStrategy retentionStrategy = template.getRetentionStrategy(); if (isNull(retentionStrategy)) { LOG.debug("Skipping DockerProvisioningStrategy because: strategy is null for {}", template); } if (retentionStrategy instanceof DockerOnceRetentionStrategy) { if (template.getNumExecutors() == 1) { LOG.debug("Applying faster provisioning for single executor template {}", template); return false; } else { LOG.debug("Skipping DockerProvisioningStrategy because: numExecutors is {} for {}", template.getNumExecutors(), template); return true; } } if (retentionStrategy instanceof RetentionStrategy.Demand) { LOG.debug("Applying faster provisioning for Demand strategy for template {}", template); return false; } LOG.trace("Skipping YAD provisioning for unknown mix of configuration for {}", template); return true; } }
DockerProvisioningStrategy extends NodeProvisioner.Strategy { @VisibleForTesting protected static boolean notAllowedStrategy(DockerSlaveTemplate template) { if (isNull(template)) { LOG.debug("Skipping DockerProvisioningStrategy because: template is null"); return true; } final RetentionStrategy retentionStrategy = template.getRetentionStrategy(); if (isNull(retentionStrategy)) { LOG.debug("Skipping DockerProvisioningStrategy because: strategy is null for {}", template); } if (retentionStrategy instanceof DockerOnceRetentionStrategy) { if (template.getNumExecutors() == 1) { LOG.debug("Applying faster provisioning for single executor template {}", template); return false; } else { LOG.debug("Skipping DockerProvisioningStrategy because: numExecutors is {} for {}", template.getNumExecutors(), template); return true; } } if (retentionStrategy instanceof RetentionStrategy.Demand) { LOG.debug("Applying faster provisioning for Demand strategy for template {}", template); return false; } LOG.trace("Skipping YAD provisioning for unknown mix of configuration for {}", template); return true; }  }
DockerProvisioningStrategy extends NodeProvisioner.Strategy { @VisibleForTesting protected static boolean notAllowedStrategy(DockerSlaveTemplate template) { if (isNull(template)) { LOG.debug("Skipping DockerProvisioningStrategy because: template is null"); return true; } final RetentionStrategy retentionStrategy = template.getRetentionStrategy(); if (isNull(retentionStrategy)) { LOG.debug("Skipping DockerProvisioningStrategy because: strategy is null for {}", template); } if (retentionStrategy instanceof DockerOnceRetentionStrategy) { if (template.getNumExecutors() == 1) { LOG.debug("Applying faster provisioning for single executor template {}", template); return false; } else { LOG.debug("Skipping DockerProvisioningStrategy because: numExecutors is {} for {}", template.getNumExecutors(), template); return true; } } if (retentionStrategy instanceof RetentionStrategy.Demand) { LOG.debug("Applying faster provisioning for Demand strategy for template {}", template); return false; } LOG.trace("Skipping YAD provisioning for unknown mix of configuration for {}", template); return true; }  void setEnabled(boolean enabled); @Nonnull @Override NodeProvisioner.StrategyDecision apply(@Nonnull NodeProvisioner.StrategyState strategyState); }
DockerProvisioningStrategy extends NodeProvisioner.Strategy { @VisibleForTesting protected static boolean notAllowedStrategy(DockerSlaveTemplate template) { if (isNull(template)) { LOG.debug("Skipping DockerProvisioningStrategy because: template is null"); return true; } final RetentionStrategy retentionStrategy = template.getRetentionStrategy(); if (isNull(retentionStrategy)) { LOG.debug("Skipping DockerProvisioningStrategy because: strategy is null for {}", template); } if (retentionStrategy instanceof DockerOnceRetentionStrategy) { if (template.getNumExecutors() == 1) { LOG.debug("Applying faster provisioning for single executor template {}", template); return false; } else { LOG.debug("Skipping DockerProvisioningStrategy because: numExecutors is {} for {}", template.getNumExecutors(), template); return true; } } if (retentionStrategy instanceof RetentionStrategy.Demand) { LOG.debug("Applying faster provisioning for Demand strategy for template {}", template); return false; } LOG.trace("Skipping YAD provisioning for unknown mix of configuration for {}", template); return true; }  void setEnabled(boolean enabled); @Nonnull @Override NodeProvisioner.StrategyDecision apply(@Nonnull NodeProvisioner.StrategyState strategyState); static final DockerCloudOrder DEFAULT; }