当前位置: 首页>>代码示例>>Java>>正文


Java IFileUpdateEvent类代码示例

本文整理汇总了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());
}
 
开发者ID:Hive2Hive,项目名称:Hive2Hive,代码行数:27,代码来源:FileUpdateEventsTest.java

示例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();
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:18,代码来源:FileEventManager.java

示例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);
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:11,代码来源:RemoteAddLocalDelete.java

示例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);
	
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:12,代码来源:RemoteExistsLocalUnknown.java

示例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);
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:10,代码来源:RemoteAddLocalUnknown.java

示例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);
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:13,代码来源:RemoteExistsLocalExists.java

示例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();
	}
}
 
开发者ID:Hive2Hive,项目名称:Hive2Hive,代码行数:12,代码来源:EventsExample.java

示例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());
	}
}
 
开发者ID:Hive2Hive,项目名称:Hive2Hive,代码行数:11,代码来源:FileEventListener.java

示例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());
		}
	}
}
 
开发者ID:Hive2Hive,项目名称:Hive2Hive,代码行数:14,代码来源:TestFileEventListener.java

示例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);
}
 
开发者ID:PeerWasp,项目名称:PeerWasp,代码行数:7,代码来源:ListSync.java

示例11: onFileUpdate

import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Handler
void onFileUpdate(IFileUpdateEvent fileEvent);
 
开发者ID:Hive2Hive,项目名称:Hive2Hive,代码行数:3,代码来源:IFileEventListener.java

示例12: getUpdated

import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
public IFileUpdateEvent getUpdated(File file) {
	return getByFile(update, file);
}
 
开发者ID:Hive2Hive,项目名称:Hive2Hive,代码行数:4,代码来源:TestFileEventListener.java

示例13: onFileUpdate

import org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent; //导入依赖的package包/类
@Override
@Handler
public void onFileUpdate(IFileUpdateEvent fileEvent) {
	events.add(fileEvent);
}
 
开发者ID:Hive2Hive,项目名称:Hive2Hive,代码行数:6,代码来源:FileEventsTest.java


注:本文中的org.hive2hive.core.events.framework.interfaces.file.IFileUpdateEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。