void endBatch(final Collection<Path> paths) { if (paths.size() > 1) { ioService.endBatch(); } }
void endBatch(final Collection<Path> paths) { if (paths.size() > 1) { ioService.endBatch(); } }
protected void store(Path path, Object data) { try { ioService.startBatch(fileSystem); ioService.write(path, xs.toXML(data)); } finally { ioService.endBatch(); } } }
private void saveUserPreferences(final UserPreference preferences, final Path path) { try { ioServiceConfig.startBatch(path.getFileSystem()); ioServiceConfig.write(path, xs.toXML(preferences)); } catch (final Exception e) { throw new RuntimeException(e); } finally { ioServiceConfig.endBatch(); } }
private void saveUserPreferences(final UserPreference preferences, final Path path) { try { ioServiceConfig.startBatch(path.getFileSystem()); ioServiceConfig.write(path, xs.toXML(preferences)); } catch (final Exception e) { throw new RuntimeException(e); } finally { ioServiceConfig.endBatch(); } }
protected void writeFile(final IOService ioService, final Path path, final FileItem uploadedItem) throws IOException { try { ioService.startBatch(path.getFileSystem()); ioService.write(path, IOUtils.toByteArray(uploadedItem.getInputStream())); } finally { uploadedItem.getInputStream().close(); ioService.endBatch(); } }
protected void delete(org.uberfire.java.nio.file.Path path) { try { ioService.startBatch(path.getFileSystem()); ioService.deleteIfExists(path); } finally { ioService.endBatch(); } }
private void syncSocialUsers() { try { ioService.startBatch( userNamesPath.getFileSystem() ); List<String> users = createUserNamesFile(); usersNamesCache.addAll( users ); createSocialUserCache( users ); } finally { ioService.endBatch(); } }
protected void store(org.uberfire.java.nio.file.Path path, byte[] content) { try { ioService.startBatch(path.getFileSystem()); ioService.write(path, content); } finally { ioService.endBatch(); } }
private IOService mockIoService(final FileSystem fileSystem) { final IOService ioService = spy(fileSystemTestingUtils.getIoService()); doNothing().when(ioService).startBatch(any(FileSystem.class)); doNothing().when(ioService).endBatch(); doReturn(fileSystem).when(ioService).newFileSystem(any(URI.class), anyMap()); return ioService; } }
private IOService mockIoService(final FileSystem fileSystem) { final IOService ioService = spy(fileSystemTestingUtils.getIoService()); doNothing().when(ioService).startBatch(any(FileSystem.class)); doNothing().when(ioService).endBatch(); doReturn(fileSystem).when(ioService).newFileSystem(any(URI.class), anyMap()); return ioService; } }
private IOService mockIoService(final FileSystem fileSystem) { final IOService ioService = spy(fileSystemTestingUtils.getIoService()); doNothing().when(ioService).startBatch(any(FileSystem.class)); doNothing().when(ioService).endBatch(); doReturn(fileSystem).when(ioService).newFileSystem(any(URI.class), anyMap()); return ioService; } }
private IOService mockIoService(final FileSystem fileSystem) { final IOService ioService = spy(fileSystemTestingUtils.getIoService()); doNothing().when(ioService).startBatch(any(FileSystem.class)); doNothing().when(ioService).endBatch(); doReturn(fileSystem).when(ioService).newFileSystem(any(URI.class), anyMap()); return ioService; } }
private IOService mockIoService() { final IOService ioService = spy(fileSystemTestingUtils.getIoService()); doNothing().when(ioService).startBatch(any(FileSystem.class)); doNothing().when(ioService).endBatch(); doReturn(fileSystemTestingUtils.getFileSystem()).when(ioService).newFileSystem(any(URI.class), anyMap()); return ioService; } }
private IOService mockIoService() { final IOService ioService = spy(fileSystemTestingUtils.getIoService()); doNothing().when(ioService).startBatch(any(FileSystem.class)); doNothing().when(ioService).endBatch(); doReturn(fileSystemTestingUtils.getFileSystem()).when(ioService).newFileSystem(any(URI.class), anyMap()); return ioService; } }
@Test public void testCheckBatch() { inboxBackend = new InboxBackendImpl( ioService, systemFS, userServicesBackend, mailboxService, securitySpy ); inboxBackend.recordOpeningEvent( new ResourceOpenedEvent( resourcePath, sessionInfo ) ); verify( ioService, times( 1 ) ).startBatch( mockedFSId ); verify( ioService, times( 1 ) ).endBatch(); inboxBackend.recordUserEditEvent( new ResourceUpdatedEvent( resourcePath, "message", sessionInfo ) ); verify( ioService, times( 2 ) ).startBatch( mockedFSId ); verify( ioService, times( 2 ) ).endBatch(); }
@Override public void deleteMedia(final Media media) { final Path mediaPath = convert(media.getPath()); try { getIoService().startBatch(fileSystem); getIoService().delete(mediaPath); } finally { getIoService().endBatch(); } mediaDeletedEvent.fire(new MediaDeleted(mediaPath.getParent().getParent().getFileName().toString(), media)); }
@Test public void testFirstLoad() { storage.init(); verifyInit(); List<ExperimentalFeatureImpl> features = new ArrayList<>(storage.getFeatures()); verify(ioService).exists(any()); verify(ioService, never()).newInputStream(any()); verify(ioService).newOutputStream(any()); verify(ioService).startBatch(fileSystem); verify(ioService).endBatch(); verifyLoadedFeatures(features, new ExperimentalFeatureImpl(FEATURE_1, false), new ExperimentalFeatureImpl(FEATURE_2, false), new ExperimentalFeatureImpl(FEATURE_3, false)); }
@Test public void testFirstLoad() { storage.init(); verifyInit(); verify(ioService).exists(any()); verify(ioService).newOutputStream(any()); verify(ioService).startBatch(fileSystem); verify(ioService).endBatch(); verifyLoadedFeatures(new ArrayList<>(storage.getFeatures()), new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_2, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_3, false)); }
@Test public void testFirstLoad() { storage.init(); verifyInit(); verify(ioService).exists(any()); verify(ioService).newOutputStream(any()); verify(ioService).startBatch(fileSystem); verify(ioService).endBatch(); verifyLoadedFeatures(new ArrayList<>(storage.getFeatures()), new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_2, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_3, false)); }