private void checkRepositories(final POM pom) { // Check is the POM's GAV resolves to any pre-existing artifacts. We don't need to filter // resolved Repositories by those enabled for the Project since this is a new Project. final Set<MavenRepositoryMetadata> repositories = repositoryResolver.getRepositoriesResolvingArtifact(pom.getGav()); if (repositories.size() > 0) { throw new GAVAlreadyExistsException(pom.getGav(), repositories); } }
private void checkRepositories(final POM pom) { // Check is the POM's GAV resolves to any pre-existing artifacts. We don't need to filter // resolved Repositories by those enabled for the Module since this is a new Module. final Set<MavenRepositoryMetadata> repositories = repositoryResolver.getRepositoriesResolvingArtifact(pom.getGav()); if (repositories.size() > 0) { throw new GAVAlreadyExistsException(pom.getGav(), repositories); } }
private void checkRepositories(final POM pom) { final Set<MavenRepositoryMetadata> repositories = repositoryResolver.getRepositoriesResolvingArtifact(pom.getGav()); if (repositories.size() > 0) { throw new GAVAlreadyExistsException(pom.getGav(), repositories); } } }
private void checkRepositories(final POM pom) { // Check is the POM's GAV resolves to any pre-existing artifacts. We don't need to filter // resolved Repositories by those enabled for the Project since this is a new Project. final Set<MavenRepositoryMetadata> repositories = repositoryResolver.getRepositoriesResolvingArtifact(pom.getGav()); if (repositories.size() > 0) { throw new GAVAlreadyExistsException(pom.getGav(), repositories); } }
private void checkRepositories(final POM pom) { final Set<MavenRepositoryMetadata> repositories = repositoryResolver.getRepositoriesResolvingArtifact(pom.getGav()); if (repositories.size() > 0) { throw new GAVAlreadyExistsException(pom.getGav(), repositories); } } }
@Test public void testHandlePomConcurrentUpdate() { presenter.model = mock(ProjectScreenModel.class); doReturn(mock(POM.class)).when(presenter.model).getPOM(); presenter.handlePomConcurrentUpdate("Test comment", null, new GAVAlreadyExistsException()).then(i -> { fail("Promise should've not been resolved!"); return promises.resolve(); }); verify(view).hideBusyIndicator(); verify(conflictingRepositoriesPopup).setContent(any(), any(), any()); verify(conflictingRepositoriesPopup).show(); }
@Test @SuppressWarnings("unchecked") public void testSaveClashingGAV() { final GAVAlreadyExistsException gae = new GAVAlreadyExistsException(gav, Collections.<MavenRepositoryMetadata>emptySet()); doThrow(gae).when(service).save(any(ObservablePath.class),
/** * Verifies if a given module can be deployed in current server for the given deployment mode. * An example of when a module can't be deployed is when the deployment mode is DeploymentMode.VALIDATED and the * module was already deployed. This case will raise a GAVAlreadyExistsException. * @param module the module to verify. * @param deploymentMode the deployment mode for doing the verification. */ public void verifyWithException(final Module module, DeploymentMode deploymentMode) { if (DeploymentMode.VALIDATED.equals(deploymentMode)) { // Check is the POM's GAV resolves to any pre-existing artifacts. final GAV gav = module.getPom().getGav(); if (gav.isSnapshot()) { return; } final ModuleRepositories projectRepositories = moduleRepositoriesService.load(((KieModule) module).getRepositoriesPath()); final Set<MavenRepositoryMetadata> repositories = repositoryResolver.getRepositoriesResolvingArtifact(gav, module, projectRepositories.filterByIncluded()); if (repositories.size() > 0) { throw new GAVAlreadyExistsException(gav, repositories); } } } }
final GAVAlreadyExistsException gae = new GAVAlreadyExistsException(pom.getGav(), new HashSet<MavenRepositoryMetadata>() {{ add(new MavenRepositoryMetadata("local-id",
final GAVAlreadyExistsException gae = new GAVAlreadyExistsException(pom.getGav(), new HashSet<MavenRepositoryMetadata>() {{ add(new MavenRepositoryMetadata("local-id",
@Test public void testNewProjectWhenGAVAlreadyExists() throws Exception { final HashSet<MavenRepositoryMetadata> repositories = new HashSet<>(); repositories.add(new MavenRepositoryMetadata("id", "url", MavenRepositorySource.LOCAL)); doThrow(new GAVAlreadyExistsException(new GAV("projectGroupId:projectName:projectVersion"), repositories)) .when(projectService).newProject(any(org.uberfire.backend.vfs.Path.class), any(POM.class), eq(JobRequestHelper.GUVNOR_BASE_URL)); final JobResult jobResult = jobRequestHelper.createProject("jobId", "myRepository", "projectName", "projectGroupId", "projectVersion", "projectDescription"); assertEquals("jobId", jobResult.getJobId()); assertEquals(JobStatus.DUPLICATE_RESOURCE, jobResult.getStatus()); assertEquals("Project's GAV [projectGroupId:projectName:projectVersion] already exists at [id : url : LOCAL ]", jobResult.getResult()); }
@Test public void testNewProjectWhenGAVAlreadyExists() throws Exception { final HashSet<MavenRepositoryMetadata> repositories = new HashSet<>(); repositories.add(new MavenRepositoryMetadata("id", "url", MavenRepositorySource.LOCAL)); doThrow(new GAVAlreadyExistsException(new GAV("projectGroupId:projectName:projectVersion"), repositories)) .when(workspaceProjectService).newProject(any(OrganizationalUnit.class), any(POM.class)); final JobResult jobResult = jobRequestHelper.createProject("jobId", "myRepository", "projectName", "projectGroupId", "projectVersion", "projectDescription"); assertEquals("jobId", jobResult.getJobId()); assertEquals(JobStatus.DUPLICATE_RESOURCE, jobResult.getStatus()); assertEquals("Project's GAV [projectGroupId:projectName:projectVersion] already exists at [id : url : LOCAL ]", jobResult.getResult()); }
final GAVAlreadyExistsException gae = new GAVAlreadyExistsException(pom.getGav(), new HashSet<MavenRepositoryMetadata>() {{ add(new MavenRepositoryMetadata("local-id",
@Test public void testNewProjectWhenGAVAlreadyExists() throws Exception { final HashSet<MavenRepositoryMetadata> repositories = new HashSet<>(); repositories.add(new MavenRepositoryMetadata("id", "url", MavenRepositorySource.LOCAL)); doThrow(new GAVAlreadyExistsException(new GAV("projectGroupId:projectName:projectVersion"), repositories)) .when(workspaceProjectService).newProject(any(OrganizationalUnit.class), any(POM.class)); final JobResult jobResult = jobRequestHelper.createProject("jobId", "myRepository", "projectName", "projectGroupId", "projectVersion", "projectDescription"); assertEquals("jobId", jobResult.getJobId()); assertEquals(JobStatus.DUPLICATE_RESOURCE, jobResult.getStatus()); assertEquals("Project's GAV [projectGroupId:projectName:projectVersion] already exists at [id : url : LOCAL ]", jobResult.getResult()); }
final GAVAlreadyExistsException gae = new GAVAlreadyExistsException(pom.getGav(), new HashSet<MavenRepositoryMetadata>() {{ add(new MavenRepositoryMetadata("local-id",