use of org.syncany.operations.update.UpdateOperation in project syncany by syncany.
the class UpdateCommand method execute.
@Override
public int execute(String[] operationArgs) throws Exception {
UpdateOperationOptions operationOptions = parseOptions(operationArgs);
UpdateOperationResult operationResult = new UpdateOperation(config, operationOptions).execute();
printResults(operationResult);
return 0;
}
use of org.syncany.operations.update.UpdateOperation in project syncany by syncany.
the class UpdateManagementRequestHandler method handleRequest.
@Override
public Response handleRequest(final ManagementRequest request) {
final UpdateManagementRequest concreteRequest = (UpdateManagementRequest) request;
logger.log(Level.SEVERE, "Executing UpdateOperation for action " + concreteRequest.getOptions().getAction() + " ...");
Thread updateThread = new Thread(new Runnable() {
@Override
public void run() {
try {
UpdateOperation updateOperation = new UpdateOperation(null, concreteRequest.getOptions());
UpdateOperationResult operationResult = updateOperation.execute();
switch(operationResult.getResultCode()) {
case OK:
eventBus.post(new UpdateManagementResponse(UpdateManagementResponse.OK, operationResult, request.getId()));
break;
case NOK:
eventBus.post(new UpdateManagementResponse(UpdateManagementResponse.NOK_FAILED_UNKNOWN, operationResult, request.getId()));
break;
}
} catch (Exception e) {
logger.log(Level.WARNING, "Error executing update management request.", e);
eventBus.post(new UpdateManagementResponse(UpdateManagementResponse.NOK_OPERATION_FAILED, new UpdateOperationResult(), request.getId()));
}
}
}, "UpdRq/" + concreteRequest.getOptions().getAction());
updateThread.start();
return null;
}
use of org.syncany.operations.update.UpdateOperation in project syncany by syncany.
the class UpdateOperationTest method testUpdateCheck.
@Test
public void testUpdateCheck() throws Exception {
UpdateOperationOptions updateOptions = new UpdateOperationOptions();
updateOptions.setAction(UpdateOperationAction.CHECK);
// Run
UpdateOperationResult updateResult = new UpdateOperation(null, updateOptions).execute();
// Test
assertNotNull(updateResult);
assertEquals(UpdateResultCode.OK, updateResult.getResultCode());
assertEquals(UpdateOperationAction.CHECK, updateResult.getAction());
assertNotNull(updateResult.getAppInfo());
assertNotNull(updateResult.getAppInfo().getAppVersion());
assertNotNull(updateResult.getAppInfo().getArchitecture());
assertNotNull(updateResult.getAppInfo().getDate());
assertNotNull(updateResult.getAppInfo().getDist());
assertNotNull(updateResult.getAppInfo().getDownloadUrl());
assertNotNull(updateResult.getAppInfo().getOperatingSystem());
assertNotNull(updateResult.getAppInfo().getType());
}
Aggregations