|
@@ -378,6 +378,27 @@ public class TestContainer {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public void testLocalizationFailureWhileRunning()
|
|
|
+ throws Exception {
|
|
|
+ WrappedContainer wc = null;
|
|
|
+ try {
|
|
|
+ wc = new WrappedContainer(6, 314159265358979L, 4344, "yak");
|
|
|
+ wc.initContainer();
|
|
|
+ wc.localizeResources();
|
|
|
+ wc.launchContainer();
|
|
|
+ reset(wc.localizerBus);
|
|
|
+ assertEquals(ContainerState.RUNNING, wc.c.getContainerState());
|
|
|
+ // Now in RUNNING, handle ContainerResourceFailedEvent, cause NPE before
|
|
|
+ wc.handleContainerResourceFailedEvent();
|
|
|
+ } finally {
|
|
|
+ if (wc != null) {
|
|
|
+ wc.finished();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
@SuppressWarnings("unchecked") // mocked generic
|
|
|
public void testCleanupOnKillRequest() throws Exception {
|
|
@@ -1132,6 +1153,11 @@ public class TestContainer {
|
|
|
drainDispatcherEvents();
|
|
|
}
|
|
|
|
|
|
+ public void handleContainerResourceFailedEvent() {
|
|
|
+ c.handle(new ContainerResourceFailedEvent(cId, null, null));
|
|
|
+ drainDispatcherEvents();
|
|
|
+ }
|
|
|
+
|
|
|
// Localize resources
|
|
|
// Skip some resources so as to consider them failed
|
|
|
public Map<Path, List<String>> doLocalizeResources(
|