|
@@ -473,8 +473,8 @@ public class TestRMAppTransitions {
|
|
application = testCreateAppFinishing(submissionContext);
|
|
application = testCreateAppFinishing(submissionContext);
|
|
}
|
|
}
|
|
// RUNNING/FINISHING => FINISHED event RMAppEventType.ATTEMPT_FINISHED
|
|
// RUNNING/FINISHING => FINISHED event RMAppEventType.ATTEMPT_FINISHED
|
|
- RMAppEvent finishedEvent = new RMAppFinishedAttemptEvent(
|
|
|
|
- application.getApplicationId(), diagnostics);
|
|
|
|
|
|
+ RMAppEvent finishedEvent = new RMAppEvent(application.getApplicationId(),
|
|
|
|
+ RMAppEventType.ATTEMPT_FINISHED, diagnostics);
|
|
application.handle(finishedEvent);
|
|
application.handle(finishedEvent);
|
|
assertAppState(RMAppState.FINISHED, application);
|
|
assertAppState(RMAppState.FINISHED, application);
|
|
assertTimesAtFinish(application);
|
|
assertTimesAtFinish(application);
|
|
@@ -548,8 +548,9 @@ public class TestRMAppTransitions {
|
|
|
|
|
|
RMApp application = createNewTestApp(null);
|
|
RMApp application = createNewTestApp(null);
|
|
// NEW => KILLED event RMAppEventType.KILL
|
|
// NEW => KILLED event RMAppEventType.KILL
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ RMAppEvent event =
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -566,8 +567,8 @@ public class TestRMAppTransitions {
|
|
RMApp application = createNewTestApp(null);
|
|
RMApp application = createNewTestApp(null);
|
|
// NEW => FAILED event RMAppEventType.APP_REJECTED
|
|
// NEW => FAILED event RMAppEventType.APP_REJECTED
|
|
String rejectedText = "Test Application Rejected";
|
|
String rejectedText = "Test Application Rejected";
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppRejectedEvent(application.getApplicationId(), rejectedText);
|
|
|
|
|
|
+ RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
+ RMAppEventType.APP_REJECTED, rejectedText);
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -583,8 +584,8 @@ public class TestRMAppTransitions {
|
|
RMApp application = createNewTestApp(null);
|
|
RMApp application = createNewTestApp(null);
|
|
// NEW => FAILED event RMAppEventType.APP_REJECTED
|
|
// NEW => FAILED event RMAppEventType.APP_REJECTED
|
|
String rejectedText = "Test Application Rejected";
|
|
String rejectedText = "Test Application Rejected";
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppRejectedEvent(application.getApplicationId(), rejectedText);
|
|
|
|
|
|
+ RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
+ RMAppEventType.APP_REJECTED, rejectedText);
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -601,7 +602,8 @@ public class TestRMAppTransitions {
|
|
RMApp application = testCreateAppNewSaving(null);
|
|
RMApp application = testCreateAppNewSaving(null);
|
|
// NEW_SAVING => KILLED event RMAppEventType.KILL
|
|
// NEW_SAVING => KILLED event RMAppEventType.KILL
|
|
RMAppEvent event =
|
|
RMAppEvent event =
|
|
- new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -617,8 +619,8 @@ public class TestRMAppTransitions {
|
|
RMApp application = testCreateAppNewSaving(null);
|
|
RMApp application = testCreateAppNewSaving(null);
|
|
// NEW_SAVING => FAILED event RMAppEventType.APP_REJECTED
|
|
// NEW_SAVING => FAILED event RMAppEventType.APP_REJECTED
|
|
String rejectedText = "Test Application Rejected";
|
|
String rejectedText = "Test Application Rejected";
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppRejectedEvent(application.getApplicationId(), rejectedText);
|
|
|
|
|
|
+ RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
+ RMAppEventType.APP_REJECTED, rejectedText);
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -634,8 +636,8 @@ public class TestRMAppTransitions {
|
|
RMApp application = testCreateAppSubmittedNoRecovery(null);
|
|
RMApp application = testCreateAppSubmittedNoRecovery(null);
|
|
// SUBMITTED => FAILED event RMAppEventType.APP_REJECTED
|
|
// SUBMITTED => FAILED event RMAppEventType.APP_REJECTED
|
|
String rejectedText = "app rejected";
|
|
String rejectedText = "app rejected";
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppRejectedEvent(application.getApplicationId(), rejectedText);
|
|
|
|
|
|
+ RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
+ RMAppEventType.APP_REJECTED, rejectedText);
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -649,8 +651,9 @@ public class TestRMAppTransitions {
|
|
LOG.info("--- START: testAppSubmittedKill---");
|
|
LOG.info("--- START: testAppSubmittedKill---");
|
|
RMApp application = testCreateAppSubmittedNoRecovery(null);
|
|
RMApp application = testCreateAppSubmittedNoRecovery(null);
|
|
// SUBMITTED => KILLED event RMAppEventType.KILL
|
|
// SUBMITTED => KILLED event RMAppEventType.KILL
|
|
- RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
- RMAppEventType.KILL);
|
|
|
|
|
|
+ RMAppEvent event =
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -700,15 +703,16 @@ public class TestRMAppTransitions {
|
|
LOG.info("--- START: testAppAcceptedKill ---");
|
|
LOG.info("--- START: testAppAcceptedKill ---");
|
|
RMApp application = testCreateAppAccepted(null);
|
|
RMApp application = testCreateAppAccepted(null);
|
|
// ACCEPTED => KILLED event RMAppEventType.KILL
|
|
// ACCEPTED => KILLED event RMAppEventType.KILL
|
|
- RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
- RMAppEventType.KILL);
|
|
|
|
|
|
+ RMAppEvent event =
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
|
|
|
|
assertAppState(RMAppState.KILLING, application);
|
|
assertAppState(RMAppState.KILLING, application);
|
|
RMAppEvent appAttemptKilled =
|
|
RMAppEvent appAttemptKilled =
|
|
new RMAppEvent(application.getApplicationId(),
|
|
new RMAppEvent(application.getApplicationId(),
|
|
- RMAppEventType.ATTEMPT_KILLED);
|
|
|
|
|
|
+ RMAppEventType.ATTEMPT_KILLED, "Application killed by user.");
|
|
application.handle(appAttemptKilled);
|
|
application.handle(appAttemptKilled);
|
|
assertAppState(RMAppState.FINAL_SAVING, application);
|
|
assertAppState(RMAppState.FINAL_SAVING, application);
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -729,7 +733,7 @@ public class TestRMAppTransitions {
|
|
// RUNNING.
|
|
// RUNNING.
|
|
RMAppEvent event =
|
|
RMAppEvent event =
|
|
new RMAppEvent(application.getApplicationId(),
|
|
new RMAppEvent(application.getApplicationId(),
|
|
- RMAppEventType.ATTEMPT_KILLED);
|
|
|
|
|
|
+ RMAppEventType.ATTEMPT_KILLED, "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
|
|
|
|
@@ -747,8 +751,9 @@ public class TestRMAppTransitions {
|
|
|
|
|
|
RMApp application = testCreateAppRunning(null);
|
|
RMApp application = testCreateAppRunning(null);
|
|
// RUNNING => KILLED event RMAppEventType.KILL
|
|
// RUNNING => KILLED event RMAppEventType.KILL
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ RMAppEvent event =
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
|
|
|
|
@@ -806,7 +811,9 @@ public class TestRMAppTransitions {
|
|
assertAppFinalStateSaved(application);
|
|
assertAppFinalStateSaved(application);
|
|
|
|
|
|
// FAILED => FAILED event RMAppEventType.KILL
|
|
// FAILED => FAILED event RMAppEventType.KILL
|
|
- event = new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ event =
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
assertFailed(application, ".*Failing the application.*");
|
|
assertFailed(application, ".*Failing the application.*");
|
|
@@ -821,7 +828,8 @@ public class TestRMAppTransitions {
|
|
RMApp application = testCreateAppFinishing(null);
|
|
RMApp application = testCreateAppFinishing(null);
|
|
// FINISHING => FINISHED event RMAppEventType.KILL
|
|
// FINISHING => FINISHED event RMAppEventType.KILL
|
|
RMAppEvent event =
|
|
RMAppEvent event =
|
|
- new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
assertAppState(RMAppState.FINISHING, application);
|
|
assertAppState(RMAppState.FINISHING, application);
|
|
@@ -838,8 +846,8 @@ public class TestRMAppTransitions {
|
|
RMApp application = testCreateAppFinalSaving(null);
|
|
RMApp application = testCreateAppFinalSaving(null);
|
|
final String diagMsg = "some diagnostics";
|
|
final String diagMsg = "some diagnostics";
|
|
// attempt_finished event comes before attempt_saved event
|
|
// attempt_finished event comes before attempt_saved event
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppFinishedAttemptEvent(application.getApplicationId(), diagMsg);
|
|
|
|
|
|
+ RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
+ RMAppEventType.ATTEMPT_FINISHED, diagMsg);
|
|
application.handle(event);
|
|
application.handle(event);
|
|
assertAppState(RMAppState.FINAL_SAVING, application);
|
|
assertAppState(RMAppState.FINAL_SAVING, application);
|
|
RMAppEvent appUpdated =
|
|
RMAppEvent appUpdated =
|
|
@@ -860,8 +868,9 @@ public class TestRMAppTransitions {
|
|
|
|
|
|
RMApp application = testCreateAppFinished(null, "");
|
|
RMApp application = testCreateAppFinished(null, "");
|
|
// FINISHED => FINISHED event RMAppEventType.KILL
|
|
// FINISHED => FINISHED event RMAppEventType.KILL
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ RMAppEvent event =
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
assertTimesAtFinish(application);
|
|
assertTimesAtFinish(application);
|
|
@@ -879,8 +888,8 @@ public class TestRMAppTransitions {
|
|
RMApp application = testCreateAppNewSaving(null);
|
|
RMApp application = testCreateAppNewSaving(null);
|
|
|
|
|
|
// NEW_SAVING => FAILED event RMAppEventType.APP_REJECTED
|
|
// NEW_SAVING => FAILED event RMAppEventType.APP_REJECTED
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppRejectedEvent(application.getApplicationId(), "");
|
|
|
|
|
|
+ RMAppEvent event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
+ RMAppEventType.APP_REJECTED, "");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAppUpdateSavedEvent(application);
|
|
sendAppUpdateSavedEvent(application);
|
|
@@ -889,7 +898,8 @@ public class TestRMAppTransitions {
|
|
|
|
|
|
// FAILED => FAILED event RMAppEventType.KILL
|
|
// FAILED => FAILED event RMAppEventType.KILL
|
|
event =
|
|
event =
|
|
- new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
assertTimesAtFinish(application);
|
|
assertTimesAtFinish(application);
|
|
@@ -907,8 +917,9 @@ public class TestRMAppTransitions {
|
|
RMApp application = testCreateAppRunning(null);
|
|
RMApp application = testCreateAppRunning(null);
|
|
|
|
|
|
// RUNNING => KILLED event RMAppEventType.KILL
|
|
// RUNNING => KILLED event RMAppEventType.KILL
|
|
- RMAppEvent event =
|
|
|
|
- new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ RMAppEvent event =
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
sendAttemptUpdateSavedEvent(application);
|
|
sendAttemptUpdateSavedEvent(application);
|
|
@@ -917,8 +928,8 @@ public class TestRMAppTransitions {
|
|
assertAppState(RMAppState.KILLED, application);
|
|
assertAppState(RMAppState.KILLED, application);
|
|
|
|
|
|
// KILLED => KILLED event RMAppEventType.ATTEMPT_FINISHED
|
|
// KILLED => KILLED event RMAppEventType.ATTEMPT_FINISHED
|
|
- event = new RMAppFinishedAttemptEvent(
|
|
|
|
- application.getApplicationId(), "");
|
|
|
|
|
|
+ event = new RMAppEvent(application.getApplicationId(),
|
|
|
|
+ RMAppEventType.ATTEMPT_FINISHED, "");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
assertTimesAtFinish(application);
|
|
assertTimesAtFinish(application);
|
|
@@ -935,7 +946,9 @@ public class TestRMAppTransitions {
|
|
|
|
|
|
|
|
|
|
// KILLED => KILLED event RMAppEventType.KILL
|
|
// KILLED => KILLED event RMAppEventType.KILL
|
|
- event = new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL);
|
|
|
|
|
|
+ event =
|
|
|
|
+ new RMAppEvent(application.getApplicationId(), RMAppEventType.KILL,
|
|
|
|
+ "Application killed by user.");
|
|
application.handle(event);
|
|
application.handle(event);
|
|
rmDispatcher.await();
|
|
rmDispatcher.await();
|
|
assertTimesAtFinish(application);
|
|
assertTimesAtFinish(application);
|