Merge remote-tracking branch 'eclipse/master' into feature_MECS-86_tenant_specific_polling_configuration

# Conflicts:
#
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/tenantconfiguration/Tena
ntConfigurationDashboardView.java
This commit is contained in:
Kai Zimmermann
2016-03-14 09:51:00 +01:00
40 changed files with 667 additions and 439 deletions

View File

@@ -62,8 +62,9 @@ public class DeviceSimulatorUpdater {
device.setProgress(0.0);
device.setSwversion(swVersion);
eventbus.post(new InitUpdate(device));
threadPool.schedule(new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
2000, TimeUnit.MILLISECONDS);
2_000, TimeUnit.MILLISECONDS);
}
private static final class DeviceSimulatorUpdateThread implements Runnable {
@@ -91,7 +92,7 @@ public class DeviceSimulatorUpdater {
if (newProgress < 1.0) {
threadPool.schedule(
new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
rndSleep.nextInt(3000), TimeUnit.MILLISECONDS);
rndSleep.nextInt(5_000), TimeUnit.MILLISECONDS);
} else {
callback.updateFinished(device, actionId);
}

View File

@@ -13,11 +13,8 @@ import java.util.Map;
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
import org.eclipse.hawkbit.dmf.json.model.ActionStatus;
import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice;
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater;
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater.UpdaterCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
@@ -139,31 +136,22 @@ public class SpReceiverService extends ReceiverService {
DownloadAndUpdateRequest.class);
final Long actionId = downloadAndUpdateRequest.getActionId();
try {
Thread.sleep(1_000);
} catch (final InterruptedException e) {
LOGGER.error("Sleep interrupted", e);
}
spSenderService.sendActionStatusMessage(tenant, ActionStatus.RUNNING,
"device Simulator retrieved update request. proceeding with simulation.", actionId);
deviceUpdater.startUpdate(tenant, thingId, actionId, downloadAndUpdateRequest.getSoftwareModules().get(0)
.getModuleVersion(), new UpdaterCallback() {
@Override
public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) {
switch (device.getResponseStatus()) {
case SUCCESSFUL:
spSenderService.finishUpdateProcess(new SimulatedUpdate(device.getTenant(), device.getId(),
actionId), "Simulation complete!");
break;
case ERROR:
spSenderService.finishUpdateProcessWithError(new SimulatedUpdate(device.getTenant(),
device.getId(), actionId), "Simulation complete with error!");
break;
default:
break;
}
}
});
deviceUpdater.startUpdate(tenant, thingId, actionId,
downloadAndUpdateRequest.getSoftwareModules().get(0).getModuleVersion(), (device, actionId1) -> {
switch (device.getResponseStatus()) {
case SUCCESSFUL:
spSenderService.finishUpdateProcess(
new SimulatedUpdate(device.getTenant(), device.getId(), actionId1),
"Simulation complete!");
break;
case ERROR:
spSenderService.finishUpdateProcessWithError(
new SimulatedUpdate(device.getTenant(), device.getId(), actionId1),
"Simulation complete with error!");
break;
default:
break;
}
});
}
}

View File

@@ -24,3 +24,18 @@ spring.rabbitmq.port=5672
hawkbit.dmf.rabbitmq.deadLetterQueue=dmf_connector_deadletter
hawkbit.dmf.rabbitmq.deadLetterExchange=dmf.connector.deadletter
hawkbit.dmf.rabbitmq.receiverQueue=dmf_receiver
# UI demo account
hawkbit.server.ui.demo.password=admin
hawkbit.server.ui.demo.user=admin
hawkbit.server.ui.demo.tenant=DEFAULT
# UI help links
hawkbit.server.ui.links.documentation.root=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.deployment-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.distribution-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.rollout-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.security=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.system-configuration-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.targetfilter-view=https://github.com/eclipse/hawkbit
hawkbit.server.ui.links.documentation.upload-view=https://github.com/eclipse/hawkbit

View File

@@ -1,2 +1,3 @@
/target/
/bin/
/.apt_generated/