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);
}
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);
}
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;
}
Aggregations