Tabnine Logo
OSCategoryIn
Code IndexAdd Tabnine to your IDE (free)

How to use
OSCategoryIn
in
org.jclouds.cloudstack.predicates

Best Java code snippets using org.jclouds.cloudstack.predicates.OSCategoryIn (Showing top 6 results out of 315)

origin: jclouds/legacy-jclouds

  @Test
  public void testTemplateNotInAcceptableCategory() {
   assertFalse(new OSCategoryIn(client).apply(acceptableCategories).apply(
     Template.builder().id("2").OSTypeId("30").build()
   ));
   verify(client, guestOSClient);
  }
}
origin: jclouds/legacy-jclouds

@Test
public void testTemplateInAcceptableCategory() {
 assertTrue(new OSCategoryIn(client).apply(acceptableCategories).apply(
   Template.builder().id("1").OSTypeId("10").build()
 ));
 verify(client, guestOSClient);
}
origin: apache/jclouds

@Test
public void testTemplateInAcceptableCategory() {
 assertTrue(new OSCategoryIn(client).apply(acceptableCategories).apply(
   Template.builder().id("1").OSTypeId("10").build()
 ));
 verify(client, guestOSClient);
}
origin: apache/jclouds

  @Test
  public void testTemplateNotInAcceptableCategory() {
   assertFalse(new OSCategoryIn(client).apply(acceptableCategories).apply(
     Template.builder().id("2").OSTypeId("30").build()
   ));
   verify(client, guestOSClient);
  }
}
origin: jclouds/legacy-jclouds

public static String getTemplateForZone(CloudStackClient client, String zoneId) {
 // TODO enum, as this is way too easy to mess up.
 Set<String> acceptableCategories = ImmutableSet.of("Ubuntu", "CentOS");
 final Predicate<Template> hypervisorPredicate = new CorrectHypervisorForZone(client).apply(zoneId);
 final Predicate<Template> osTypePredicate = new OSCategoryIn(client).apply(acceptableCategories);
 @SuppressWarnings("unchecked")
 Predicate<Template> templatePredicate = Predicates.<Template> and(TemplatePredicates.isReady(),
    hypervisorPredicate, osTypePredicate);
 Iterable<Template> templates = filter(
    client.getTemplateClient().listTemplates(ListTemplatesOptions.Builder.zoneId(zoneId)), templatePredicate);
 if (Iterables.any(templates, TemplatePredicates.isPasswordEnabled())) {
   templates = filter(templates, TemplatePredicates.isPasswordEnabled());
 }
 if (Iterables.size(templates) == 0) {
   throw new NoSuchElementException(templatePredicate.toString());
 }
 String templateId = get(templates, 0).getId();
 return templateId;
}
origin: apache/jclouds

public static String getTemplateForZone(CloudStackApi client, String zoneId) {
 // TODO enum, as this is way too easy to mess up.
 Set<String> acceptableCategories = ImmutableSet.of("Ubuntu", "CentOS");
 final Predicate<Template> hypervisorPredicate = new CorrectHypervisorForZone(client).apply(zoneId);
 final Predicate<Template> osTypePredicate = new OSCategoryIn(client).apply(acceptableCategories);
 @SuppressWarnings("unchecked")
 Predicate<Template> templatePredicate = Predicates.<Template> and(TemplatePredicates.isReady(),
    hypervisorPredicate, osTypePredicate);
 Iterable<Template> templates = filter(
    client.getTemplateApi().listTemplates(ListTemplatesOptions.Builder.zoneId(zoneId)), templatePredicate);
 if (Iterables.any(templates, TemplatePredicates.isPasswordEnabled())) {
   templates = filter(templates, TemplatePredicates.isPasswordEnabled());
 }
 if (Iterables.size(templates) == 0) {
   throw new NoSuchElementException(templatePredicate.toString());
 }
 String templateId = get(templates, 0).getId();
 return templateId;
}
org.jclouds.cloudstack.predicatesOSCategoryIn

Most used methods

  • <init>
  • apply

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now