@Test public void testReImport() throws Exception { when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://project1/pom.xml"); when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module); abstractProjectService.reImport(path); verify(invalidateDMOCache).fire(any(InvalidateDMOModuleCacheEvent.class)); }
@Test public void testUseRepoServiceToDeleteRootModule() { when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file:///space/project1/pom.xml"); when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module); when(pomService.load(any())).thenReturn(mock(POM.class)); Repository repo = mock(Repository.class); when(repoService.getRepository(eq(org.uberfire.backend.server.util.Paths.convert(Paths.get("file:///space/project1"))))).thenReturn(repo); String alias = "repo-alias"; when(repo.getAlias()).thenReturn(alias); Space space = new Space("space"); when(repo.getSpace()).thenReturn(space); abstractProjectService.delete(path, ""); verify(repoService).removeRepository(eq(space), eq(alias)); verify(ioService, times(0)).delete(any(), any()); }
times(0)).newModule(any(Path.class), any(POM.class)); verify(moduleFactory,
@Test public void testUseRepoServiceToDeleteRootModule() { when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file:///space/project1/pom.xml"); when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module); when(pomService.load(any())).thenReturn(mock(POM.class)); Repository repo = mock(Repository.class); when(repoService.getRepository(eq(org.uberfire.backend.server.util.Paths.convert(Paths.get("file:///space/project1"))))).thenReturn(repo); String alias = "repo-alias"; when(repo.getAlias()).thenReturn(alias); Space space = new Space("space"); when(repo.getSpace()).thenReturn(space); abstractProjectService.delete(path, ""); verify(repoService).removeRepository(eq(space), eq(alias)); verify(ioService, times(0)).delete(any(), any()); }
@Test public void testUseIOServiceToDeleteSubModule() { when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://space/project1/subproject/pom.xml"); when(ioService.exists(any())).thenReturn(true); when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module); when(pomService.load(any())).thenReturn(mock(POM.class)); Repository repo = mock(Repository.class); when(repoService.getRepository(path)).thenReturn(repo); String alias = "repo-alias"; when(repo.getAlias()).thenReturn(alias); Space space = new Space("space"); when(repo.getSpace()).thenReturn(space); abstractProjectService.delete(path, ""); verify(repoService, times(0)).removeRepository(any(), any()); verify(ioService).delete(eq(Paths.get("file://space/project1/subproject")), anyVararg()); } }
@Test public void testReImport() throws Exception { when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://project1/pom.xml"); when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module); abstractProjectService.reImport(path); verify(invalidateDMOCache).fire(any(InvalidateDMOModuleCacheEvent.class)); }
@Test public void testUseIOServiceToDeleteSubModule() { when(path.getFileName()).thenReturn("pom.xml"); when(path.toURI()).thenReturn("file://space/project1/subproject/pom.xml"); when(ioService.exists(any())).thenReturn(true); when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module); when(pomService.load(any())).thenReturn(mock(POM.class)); Repository repo = mock(Repository.class); when(repoService.getRepository(path)).thenReturn(repo); String alias = "repo-alias"; when(repo.getAlias()).thenReturn(alias); Space space = new Space("space"); when(repo.getSpace()).thenReturn(space); abstractProjectService.delete(path, ""); verify(repoService, times(0)).removeRepository(any(), any()); verify(ioService).delete(eq(Paths.get("file://space/project1/subproject")), anyVararg()); } }