use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testDetailedGetLookup.
@Test
public void testDetailedGetLookup() {
final LookupCoordinatorManager lookupCoordinatorManager = EasyMock.createStrictMock(LookupCoordinatorManager.class);
EasyMock.expect(lookupCoordinatorManager.getKnownLookups()).andReturn(SINGLE_TIER_MAP).once();
EasyMock.replay(lookupCoordinatorManager);
final LookupCoordinatorResource lookupCoordinatorResource = new LookupCoordinatorResource(lookupCoordinatorManager, MAPPER, MAPPER);
final Response response = lookupCoordinatorResource.getSpecificTier(LOOKUP_TIER, true);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals(SINGLE_TIER_MAP.get(LOOKUP_TIER), response.getEntity());
EasyMock.verify(lookupCoordinatorManager);
}
use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testSimpleDeleteTier.
@Test
public void testSimpleDeleteTier() {
final String author = "some author";
final String comment = "some comment";
final String ip = "127.0.0.1";
final HttpServletRequest request = EasyMock.createStrictMock(HttpServletRequest.class);
EasyMock.expect(request.getRemoteAddr()).andReturn(ip).once();
final Capture<AuditInfo> auditInfoCapture = Capture.newInstance();
final LookupCoordinatorManager lookupCoordinatorManager = EasyMock.createStrictMock(LookupCoordinatorManager.class);
EasyMock.expect(lookupCoordinatorManager.deleteTier(EasyMock.eq(LOOKUP_TIER), EasyMock.capture(auditInfoCapture))).andReturn(true).once();
EasyMock.replay(lookupCoordinatorManager, request);
final LookupCoordinatorResource lookupCoordinatorResource = new LookupCoordinatorResource(lookupCoordinatorManager, MAPPER, MAPPER);
final Response response = lookupCoordinatorResource.deleteTier(LOOKUP_TIER, author, comment, request);
Assert.assertEquals(202, response.getStatus());
Assert.assertTrue(auditInfoCapture.hasCaptured());
final AuditInfo auditInfo = auditInfoCapture.getValue();
Assert.assertEquals(author, auditInfo.getAuthor());
Assert.assertEquals(comment, auditInfo.getComment());
Assert.assertEquals(ip, auditInfo.getIp());
EasyMock.verify(lookupCoordinatorManager, request);
}
use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testMissingGetTier.
@Test
public void testMissingGetTier() {
final String tier = "some tier";
final LookupCoordinatorManager lookupCoordinatorManager = EasyMock.createStrictMock(LookupCoordinatorManager.class);
final Map<String, Map<String, Map<String, Object>>> retVal = ImmutableMap.of();
EasyMock.expect(lookupCoordinatorManager.getKnownLookups()).andReturn(SINGLE_TIER_MAP).once();
EasyMock.replay(lookupCoordinatorManager);
final LookupCoordinatorResource lookupCoordinatorResource = new LookupCoordinatorResource(lookupCoordinatorManager, MAPPER, MAPPER);
final Response response = lookupCoordinatorResource.getSpecificTier(tier, false);
Assert.assertEquals(404, response.getStatus());
EasyMock.verify(lookupCoordinatorManager);
}
use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testNullLookupsGetTier.
@Test
public void testNullLookupsGetTier() {
final String tier = "some tier";
final LookupCoordinatorManager lookupCoordinatorManager = EasyMock.createStrictMock(LookupCoordinatorManager.class);
EasyMock.expect(lookupCoordinatorManager.getKnownLookups()).andReturn(null).once();
EasyMock.replay(lookupCoordinatorManager);
final LookupCoordinatorResource lookupCoordinatorResource = new LookupCoordinatorResource(lookupCoordinatorManager, MAPPER, MAPPER);
final Response response = lookupCoordinatorResource.getSpecificTier(tier, false);
Assert.assertEquals(404, response.getStatus());
Assert.assertEquals(ImmutableMap.of("error", "No lookups found"), response.getEntity());
EasyMock.verify(lookupCoordinatorManager);
}
use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testGetAllLookupsStatus.
@Test
public void testGetAllLookupsStatus() {
final LookupCoordinatorManager lookupCoordinatorManager = EasyMock.createStrictMock(LookupCoordinatorManager.class);
EasyMock.expect(lookupCoordinatorManager.getKnownLookups()).andReturn(SINGLE_TIER_MAP);
EasyMock.expect(lookupCoordinatorManager.getLastKnownLookupsStateOnNodes()).andReturn(NODES_LOOKUP_STATE);
EasyMock.expect(lookupCoordinatorManager.discoverNodesInTier(LOOKUP_TIER)).andReturn(ImmutableList.of(LOOKUP_NODE));
EasyMock.replay(lookupCoordinatorManager);
final LookupCoordinatorResource lookupCoordinatorResource = new LookupCoordinatorResource(lookupCoordinatorManager, MAPPER, MAPPER);
final Response response = lookupCoordinatorResource.getAllLookupsStatus(false);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals(ImmutableMap.of(LOOKUP_TIER, ImmutableMap.of(LOOKUP_NAME, new LookupCoordinatorResource.LookupStatus(true, null))), response.getEntity());
EasyMock.verify(lookupCoordinatorManager);
}
Aggregations