我已经在我的Java FXML控制器UI中创建了一个进度条,并将值通过executeWSButton传递给它。我正在createWorker()方法中创建新任务,并将属性值绑定到进度条。
现在的问题是我无法在createWorker()方法中创建新的Task()。六个月前工作正常,我已经恢复了开发工作。您能否在这里提出可能的原因
@FXML
public void executeWSButton(ActionEvent event) {
outputTextScreen.appendText(newLine + " Execution for Process: Started" + newLine);
executeWS.setDisable(true);
progressBar.setProgress(0);
copyWorker = createWorker();
if(testModule != "") {
progressBar.progressProperty().unbind();
progressBar.progressProperty().bind(copyWorker.progressProperty());
new Thread(copyWorker).start();
executeWS.setDisable(false);
}
else {
outputTextScreen.appendText(" Execution for Process: " + Item + " do not have any current TestMethods to Call, Hence stopping the test" + newLine);
}
}
public Task createWorker() {
return new Task() {
@Override
protected Object call() throws Exception {
Invoke_TestNG_Classes ws = new Invoke_TestNG_Classes();
String output = ws.iterateThroughTestCases(inputfile_fp, GIfile_fp, testModule,excelPath);
if(output.contains("Mark atleast"))
{
updateProgress(1.0, 1.0);
outputTextScreen.appendText(
"Please mark atleast one test case with flag as Y in Testcase Execution sheet for "+ Item + newLine);
textOutput.setText("Test Execution Aborted");
return true;
}
while (output.contains("Completed")) {
updateProgress(1.0, 1.0);
// progressBar.setAccessibleText("Completed");
System.out.println(output);
outputTextScreen.appendText("Webservice Execution for Process: " + Item + " Completed" + newLine);
textOutput.setText("Test Execution Completed");
return true;
}
return true;
}
};
}