Search in sources :

Example 11 with SupervisorSpec

use of org.apache.druid.indexing.overlord.supervisor.SupervisorSpec in project druid by druid-io.

the class SQLMetadataSupervisorManagerTest method testGetLatestTerminatedOnly.

@Test
public void testGetLatestTerminatedOnly() {
    final String supervisor1 = "test-supervisor-1";
    final String datasource1 = "datasource-1";
    final String supervisor2 = "test-supervisor-2";
    final Map<String, String> data1rev1 = ImmutableMap.of("key1-1", "value1-1-1", "key1-2", "value1-2-1");
    Assert.assertTrue(supervisorManager.getAll().isEmpty());
    supervisorManager.insert(supervisor1, new TestSupervisorSpec(supervisor1, data1rev1));
    // supervisor1 is terminated
    supervisorManager.insert(supervisor1, new NoopSupervisorSpec(supervisor1, ImmutableList.of(datasource1)));
    // supervisor2 is still active
    supervisorManager.insert(supervisor2, new TestSupervisorSpec(supervisor2, data1rev1));
    // get latest terminated should only return supervisor1
    Map<String, SupervisorSpec> actual = supervisorManager.getLatestTerminatedOnly();
    Assert.assertEquals(1, actual.size());
    Assert.assertTrue(actual.containsKey(supervisor1));
}
Also used : NoopSupervisorSpec(org.apache.druid.indexing.overlord.supervisor.NoopSupervisorSpec) VersionedSupervisorSpec(org.apache.druid.indexing.overlord.supervisor.VersionedSupervisorSpec) SupervisorSpec(org.apache.druid.indexing.overlord.supervisor.SupervisorSpec) NoopSupervisorSpec(org.apache.druid.indexing.overlord.supervisor.NoopSupervisorSpec) Test(org.junit.Test)

Aggregations

SupervisorSpec (org.apache.druid.indexing.overlord.supervisor.SupervisorSpec)11 Test (org.junit.Test)6 NoopSupervisorSpec (org.apache.druid.indexing.overlord.supervisor.NoopSupervisorSpec)5 VersionedSupervisorSpec (org.apache.druid.indexing.overlord.supervisor.VersionedSupervisorSpec)5 WebApplicationException (javax.ws.rs.WebApplicationException)3 ImmutableList (com.google.common.collect.ImmutableList)2 List (java.util.List)2 Map (java.util.Map)2 Access (org.apache.druid.server.security.Access)2 Preconditions (com.google.common.base.Preconditions)1 Strings (com.google.common.base.Strings)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Inject (com.google.inject.Inject)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 PathSegment (javax.ws.rs.core.PathSegment)1 IndexerMetadataStorageCoordinator (org.apache.druid.indexing.overlord.IndexerMetadataStorageCoordinator)1