Search in sources :

Example 1 with UpUploadFileSyncExternalEvent

use of org.syncany.operations.daemon.messages.UpUploadFileSyncExternalEvent in project syncany by syncany.

the class XmlMessageFactoryTest method testRequestToXml.

@Test
public void testRequestToXml() throws Exception {
    UpUploadFileSyncExternalEvent event = new UpUploadFileSyncExternalEvent("/some/path", "filename.jpg");
    String xmlStr = XmlMessageFactory.toXml(event).replaceAll("\\s+", "");
    assertEquals("<upUploadFileSyncExternalEvent><root>/some/path</root><filename>filename.jpg</filename></upUploadFileSyncExternalEvent>", xmlStr);
}
Also used : UpUploadFileSyncExternalEvent(org.syncany.operations.daemon.messages.UpUploadFileSyncExternalEvent) Test(org.junit.Test)

Example 2 with UpUploadFileSyncExternalEvent

use of org.syncany.operations.daemon.messages.UpUploadFileSyncExternalEvent in project syncany by syncany.

the class JsonMessageFactoryTest method testRequestToJson.

@Test
public void testRequestToJson() throws Exception {
    UpUploadFileSyncExternalEvent event = new UpUploadFileSyncExternalEvent("/some/path", "filename.jpg");
    String xmlStr = JsonMessageFactory.toJson(event).replaceAll("\\s+", "");
    assertEquals("{\"UpUploadFileSyncExternalEvent\":{\"filename\":\"filename.jpg\",\"root\":\"/some/path\"}}", xmlStr);
}
Also used : UpUploadFileSyncExternalEvent(org.syncany.operations.daemon.messages.UpUploadFileSyncExternalEvent) Test(org.junit.Test)

Example 3 with UpUploadFileSyncExternalEvent

use of org.syncany.operations.daemon.messages.UpUploadFileSyncExternalEvent in project syncany by syncany.

the class RemoteTransaction method uploadTransactionFile.

/**
	 * This method uploads a local copy of the transaction to the repository. This is done at the begin of commit()
	 * and is the starting point of the transaction itself.
	 */
private TransactionRemoteFile uploadTransactionFile(File localTransactionFile) throws StorageException {
    TransactionRemoteFile remoteTransactionFile = new TransactionRemoteFile(this);
    eventBus.post(new UpUploadFileSyncExternalEvent(config.getLocalDir().getAbsolutePath(), remoteTransactionFile.getName()));
    logger.log(Level.INFO, "- Uploading remote transaction file {0} ...", remoteTransactionFile);
    transferManager.upload(localTransactionFile, remoteTransactionFile);
    return remoteTransactionFile;
}
Also used : TransactionRemoteFile(org.syncany.plugins.transfer.files.TransactionRemoteFile) UpUploadFileSyncExternalEvent(org.syncany.operations.daemon.messages.UpUploadFileSyncExternalEvent)

Aggregations

UpUploadFileSyncExternalEvent (org.syncany.operations.daemon.messages.UpUploadFileSyncExternalEvent)3 Test (org.junit.Test)2 TransactionRemoteFile (org.syncany.plugins.transfer.files.TransactionRemoteFile)1