本文整理汇总了Java中org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent类的典型用法代码示例。如果您正苦于以下问题:Java IFileUpdateEvent类的具体用法?Java IFileUpdateEvent怎么用?Java IFileUpdateEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFileUpdateEvent类属于org.hive2hive.core.events.framework.interfaces.file包,在下文中一共展示了IFileUpdateEvent类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFileUpdateEvent
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Test
public void testFileUpdateEvent() throws NoPeerConnectionException, IOException, NoSessionException {
// upload a file from machine A
File file = createAndAddFile(rootA, clientA);
// clear past events of upload
waitForNumberOfEvents(1);
listener.getEvents().clear();
// update the file
FileUtils.write(file, randomString());
UseCaseTestUtil.uploadNewVersion(clientA, file);
// wait for event
waitForNumberOfEvents(1);
// check event type
List<IFileEvent> events = listener.getEvents();
assertEventType(events, IFileUpdateEvent.class);
// check paths
assertTrue(events.size() == 1);
IFileEvent ev = events.get(0);
assertTrue(ev.isFile());
assertFalse(ev.isFolder());
assertEqualsRelativePaths(file, ev.getFile());
}
示例2: onFileUpdate
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
/**
* This handler is for remote update events and is called by the network when
* a file has been changed remotely. This method only forwards the event to the core.
*/
@Override
@Handler
public void onFileUpdate(final IFileUpdateEvent fileEvent) {
if(cleanupRunning){
pendingEvents.add(fileEvent.getFile().toPath());
return;
}
final Path path = fileEvent.getFile().toPath();
logger.debug("onFileUpdate: {}", path);
final FileComponent file = fileTree.getOrCreateFileComponent(path, this);
file.getAction().handleRemoteUpdateEvent();
}
示例3: downloadFile
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Test
public void downloadFile() throws Exception {
localDatabase.put(filePath, file1);
remote.put(filePath, file1);
listSync.sync(local, localDatabase, remote, remoteDatabase);
Mockito.verify(fileEventManager).onFileUpdate(Matchers.any(IFileUpdateEvent.class));
Mockito.verifyNoMoreInteractions(fileEventManager);
}
示例4: onlyMissingLocallyInBoth
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Test
public void onlyMissingLocallyInBoth() throws Exception {
remote.put(filePath, file1);
remoteDatabase.put(filePath, file1);
listSync.sync(local, localDatabase, remote, remoteDatabase);
Mockito.verify(fileEventManager).onFileUpdate(Matchers.any(IFileUpdateEvent.class));
Mockito.verifyNoMoreInteractions(fileEventManager);
}
示例5: testRemoteAdd
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Test
public void testRemoteAdd() throws Exception {
remote.put(filePath, file1);
listSync.sync(local, localDatabase, remote, remoteDatabase);
Mockito.verify(fileEventManager).onFileUpdate(Matchers.any(IFileUpdateEvent.class));
Mockito.verifyNoMoreInteractions(fileEventManager);
}
示例6: remoteFilesDifferentTest
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Test
public void remoteFilesDifferentTest() throws Exception {
local.put(filePath, file1);
localDatabase.put(filePath, file1);
remote.put(filePath, file2);
remoteDatabase.put(filePath, file1);
listSync.sync(local, localDatabase, remote, remoteDatabase);
Mockito.verify(fileEventManager).onFileUpdate(Matchers.any(IFileUpdateEvent.class));
Mockito.verifyNoMoreInteractions(fileEventManager);
}
示例7: onFileUpdate
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Override
@Handler
public void onFileUpdate(IFileUpdateEvent fileEvent) {
System.out.println("File was updated: " + fileEvent.getFile().getName());
try {
// download the newest version
fileManager.createDownloadProcess(fileEvent.getFile()).execute();
} catch (Exception e) {
e.printStackTrace();
}
}
示例8: onFileUpdate
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Override
@Handler
public void onFileUpdate(IFileUpdateEvent fileEvent) {
try {
IProcessComponent<Void> downloadProcess = fileManager.createDownloadProcess(fileEvent.getFile());
downloadProcess.execute();
} catch (InvalidProcessStateException | ProcessExecutionException | NoSessionException | NoPeerConnectionException e) {
System.err.println("Cannot download the updated file " + fileEvent.getFile());
}
}
示例9: onFileUpdate
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Override
@Handler
public void onFileUpdate(IFileUpdateEvent fileEvent) {
update.add(fileEvent);
if (networkManager != null) {
try {
UseCaseTestUtil.downloadFile(networkManager, fileEvent.getFile());
} catch (NoSessionException | GetFailedException | NoPeerConnectionException e) {
Assert.fail("Cannot download the updated file. Reason: " + e.getMessage());
}
}
}
示例10: downloadFile
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
private void downloadFile(Path file, boolean isFile) {
// file update event will trigger download
IFileUpdateEvent updateEvent = new FileUpdateEvent(file.toFile(), isFile);
logger.trace("OPERATION: Download of file {}", file);
fileEventManager.onFileUpdate(updateEvent);
}
示例11: onFileUpdate
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Handler
void onFileUpdate(IFileUpdateEvent fileEvent);
示例12: getUpdated
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
public IFileUpdateEvent getUpdated(File file) {
return getByFile(update, file);
}
示例13: onFileUpdate
import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Override
@Handler
public void onFileUpdate(IFileUpdateEvent fileEvent) {
events.add(fileEvent);
}