@Before public void setUp() throws Exception { testFileSystem = new TestFileSystem(); solverValidator = testFileSystem.getReference(SolverValidator.class); }
public void deleteFile(final Path path) { getFile(path).delete(); }
public TestFileSystem() throws Exception { tempFiles = new TempFiles(); setUp(); }
@Before public void setUp() throws Exception { testFileSystem = new TestFileSystem(); saver = new ProjectScreenModelSaver(pomService, kModuleService, importsService, repositoriesService, whiteListService, ioService, moduleService, repositoryResolver, commentedOptionFactory, pomModelCache); pathToPom = testFileSystem.createTempFile("testproject/pom.xml"); }
@After public void tearDown() throws Exception { testFileSystem.tearDown(); }
@Before public void setup() { testFileSystem = new TestFileSystem(); when( configuredRepositories.getRepositoryByRepositoryFileSystem( any( FileSystem.class ) ) ).thenReturn( repository ); inbox = new InboxEntrySecurity( mock( User.class ), mock( AuthorizationManager.class ), mock( OrganizationalUnitService.class ), mock( ProjectService.class ), configuredRepositories ); }
@Test public void whenProjectRenamed_ModuleUpdatedEventIsFired() throws Exception { final Path path = testFileSystem.createTempFile("testproject/pom.xml"); service.save(path, new POM("newName", "desctiption", "url", new GAV()), mock(Metadata.class), ""); verify(moduleUpdatedEvent).fire(any()); } }
@Test public void testFileRemoved() throws Exception { final Path tempFile = testFileSystem.createTempFile( "text.txt" ); testFileSystem.deleteFile( tempFile ); final InboxEntry entry = new InboxEntry( tempFile.toURI(), "note", "userFrom" ); assertEquals( repository, inbox.getInboxEntryRepository( entry ) ); }
@After public void tearDown() throws Exception { testFileSystem.tearDown(); }
@Before public void setUp() throws Exception { testFileSystem = new TestFileSystem(); saver = new PackageNameWhiteListSaver( ioService, metadataService, commentedOptionFactory ); }
@Test public void whenProjectSavedWithoutChanges_ModuleUpdatedEventNotFired() throws Exception { final Path path = testFileSystem.createTempFile("testproject/pom.xml"); POM originalPOM = new POM("mymodule", "desctiption", "url", new GAV()); service.save(path, originalPOM, mock(Metadata.class), ""); verify(ioService).startBatch(any(), any()); verify(ioService).write(pathArgumentCaptor.capture(), anyString(), anyMap()); verify(ioService).endBatch(); verify(moduleUpdatedEvent, never()).fire(any()); assertTrue(path.toURI().endsWith(pathArgumentCaptor.getValue().toString())); }
@Before public void setUp() throws Exception { testFileSystem = new TestFileSystem(); validator = testFileSystem.getReference(DefaultGenericKieValidator.class); }
@After public void tearDown() throws Exception { testFileSystem.tearDown(); }
@Before public void setUp() throws Exception { testFileSystem = new TestFileSystem(); doReturn(mock(Module.class)).when(moduleService).resolveModule(any()); service = new POMServiceImpl(ioService, mock(POMContentHandler.class), mock(M2RepoService.class), mock(MetadataService.class), moduleUpdatedEvent, moduleService, mock(CommentedOptionFactory.class), mock(PomEnhancer.class)) { int index = 0; @Override public POM load(Path pomPath) { return new POM("mymodule " + index++, "desctiption", "url", new GAV()); } }; }
@Test public void whenProjectSavedWithoutChanges_ModuleUpdatedEventNotFired() throws Exception { final Path path = testFileSystem.createTempFile("testproject/pom.xml"); POM originalPOM = new POM("mymodule", "desctiption", "url", new GAV()); service.save(path, originalPOM, mock(Metadata.class), ""); verify(ioService).startBatch(any(), any()); verify(ioService).write(pathArgumentCaptor.capture(), anyString(), anyMap()); verify(ioService).endBatch(); verify(moduleUpdatedEvent, never()).fire(any()); assertTrue(path.toURI().endsWith(pathArgumentCaptor.getValue().toString())); }
public TestFileSystem() throws Exception { tempFiles = new TempFiles(); setUp(); }
public void deleteFile(final Path path) { getFile(path).delete(); }
@Before public void setUp() throws Exception { disableGitDaemonAndSsh(); fileSystemTestingUtils.setup(); testFileSystem = new TestFileSystem(); validatorBuildService = testFileSystem.getReference(ValidatorBuildService.class); validator = new DefaultGenericKieValidator(validatorBuildService); }
@After public void tearDown() throws Exception { testFileSystem.tearDown(); }
@Before public void setUp() throws Exception { testFileSystem = new TestFileSystem(); doReturn(mock(Module.class)).when(moduleService).resolveModule(any()); service = new POMServiceImpl(ioService, mock(POMContentHandler.class), mock(M2RepoService.class), mock(MetadataService.class), moduleUpdatedEvent, moduleService, mock(CommentedOptionFactory.class), mock(PomEnhancer.class)) { int index = 0; @Override public POM load(Path pomPath) { return new POM("mymodule " + index++, "desctiption", "url", new GAV()); } }; }