@Test public void testParseVersionOrReturnEmptyStringUbuntu1004() { assertEquals(parseVersionOrReturnEmptyString(OsFamily.UBUNTU, "Ubuntu 10.04", map), "10.04"); }
public static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in, Map<OsFamily, Map<String, String>> osVersionMap) { if (osVersionMap.containsKey(family)) { if (osVersionMap.get(family).containsKey(in)) return osVersionMap.get(family).get(in); if (osVersionMap.get(family).containsValue(in)) return in; ContainsSubstring contains = new ContainsSubstring(in.replace('-', '.')); try { String key = Iterables.find(osVersionMap.get(family).keySet(), contains); return osVersionMap.get(family).get(key); } catch (NoSuchElementException e) { try { return Iterables.find(osVersionMap.get(family).values(), contains); } catch (NoSuchElementException e1) { } } } return ""; }
ComputeServiceUtils { public static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in, Map<OsFamily, Map<String, String>> osVersionMap) { if (osVersionMap.containsKey(family)) { if (osVersionMap.get(family).containsKey(in)) return osVersionMap.get(family).get(in); if (osVersionMap.get(family).containsValue(in)) return in; ContainsSubstring contains = new ContainsSubstring(in.replace('-', '.')); try { String key = Iterables.find(osVersionMap.get(family).keySet(), contains); return osVersionMap.get(family).get(key); } catch (NoSuchElementException e) { try { return Iterables.find(osVersionMap.get(family).values(), contains); } catch (NoSuchElementException e1) { } } } return ""; } }
ComputeServiceUtils { public static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in, Map<OsFamily, Map<String, String>> osVersionMap) { if (osVersionMap.containsKey(family)) { if (osVersionMap.get(family).containsKey(in)) return osVersionMap.get(family).get(in); if (osVersionMap.get(family).containsValue(in)) return in; ContainsSubstring contains = new ContainsSubstring(in.replace('-', '.')); try { String key = Iterables.find(osVersionMap.get(family).keySet(), contains); return osVersionMap.get(family).get(key); } catch (NoSuchElementException e) { try { return Iterables.find(osVersionMap.get(family).values(), contains); } catch (NoSuchElementException e1) { } } } return ""; }  }
ComputeServiceUtils { public static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in, Map<OsFamily, Map<String, String>> osVersionMap) { if (osVersionMap.containsKey(family)) { if (osVersionMap.get(family).containsKey(in)) return osVersionMap.get(family).get(in); if (osVersionMap.get(family).containsValue(in)) return in; ContainsSubstring contains = new ContainsSubstring(in.replace('-', '.')); try { String key = Iterables.find(osVersionMap.get(family).keySet(), contains); return osVersionMap.get(family).get(key); } catch (NoSuchElementException e) { try { return Iterables.find(osVersionMap.get(family).values(), contains); } catch (NoSuchElementException e1) { } } } return ""; }  static String formatStatus(ComputeMetadataIncludingStatus<?> resource); static Statement execHttpResponse(HttpRequest request); static Statement execHttpResponse(URI location); static Statement extractTargzIntoDirectory(HttpRequest targz, String directory); static Statement extractTargzIntoDirectory(URI targz, String directory); static Statement extractZipIntoDirectory(HttpRequest zip, String directory); static Statement extractZipIntoDirectory(URI zip, String directory); static double getCores(Hardware input); static double getCoresAndSpeed(Hardware input); static double getSpace(Hardware input); static org.jclouds.compute.domain.OsFamily parseOsFamilyOrUnrecognized(String in); static String createExecutionErrorMessage(Map<?, Exception> executionExceptions); static String createNodeErrorMessage(Map<? extends NodeMetadata, ? extends Throwable> failedNodes); static Iterable<? extends ComputeMetadata> filterByName(Iterable<? extends ComputeMetadata> nodes,
            final String name); static Map<String, String> metadataAndTagsAsValuesOfEmptyString(TemplateOptions options); static NodeMetadataBuilder addMetadataAndParseTagsFromValuesOfEmptyString(NodeMetadataBuilder builder,
            Map<String, String> map); static Map<String, String> metadataAndTagsAsCommaDelimitedValue(TemplateOptions options); static NodeMetadataBuilder addMetadataAndParseTagsFromCommaDelimitedValue(NodeMetadataBuilder builder,
            Map<String, String> map); static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in,
            Map<OsFamily, Map<String, String>> osVersionMap); static Map<Integer, Integer> getPortRangesFromList(int... ports); static String groupFromMapOrName(Map<String, String> metadataMap, String nodeName, GroupNamingConvention namingConvention); }
ComputeServiceUtils { public static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in, Map<OsFamily, Map<String, String>> osVersionMap) { if (osVersionMap.containsKey(family)) { if (osVersionMap.get(family).containsKey(in)) return osVersionMap.get(family).get(in); if (osVersionMap.get(family).containsValue(in)) return in; ContainsSubstring contains = new ContainsSubstring(in.replace('-', '.')); try { String key = Iterables.find(osVersionMap.get(family).keySet(), contains); return osVersionMap.get(family).get(key); } catch (NoSuchElementException e) { try { return Iterables.find(osVersionMap.get(family).values(), contains); } catch (NoSuchElementException e1) { } } } return ""; }  static String formatStatus(ComputeMetadataIncludingStatus<?> resource); static Statement execHttpResponse(HttpRequest request); static Statement execHttpResponse(URI location); static Statement extractTargzIntoDirectory(HttpRequest targz, String directory); static Statement extractTargzIntoDirectory(URI targz, String directory); static Statement extractZipIntoDirectory(HttpRequest zip, String directory); static Statement extractZipIntoDirectory(URI zip, String directory); static double getCores(Hardware input); static double getCoresAndSpeed(Hardware input); static double getSpace(Hardware input); static org.jclouds.compute.domain.OsFamily parseOsFamilyOrUnrecognized(String in); static String createExecutionErrorMessage(Map<?, Exception> executionExceptions); static String createNodeErrorMessage(Map<? extends NodeMetadata, ? extends Throwable> failedNodes); static Iterable<? extends ComputeMetadata> filterByName(Iterable<? extends ComputeMetadata> nodes,
            final String name); static Map<String, String> metadataAndTagsAsValuesOfEmptyString(TemplateOptions options); static NodeMetadataBuilder addMetadataAndParseTagsFromValuesOfEmptyString(NodeMetadataBuilder builder,
            Map<String, String> map); static Map<String, String> metadataAndTagsAsCommaDelimitedValue(TemplateOptions options); static NodeMetadataBuilder addMetadataAndParseTagsFromCommaDelimitedValue(NodeMetadataBuilder builder,
            Map<String, String> map); static String parseVersionOrReturnEmptyString(org.jclouds.compute.domain.OsFamily family, String in,
            Map<OsFamily, Map<String, String>> osVersionMap); static Map<Integer, Integer> getPortRangesFromList(int... ports); static String groupFromMapOrName(Map<String, String> metadataMap, String nodeName, GroupNamingConvention namingConvention); static final Pattern DELIMITED_BY_HYPHEN_ENDING_IN_HYPHEN_HEX; }