use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testNullValsNewLookup.
@Test
public void testNullValsNewLookup() throws Exception {
final String author = "some author";
final String comment = "some comment";
final String ip = "127.0.0.1";
final HttpServletRequest request = EasyMock.createStrictMock(HttpServletRequest.class);
final LookupCoordinatorManager lookupCoordinatorManager = EasyMock.createStrictMock(LookupCoordinatorManager.class);
final LookupCoordinatorResource lookupCoordinatorResource = new LookupCoordinatorResource(lookupCoordinatorManager, MAPPER, MAPPER);
EasyMock.replay(lookupCoordinatorManager, request);
Assert.assertEquals(400, lookupCoordinatorResource.createOrUpdateLookup(null, LOOKUP_NAME, author, comment, EMPTY_MAP_SOURCE.openStream(), request).getStatus());
Assert.assertEquals(400, lookupCoordinatorResource.createOrUpdateLookup(LOOKUP_TIER, null, author, comment, EMPTY_MAP_SOURCE.openStream(), request).getStatus());
Assert.assertEquals(400, lookupCoordinatorResource.createOrUpdateLookup(LOOKUP_TIER, "", author, comment, EMPTY_MAP_SOURCE.openStream(), request).getStatus());
Assert.assertEquals(400, lookupCoordinatorResource.createOrUpdateLookup("", LOOKUP_NAME, author, comment, EMPTY_MAP_SOURCE.openStream(), request).getStatus());
EasyMock.verify(lookupCoordinatorManager, request);
}
use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testGetAllNodesStatusDetailedFalse.
@Test
public void testGetAllNodesStatusDetailedFalse() {
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.getAllNodesStatus(false, false);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals(ImmutableMap.of(LOOKUP_TIER, ImmutableMap.of(LOOKUP_NODE, new LookupsState(ImmutableMap.of(LOOKUP_NAME, SINGLE_LOOKUP.getVersion()), null, null))), response.getEntity());
EasyMock.verify(lookupCoordinatorManager);
}
use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testMissingGet.
@Test
public void testMissingGet() {
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.getTiers(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 testGetSpecificNodeStatus.
@Test
public void testGetSpecificNodeStatus() {
final LookupCoordinatorManager lookupCoordinatorManager = EasyMock.createStrictMock(LookupCoordinatorManager.class);
EasyMock.expect(lookupCoordinatorManager.getLastKnownLookupsStateOnNodes()).andReturn(NODES_LOOKUP_STATE);
EasyMock.replay(lookupCoordinatorManager);
final LookupCoordinatorResource lookupCoordinatorResource = new LookupCoordinatorResource(lookupCoordinatorManager, MAPPER, MAPPER);
final Response response = lookupCoordinatorResource.getSpecificNodeStatus(LOOKUP_TIER, LOOKUP_NODE);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals(LOOKUP_STATE, response.getEntity());
EasyMock.verify(lookupCoordinatorManager);
}
use of org.apache.druid.server.lookup.cache.LookupCoordinatorManager in project druid by druid-io.
the class LookupCoordinatorResourceTest method testGetLookupStatusForTier.
@Test
public void testGetLookupStatusForTier() {
final LookupCoordinatorManager lookupCoordinatorManager = EasyMock.createStrictMock(LookupCoordinatorManager.class);
EasyMock.expect(lookupCoordinatorManager.getKnownLookups()).andReturn(SINGLE_TIER_MAP);
EasyMock.expect(lookupCoordinatorManager.discoverNodesInTier(LOOKUP_TIER)).andReturn(ImmutableList.of(LOOKUP_NODE));
EasyMock.expect(lookupCoordinatorManager.getLastKnownLookupsStateOnNodes()).andReturn(NODES_LOOKUP_STATE);
EasyMock.replay(lookupCoordinatorManager);
final LookupCoordinatorResource lookupCoordinatorResource = new LookupCoordinatorResource(lookupCoordinatorManager, MAPPER, MAPPER);
final Response response = lookupCoordinatorResource.getLookupStatusForTier(LOOKUP_TIER, false);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals(ImmutableMap.of(LOOKUP_NAME, new LookupCoordinatorResource.LookupStatus(true, null)), response.getEntity());
EasyMock.verify(lookupCoordinatorManager);
}
Aggregations