GuvnorM2Repository { public boolean containsArtifact(final GAV gav) { return containsArtifact(gav, (repo) -> true); } GuvnorM2Repository(); @Inject  GuvnorM2Repository(ArtifactRepositoryService factory); @PostConstruct void init(); String getM2RepositoryDir(String repositoryName); String getM2RepositoryRootDir(String repositoryName); String getRepositoryURL(String repositoryName); void deployArtifact(final InputStream jarStream,
                               final GAV gav,
                               final boolean includeAdditionalRepositories); void deployArtifact(final InputStream jarStream,
                               final GAV gav,
                               final boolean includeAdditionalRepositories,
                               final Predicate<ArtifactRepository> filter); void deployPom(final InputStream pomStream,
                          final GAV gav); void deployParentPom(final GAV gav); Collection<File> listFiles(); List<File> listFiles(final String filters); List<File> listFiles(final String filters,
                                List<String> fileFormats); List<Artifact> listArtifacts(final String filters,
                                        List<String> fileFormats); String getPomText(final String path); String getKModuleText(final String path); String getKieDeploymentDescriptorText(final String path); GAV loadGAVFromJar(final String jarPath); static String loadPomFromJar(final InputStream jarInputStream); static String loadPomPropertiesFromJar(final InputStream jarInputStream); String generatePOM(final GAV gav); static String generatePomProperties(final GAV gav); String getPomXmlPath(final GAV gav); String getPomPropertiesPath(final GAV gav); String generateParentPOM(final GAV gav); boolean containsArtifact(final GAV gav); boolean containsArtifact(final GAV gav,
                                    final Predicate<ArtifactRepository> filter); File getArtifactFileFromRepository(final GAV gav);  }
@Test public void testContainArtifact() throws Exception { final GAV gav = new GAV("org.kie.guvnor", "guvnor-m2repo-editor-backend", "0.0.1-SNAPSHOT"); repo.containsArtifact(gav); verify(repositorySystem, times(1)).resolveArtifact(any(), any()); }
@Test public void testContainArtifactFilteredOutAllRepositories() throws Exception { final GAV gav = new GAV("org.kie.guvnor", "guvnor-m2repo-editor-backend", "0.0.1-SNAPSHOT"); repo.containsArtifact(gav, (repo) -> false); verify(repositorySystem, never()).resolveArtifact(any(), any()); }