|
@@ -63,7 +63,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testInitialStatusStopped() {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, Collections.singletonMap("foo", "bar"), randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|
|
@@ -76,7 +76,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testInitialStatusAborting() {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.ABORTING, Collections.singletonMap("foo", "bar"), randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.ABORTING, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|
|
@@ -89,7 +89,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testInitialStatusStopping() {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPING, Collections.singletonMap("foo", "bar"), randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPING, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|
|
@@ -102,7 +102,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testInitialStatusStarted() {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STARTED, Collections.singletonMap("foo", "bar"), randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STARTED, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|
|
@@ -115,7 +115,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testInitialStatusIndexingOldID() {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.INDEXING, Collections.singletonMap("foo", "bar"), false);
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.INDEXING, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|
|
@@ -124,12 +124,11 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STARTED));
|
|
|
assertThat(((RollupJobStatus)task.getStatus()).getPosition().size(), equalTo(1));
|
|
|
assertTrue(((RollupJobStatus)task.getStatus()).getPosition().containsKey("foo"));
|
|
|
- assertFalse(((RollupJobStatus) task.getStatus()).isUpgradedDocumentID());
|
|
|
}
|
|
|
|
|
|
public void testInitialStatusIndexingNewID() {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.INDEXING, Collections.singletonMap("foo", "bar"), true);
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.INDEXING, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|
|
@@ -138,7 +137,6 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STARTED));
|
|
|
assertThat(((RollupJobStatus)task.getStatus()).getPosition().size(), equalTo(1));
|
|
|
assertTrue(((RollupJobStatus)task.getStatus()).getPosition().containsKey("foo"));
|
|
|
- assertTrue(((RollupJobStatus) task.getStatus()).isUpgradedDocumentID());
|
|
|
}
|
|
|
|
|
|
public void testNoInitialStatus() {
|
|
@@ -150,12 +148,11 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
null, client, schedulerEngine, pool, Collections.emptyMap());
|
|
|
assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STOPPED));
|
|
|
assertNull(((RollupJobStatus)task.getStatus()).getPosition());
|
|
|
- assertTrue(((RollupJobStatus) task.getStatus()).isUpgradedDocumentID());
|
|
|
}
|
|
|
|
|
|
public void testStartWhenStarted() throws InterruptedException {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STARTED, Collections.singletonMap("foo", "bar"), randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STARTED, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|
|
@@ -263,7 +260,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testStartWhenStopped() throws InterruptedException {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, Collections.singletonMap("foo", "bar"), randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = mock(SchedulerEngine.class);
|
|
@@ -301,7 +298,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testTriggerUnrelated() throws InterruptedException {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, Collections.singletonMap("foo", "bar"), randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, Collections.singletonMap("foo", "bar"));
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = mock(SchedulerEngine.class);
|
|
@@ -426,10 +423,6 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
listener.onResponse(new PersistentTasksCustomMetaData.PersistentTask<>("foo", RollupField.TASK_NAME, job, 1,
|
|
|
new PersistentTasksCustomMetaData.Assignment("foo", "foo")));
|
|
|
} else if (counterValue == 1) {
|
|
|
- // When we get here, doSaveState() was just invoked so we will have
|
|
|
- // have upgraded IDs
|
|
|
- RollupJobStatus s = (RollupJobStatus)this.getStatus();
|
|
|
- assertTrue(s.isUpgradedDocumentID());
|
|
|
finished.set(true);
|
|
|
}
|
|
|
|
|
@@ -438,11 +431,11 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STOPPED));
|
|
|
assertNull(((RollupJobStatus)task.getStatus()).getPosition());
|
|
|
|
|
|
- task.start(new ActionListener<StartRollupJobAction.Response>() {
|
|
|
+ task.start(new ActionListener<>() {
|
|
|
@Override
|
|
|
public void onResponse(StartRollupJobAction.Response response) {
|
|
|
assertTrue(response.isStarted());
|
|
|
- assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STARTED));
|
|
|
+ assertThat(((RollupJobStatus) task.getStatus()).getIndexerState(), equalTo(IndexerState.STARTED));
|
|
|
started.set(true);
|
|
|
}
|
|
|
|
|
@@ -514,10 +507,6 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
listener.onResponse(new PersistentTasksCustomMetaData.PersistentTask<>("foo", RollupField.TASK_NAME, job, 1,
|
|
|
new PersistentTasksCustomMetaData.Assignment("foo", "foo")));
|
|
|
} else if (counterValue == 1) {
|
|
|
- // When we get here, doSaveState() was just invoked so we will have
|
|
|
- // have upgraded IDs
|
|
|
- RollupJobStatus s = (RollupJobStatus)this.getStatus();
|
|
|
- assertTrue(s.isUpgradedDocumentID());
|
|
|
finished.set(true);
|
|
|
}
|
|
|
|
|
@@ -526,11 +515,11 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STOPPED));
|
|
|
assertNull(((RollupJobStatus)task.getStatus()).getPosition());
|
|
|
|
|
|
- task.start(new ActionListener<StartRollupJobAction.Response>() {
|
|
|
+ task.start(new ActionListener<>() {
|
|
|
@Override
|
|
|
public void onResponse(StartRollupJobAction.Response response) {
|
|
|
assertTrue(response.isStarted());
|
|
|
- assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STARTED));
|
|
|
+ assertThat(((RollupJobStatus) task.getStatus()).getIndexerState(), equalTo(IndexerState.STARTED));
|
|
|
started.set(true);
|
|
|
}
|
|
|
|
|
@@ -590,7 +579,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
}).when(client).execute(anyObject(), anyObject(), anyObject());
|
|
|
|
|
|
SchedulerEngine schedulerEngine = mock(SchedulerEngine.class);
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, null, false);
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, null);
|
|
|
RollupJobTask task = new RollupJobTask(1, "type", "action", new TaskId("node", 123), job,
|
|
|
status, client, schedulerEngine, pool, Collections.emptyMap()) {
|
|
|
@Override
|
|
@@ -603,10 +592,6 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
listener.onResponse(new PersistentTasksCustomMetaData.PersistentTask<>("foo", RollupField.TASK_NAME, job, 1,
|
|
|
new PersistentTasksCustomMetaData.Assignment("foo", "foo")));
|
|
|
} else if (counterValue == 1) {
|
|
|
- // When we get here, doSaveState() was just invoked so we will have
|
|
|
- // have upgraded IDs
|
|
|
- RollupJobStatus s = (RollupJobStatus)this.getStatus();
|
|
|
- assertTrue(s.isUpgradedDocumentID());
|
|
|
finished.set(true);
|
|
|
}
|
|
|
|
|
@@ -615,11 +600,11 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STOPPED));
|
|
|
assertNull(((RollupJobStatus)task.getStatus()).getPosition());
|
|
|
|
|
|
- task.start(new ActionListener<StartRollupJobAction.Response>() {
|
|
|
+ task.start(new ActionListener<>() {
|
|
|
@Override
|
|
|
public void onResponse(StartRollupJobAction.Response response) {
|
|
|
assertTrue(response.isStarted());
|
|
|
- assertThat(((RollupJobStatus)task.getStatus()).getIndexerState(), equalTo(IndexerState.STARTED));
|
|
|
+ assertThat(((RollupJobStatus) task.getStatus()).getIndexerState(), equalTo(IndexerState.STARTED));
|
|
|
started.set(true);
|
|
|
}
|
|
|
|
|
@@ -642,7 +627,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testStopWhenStopped() throws InterruptedException {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, null, randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, null);
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|
|
@@ -749,7 +734,7 @@ public class RollupJobTaskTests extends ESTestCase {
|
|
|
|
|
|
public void testStopWhenAborting() throws InterruptedException {
|
|
|
RollupJob job = new RollupJob(ConfigTestHelpers.randomRollupJobConfig(random()), Collections.emptyMap());
|
|
|
- RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, null, randomBoolean());
|
|
|
+ RollupJobStatus status = new RollupJobStatus(IndexerState.STOPPED, null);
|
|
|
Client client = mock(Client.class);
|
|
|
when(client.settings()).thenReturn(Settings.EMPTY);
|
|
|
SchedulerEngine schedulerEngine = new SchedulerEngine(SETTINGS, Clock.systemUTC());
|