當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。