JCloudsSlaveTemplate implements Describable<JCloudsSlaveTemplate>, SlaveOptions.Holder { @VisibleForTesting static @Nonnull List<String> parseSecurityGroups(@Nonnull String securityGroups) { if (securityGroups == null || securityGroups.isEmpty()) throw new IllegalArgumentException(); List<String> from = TokenGroup.from(securityGroups, ','); if (from.isEmpty() || from.contains("")) { throw new IllegalArgumentException("Security group declaration contains blank '" + securityGroups + "'"); } return from; } @DataBoundConstructor  JCloudsSlaveTemplate(final @Nonnull String name, final @Nonnull String labels, final @CheckForNull SlaveOptions slaveOptions); @Nonnull SlaveOptions getEffectiveSlaveOptions(); @Nonnull SlaveOptions getRawSlaveOptions(); Set<LabelAtom> getLabelSet(); @Nonnull String getName(); @Restricted(NoExternalUse.class) // Jelly + tests @Nonnull String getLabels(); boolean canProvision(final Label label); @Nonnull JCloudsSlave provisionSlave(
            @Nonnull JCloudsCloud cloud, @Nonnull ProvisioningActivity.Id id
    ); @Restricted(NoExternalUse.class) @Nonnull Server provisionServer(@CheckForNull ServerScope scope, @CheckForNull ProvisioningActivity.Id id); @Override @SuppressWarnings("unchecked") Descriptor<JCloudsSlaveTemplate> getDescriptor(); static final String OPENSTACK_CLOUD_NAME_KEY; static final String OPENSTACK_TEMPLATE_NAME_KEY; }
@Test public void securityGroups() { assertEquals(singletonList("foo"), parseSecurityGroups("foo")); assertEquals(Arrays.asList("foo", "bar"), parseSecurityGroups("foo,bar")); try { parseSecurityGroups("foo,,bar"); fail(); } catch (IllegalArgumentException expected) {} try { parseSecurityGroups(","); fail(); } catch (IllegalArgumentException expected) {} try { parseSecurityGroups(""); fail(); } catch (IllegalArgumentException expected) {} try { parseSecurityGroups(null); fail(); } catch (IllegalArgumentException expected) {} }