|
@@ -13,6 +13,7 @@ import net.mooctest.www.android_auto_test.utils.PrintUtil;
|
|
|
import net.mooctest.www.android_auto_test.utils.TraceDaemon;
|
|
|
import net.mooctest.www.android_auto_test.vo.TraceMetaInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.ApplicationArguments;
|
|
|
import org.springframework.boot.ApplicationRunner;
|
|
|
import org.springframework.http.HttpEntity;
|
|
@@ -36,10 +37,12 @@ public class MyApplicationRunner implements ApplicationRunner {
|
|
|
@Autowired
|
|
|
ApkService apkService;
|
|
|
|
|
|
+ @Value("${poll-tasks}")
|
|
|
+ private boolean pollTasks;
|
|
|
+
|
|
|
@Override
|
|
|
public void run(ApplicationArguments args) throws Exception {
|
|
|
- String onOff = args.getSourceArgs()[0];
|
|
|
- if (!"pollingOn".equals(onOff)){
|
|
|
+ if (!pollTasks){
|
|
|
return;
|
|
|
}
|
|
|
System.out.println("轮询获取任务信息");
|
|
@@ -55,13 +58,13 @@ public class MyApplicationRunner implements ApplicationRunner {
|
|
|
|
|
|
List<Device> deviceList = deviceService.getOnlineDeviceList();
|
|
|
for (Device device: deviceList){
|
|
|
-
|
|
|
-
|
|
|
DeviceStatus deviceStatus = deviceService.getDeviceStatus(device.getUdid());
|
|
|
- if (deviceStatus == DeviceStatus.RUNNING){
|
|
|
+ if (deviceStatus != DeviceStatus.FREE){
|
|
|
PrintUtil.print("Device is running, continue.", TAG, device.getUdid());
|
|
|
continue;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
device = buildDevice(device);
|
|
|
PrintUtil.print("Get TraceInfo.", TAG, device.getUdid());
|
|
|
TraceMetaInfo traceMetaInfo = getTraceMetaInfo(device);
|
|
@@ -102,7 +105,10 @@ public class MyApplicationRunner implements ApplicationRunner {
|
|
|
|
|
|
|
|
|
PrintUtil.print("Start test daemon thread.", TAG, device.getUdid());
|
|
|
- TraceDaemon traceDaemon = new TraceDaemon(traceId, limitTime, oneTraceTasks, traceMetaInfo.isNeedGenerateReport(),true, "BugReport");
|
|
|
+ TraceDaemon traceDaemon = new TraceDaemon(traceId, limitTime, oneTraceTasks,
|
|
|
+ traceMetaInfo.isNeedGenerateReport(),
|
|
|
+ traceMetaInfo.isNeedSendReport(),
|
|
|
+ traceMetaInfo.getReportType());
|
|
|
traceDaemon.setName(Consts.DAEMON_THREAD_NAME_PREFIX + traceId);
|
|
|
traceDaemon.start();
|
|
|
|