@Test public void testMe() { new ResteasyJackson2Provider(); final DockerArtifactRegistryImpl dockerArtifactRegistry = new DockerArtifactRegistryImpl(new TestResolver(), "https: final Collection<String> mysql = dockerArtifactRegistry.listVersions("mysql"); mysql.forEach(System.out::println); Assert.assertTrue(mysql.contains("latest")); }
@Override public Collection<String> listVersions(String artifactId) { try { if (!artifactId.contains("/")) { artifactId = "library/" + artifactId; } final String registryUrl = this.url + "/v2/repositories/" + artifactId + "/tags/"; log.info("fetching tags from {}", registryUrl); final Map res = webAPIResolver .getWebTarget(registryUrl) .request(MediaType.APPLICATION_JSON_TYPE) .buildGet() .invoke(Map.class); return ((List<Map>) res.get("results")) .stream() .map(o -> (String) o.get("name")) .collect(Collectors.toList()); } catch (Exception ex) { log.warn("oh well.. couldn't fetch from registry" + ex.getMessage(), ex); return Collections.singleton("latest"); } }
DockerArtifactRegistryImpl implements ArtifactRegistryApi { @Override public Collection<String> listVersions(String artifactId) { try { if (!artifactId.contains("/")) { artifactId = "library/" + artifactId; } final String registryUrl = this.url + "/v2/repositories/" + artifactId + "/tags/"; log.info("fetching tags from {}", registryUrl); final Map res = webAPIResolver .getWebTarget(registryUrl) .request(MediaType.APPLICATION_JSON_TYPE) .buildGet() .invoke(Map.class); return ((List<Map>) res.get("results")) .stream() .map(o -> (String) o.get("name")) .collect(Collectors.toList()); } catch (Exception ex) { log.warn("oh well.. couldn't fetch from registry" + ex.getMessage(), ex); return Collections.singleton("latest"); } } }
DockerArtifactRegistryImpl implements ArtifactRegistryApi { @Override public Collection<String> listVersions(String artifactId) { try { if (!artifactId.contains("/")) { artifactId = "library/" + artifactId; } final String registryUrl = this.url + "/v2/repositories/" + artifactId + "/tags/"; log.info("fetching tags from {}", registryUrl); final Map res = webAPIResolver .getWebTarget(registryUrl) .request(MediaType.APPLICATION_JSON_TYPE) .buildGet() .invoke(Map.class); return ((List<Map>) res.get("results")) .stream() .map(o -> (String) o.get("name")) .collect(Collectors.toList()); } catch (Exception ex) { log.warn("oh well.. couldn't fetch from registry" + ex.getMessage(), ex); return Collections.singleton("latest"); } } DockerArtifactRegistryImpl(WebAPIResolver webAPIResolver, String url, String username, String password); }
DockerArtifactRegistryImpl implements ArtifactRegistryApi { @Override public Collection<String> listVersions(String artifactId) { try { if (!artifactId.contains("/")) { artifactId = "library/" + artifactId; } final String registryUrl = this.url + "/v2/repositories/" + artifactId + "/tags/"; log.info("fetching tags from {}", registryUrl); final Map res = webAPIResolver .getWebTarget(registryUrl) .request(MediaType.APPLICATION_JSON_TYPE) .buildGet() .invoke(Map.class); return ((List<Map>) res.get("results")) .stream() .map(o -> (String) o.get("name")) .collect(Collectors.toList()); } catch (Exception ex) { log.warn("oh well.. couldn't fetch from registry" + ex.getMessage(), ex); return Collections.singleton("latest"); } } DockerArtifactRegistryImpl(WebAPIResolver webAPIResolver, String url, String username, String password); @Override Collection<String> listVersions(String artifactId); }
DockerArtifactRegistryImpl implements ArtifactRegistryApi { @Override public Collection<String> listVersions(String artifactId) { try { if (!artifactId.contains("/")) { artifactId = "library/" + artifactId; } final String registryUrl = this.url + "/v2/repositories/" + artifactId + "/tags/"; log.info("fetching tags from {}", registryUrl); final Map res = webAPIResolver .getWebTarget(registryUrl) .request(MediaType.APPLICATION_JSON_TYPE) .buildGet() .invoke(Map.class); return ((List<Map>) res.get("results")) .stream() .map(o -> (String) o.get("name")) .collect(Collectors.toList()); } catch (Exception ex) { log.warn("oh well.. couldn't fetch from registry" + ex.getMessage(), ex); return Collections.singleton("latest"); } } DockerArtifactRegistryImpl(WebAPIResolver webAPIResolver, String url, String username, String password); @Override Collection<String> listVersions(String artifactId);  }