mirror of https://github.com/apache/druid.git
Add checkstyle for "Local variable names shouldn't start with capital" (#7681)
* Add checkstyle for "Local variable names shouldn't start with capital" * Adjust some local variables to constants * Replace StringUtils.LINE_SEPARATOR with System.lineSeparator()
This commit is contained in:
parent
eff2be4f8f
commit
26fad7e06a
|
@ -81,9 +81,9 @@ public class VSizeSerdeBenchmark
|
|||
File base = new File(this.getClass().getClassLoader().getResource("").toURI());
|
||||
dummy = new File(base, "dummy");
|
||||
try (Writer writer = Files.newBufferedWriter(dummy.toPath(), StandardCharsets.UTF_8)) {
|
||||
String EMPTY_STRING = " ";
|
||||
String emptyStr = " ";
|
||||
for (int i = 0; i < values + 10; i++) {
|
||||
writer.write(EMPTY_STRING);
|
||||
writer.write(emptyStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -311,5 +311,13 @@ codestyle/checkstyle.xml. "/>
|
|||
<module name="MethodName">
|
||||
<property name = "format" value = "^[a-z_]*[a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
</module>
|
||||
|
||||
<!-- Added as per the issue #7609 - Local variable names shouldn't start with capital -->
|
||||
<module name="LocalVariableName">
|
||||
<property name="format" value="^[a-z_]*[a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
</module>
|
||||
<module name="LocalFinalVariableName">
|
||||
<property name="format" value="^[a-z_]*[a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
</module>
|
||||
</module>
|
||||
</module>
|
||||
|
|
|
@ -51,7 +51,7 @@ public class TimestampSpecTest
|
|||
@Test
|
||||
public void testContextualTimestampList()
|
||||
{
|
||||
String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
|
||||
String dateFormat = "yyyy-MM-dd'T'HH:mm:ss";
|
||||
String[] dates = new String[]{
|
||||
"2000-01-01T05:00:00",
|
||||
"2000-01-01T05:00:01",
|
||||
|
@ -59,7 +59,7 @@ public class TimestampSpecTest
|
|||
"2000-01-01T05:00:02",
|
||||
"2000-01-01T05:00:03",
|
||||
};
|
||||
TimestampSpec spec = new TimestampSpec("TIMEstamp", DATE_FORMAT, null);
|
||||
TimestampSpec spec = new TimestampSpec("TIMEstamp", dateFormat, null);
|
||||
|
||||
DateTimes.UtcFormatter formatter = DateTimes.wrapFormatter(ISODateTimeFormat.dateHourMinuteSecond());
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ public class TwitterSpritzerFirehoseFactory implements FirehoseFactory<InputRowP
|
|||
{
|
||||
private static final Logger log = new Logger(TwitterSpritzerFirehoseFactory.class);
|
||||
private static final Pattern sourcePattern = Pattern.compile("<a[^>]*>(.*?)</a>", Pattern.CASE_INSENSITIVE);
|
||||
private static final int DEFAULT_QUEUE_SIZE = 2000;
|
||||
|
||||
/**
|
||||
* max events to receive, -1 is infinite, 0 means nothing is delivered; use this to prevent
|
||||
|
@ -140,9 +141,8 @@ public class TwitterSpritzerFirehoseFactory implements FirehoseFactory<InputRowP
|
|||
|
||||
final TwitterStream twitterStream;
|
||||
final StatusListener statusListener;
|
||||
final int QUEUE_SIZE = 2000;
|
||||
/** This queue is used to move twitter events from the twitter4j thread to the druid ingest thread. */
|
||||
final BlockingQueue<Status> queue = new ArrayBlockingQueue<Status>(QUEUE_SIZE);
|
||||
final BlockingQueue<Status> queue = new ArrayBlockingQueue<Status>(DEFAULT_QUEUE_SIZE);
|
||||
final long startMsec = System.currentTimeMillis();
|
||||
|
||||
//
|
||||
|
|
|
@ -55,6 +55,7 @@ public class AmbariMetricsEmitter extends AbstractTimelineMetricsSink implements
|
|||
private final AmbariMetricsEmitterConfig config;
|
||||
private final String collectorURI;
|
||||
private static final long DEFAULT_FLUSH_TIMEOUT_MILLIS = 60000; // default flush wait 1 min
|
||||
private static final Pattern DOT_OR_WHITESPACE_PATTERN = Pattern.compile("[\\s]+|[.]+");
|
||||
private final ScheduledExecutorService exec = Executors.newScheduledThreadPool(
|
||||
2, // Thread pool of two in order to schedule flush runnable
|
||||
new ThreadFactoryBuilder().setDaemon(true).setNameFormat("AmbariMetricsEmitter-%s").build()
|
||||
|
@ -230,7 +231,6 @@ public class AmbariMetricsEmitter extends AbstractTimelineMetricsSink implements
|
|||
|
||||
protected static String sanitize(String namespace)
|
||||
{
|
||||
Pattern DOT_OR_WHITESPACE = Pattern.compile("[\\s]+|[.]+");
|
||||
return DOT_OR_WHITESPACE.matcher(namespace).replaceAll("_");
|
||||
return DOT_OR_WHITESPACE_PATTERN.matcher(namespace).replaceAll("_");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public class GraphiteEmitter implements Emitter
|
|||
private final AtomicBoolean started = new AtomicBoolean(false);
|
||||
private final LinkedBlockingQueue<GraphiteEvent> eventsQueue;
|
||||
private static final long FLUSH_TIMEOUT_MILLIS = TimeUnit.MINUTES.toMillis(1); // default flush wait 1 min
|
||||
private static final Pattern DOT_OR_WHITESPACE_PATTERN = Pattern.compile("[\\s]+|[.]+");
|
||||
private final ScheduledExecutorService exec = Executors.newScheduledThreadPool(2, new ThreadFactoryBuilder()
|
||||
.setDaemon(true)
|
||||
.setNameFormat("GraphiteEmitter-%s")
|
||||
|
@ -249,8 +250,7 @@ public class GraphiteEmitter implements Emitter
|
|||
|
||||
protected static String sanitize(String namespace, Boolean replaceSlashToDot)
|
||||
{
|
||||
Pattern DOT_OR_WHITESPACE = Pattern.compile("[\\s]+|[.]+");
|
||||
String sanitizedNamespace = DOT_OR_WHITESPACE.matcher(namespace).replaceAll("_");
|
||||
String sanitizedNamespace = DOT_OR_WHITESPACE_PATTERN.matcher(namespace).replaceAll("_");
|
||||
if (replaceSlashToDot) {
|
||||
sanitizedNamespace = sanitizedNamespace.replace('/', '.');
|
||||
}
|
||||
|
|
|
@ -1253,11 +1253,11 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
verifyAll();
|
||||
|
||||
for (Task task : secondTasks.getValues()) {
|
||||
KinesisIndexTask KinesisIndexTask = (KinesisIndexTask) task;
|
||||
Assert.assertEquals(dataSchema, KinesisIndexTask.getDataSchema());
|
||||
Assert.assertEquals(tuningConfig.convertToTaskTuningConfig(), KinesisIndexTask.getTuningConfig());
|
||||
KinesisIndexTask kinesisIndexTask = (KinesisIndexTask) task;
|
||||
Assert.assertEquals(dataSchema, kinesisIndexTask.getDataSchema());
|
||||
Assert.assertEquals(tuningConfig.convertToTaskTuningConfig(), kinesisIndexTask.getTuningConfig());
|
||||
|
||||
KinesisIndexTaskIOConfig taskConfig = KinesisIndexTask.getIOConfig();
|
||||
KinesisIndexTaskIOConfig taskConfig = kinesisIndexTask.getIOConfig();
|
||||
Assert.assertEquals("sequenceName-1", taskConfig.getBaseSequenceName());
|
||||
Assert.assertTrue("isUseTransaction", taskConfig.isUseTransaction());
|
||||
|
||||
|
@ -3709,7 +3709,7 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
boolean suspended
|
||||
)
|
||||
{
|
||||
KinesisSupervisorIOConfig KinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(
|
||||
KinesisSupervisorIOConfig kinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(
|
||||
stream,
|
||||
"awsEndpoint",
|
||||
null,
|
||||
|
@ -3759,7 +3759,7 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
new KinesisSupervisorSpec(
|
||||
dataSchema,
|
||||
tuningConfig,
|
||||
KinesisSupervisorIOConfig,
|
||||
kinesisSupervisorIOConfig,
|
||||
null,
|
||||
suspended,
|
||||
taskStorage,
|
||||
|
@ -3810,7 +3810,7 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
Integer fetchDelayMillis
|
||||
)
|
||||
{
|
||||
KinesisSupervisorIOConfig KinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(
|
||||
KinesisSupervisorIOConfig kinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(
|
||||
stream,
|
||||
"awsEndpoint",
|
||||
null,
|
||||
|
@ -3860,7 +3860,7 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
new KinesisSupervisorSpec(
|
||||
dataSchema,
|
||||
tuningConfig,
|
||||
KinesisSupervisorIOConfig,
|
||||
kinesisSupervisorIOConfig,
|
||||
null,
|
||||
suspended,
|
||||
taskStorage,
|
||||
|
@ -3893,7 +3893,7 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
boolean isTaskCurrentReturn
|
||||
)
|
||||
{
|
||||
KinesisSupervisorIOConfig KinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(
|
||||
KinesisSupervisorIOConfig kinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(
|
||||
stream,
|
||||
"awsEndpoint",
|
||||
null,
|
||||
|
@ -3943,7 +3943,7 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
new KinesisSupervisorSpec(
|
||||
dataSchema,
|
||||
tuningConfig,
|
||||
KinesisSupervisorIOConfig,
|
||||
kinesisSupervisorIOConfig,
|
||||
null,
|
||||
suspended,
|
||||
taskStorage,
|
||||
|
@ -3978,7 +3978,7 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
KinesisSupervisorTuningConfig tuningConfig
|
||||
)
|
||||
{
|
||||
KinesisSupervisorIOConfig KinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(
|
||||
KinesisSupervisorIOConfig kinesisSupervisorIOConfig = new KinesisSupervisorIOConfig(
|
||||
stream,
|
||||
"awsEndpoint",
|
||||
null,
|
||||
|
@ -4028,7 +4028,7 @@ public class KinesisSupervisorTest extends EasyMockSupport
|
|||
new KinesisSupervisorSpec(
|
||||
dataSchema,
|
||||
tuningConfig,
|
||||
KinesisSupervisorIOConfig,
|
||||
kinesisSupervisorIOConfig,
|
||||
null,
|
||||
suspended,
|
||||
taskStorage,
|
||||
|
|
|
@ -53,7 +53,7 @@ public class HyperLogLogCollectorBenchmark extends SimpleBenchmark
|
|||
boolean alignSource;
|
||||
boolean alignTarget;
|
||||
|
||||
int CACHE_LINE = 64;
|
||||
int cacheLine = 64;
|
||||
|
||||
ByteBuffer chunk;
|
||||
final int count = 100_000;
|
||||
|
@ -83,8 +83,8 @@ public class HyperLogLogCollectorBenchmark extends SimpleBenchmark
|
|||
|
||||
int val = 0;
|
||||
chunk = ByteBuffers.allocateAlignedByteBuffer(
|
||||
(HyperLogLogCollector.getLatestNumBytesForDenseStorage() + CACHE_LINE
|
||||
+ CACHE_LINE) * count, CACHE_LINE
|
||||
(HyperLogLogCollector.getLatestNumBytesForDenseStorage() + cacheLine
|
||||
+ cacheLine) * count, cacheLine
|
||||
);
|
||||
|
||||
int pos = 0;
|
||||
|
@ -100,8 +100,8 @@ public class HyperLogLogCollectorBenchmark extends SimpleBenchmark
|
|||
|
||||
final int offset = random ? (int) (rand.nextDouble() * 64) : defaultOffset;
|
||||
|
||||
if (alignSource && (pos % CACHE_LINE) != offset) {
|
||||
pos += (pos % CACHE_LINE) < offset ? offset - (pos % CACHE_LINE) : (CACHE_LINE + offset - pos % CACHE_LINE);
|
||||
if (alignSource && (pos % cacheLine) != offset) {
|
||||
pos += (pos % cacheLine) < offset ? offset - (pos % cacheLine) : (cacheLine + offset - pos % cacheLine);
|
||||
}
|
||||
|
||||
positions[i] = pos;
|
||||
|
@ -123,11 +123,11 @@ public class HyperLogLogCollectorBenchmark extends SimpleBenchmark
|
|||
private ByteBuffer allocateEmptyHLLBuffer(boolean direct, boolean aligned, int offset)
|
||||
{
|
||||
final int size = HyperLogLogCollector.getLatestNumBytesForDenseStorage();
|
||||
final byte[] EMPTY_BYTES = HyperLogLogCollector.makeEmptyVersionedByteArray();
|
||||
final byte[] emptyBytes = HyperLogLogCollector.makeEmptyVersionedByteArray();
|
||||
final ByteBuffer buf;
|
||||
if (direct) {
|
||||
if (aligned) {
|
||||
buf = ByteBuffers.allocateAlignedByteBuffer(size + offset, CACHE_LINE);
|
||||
buf = ByteBuffers.allocateAlignedByteBuffer(size + offset, cacheLine);
|
||||
buf.position(offset);
|
||||
buf.mark();
|
||||
buf.limit(size + offset);
|
||||
|
@ -137,12 +137,12 @@ public class HyperLogLogCollectorBenchmark extends SimpleBenchmark
|
|||
buf.limit(size);
|
||||
}
|
||||
|
||||
buf.put(EMPTY_BYTES);
|
||||
buf.put(emptyBytes);
|
||||
buf.reset();
|
||||
} else {
|
||||
buf = ByteBuffer.allocate(size);
|
||||
buf.limit(size);
|
||||
buf.put(EMPTY_BYTES);
|
||||
buf.put(emptyBytes);
|
||||
buf.rewind();
|
||||
}
|
||||
return buf;
|
||||
|
|
|
@ -138,7 +138,7 @@ public class EqualDistributionWorkerSelectStrategyTest
|
|||
@Test
|
||||
public void testOneDisableWorkerDifferentUsedCapacity()
|
||||
{
|
||||
String DISABLED_VERSION = "";
|
||||
String disabledVersion = "";
|
||||
final EqualDistributionWorkerSelectStrategy strategy = new EqualDistributionWorkerSelectStrategy(null);
|
||||
|
||||
ImmutableWorkerInfo worker = strategy.findWorkerForTask(
|
||||
|
@ -146,7 +146,7 @@ public class EqualDistributionWorkerSelectStrategyTest
|
|||
ImmutableMap.of(
|
||||
"lhost",
|
||||
new ImmutableWorkerInfo(
|
||||
new Worker("http", "disableHost", "disableHost", 10, DISABLED_VERSION), 2,
|
||||
new Worker("http", "disableHost", "disableHost", 10, disabledVersion), 2,
|
||||
new HashSet<>(),
|
||||
new HashSet<>(),
|
||||
DateTimes.nowUtc()
|
||||
|
@ -174,7 +174,7 @@ public class EqualDistributionWorkerSelectStrategyTest
|
|||
@Test
|
||||
public void testOneDisableWorkerSameUsedCapacity()
|
||||
{
|
||||
String DISABLED_VERSION = "";
|
||||
String disabledVersion = "";
|
||||
final EqualDistributionWorkerSelectStrategy strategy = new EqualDistributionWorkerSelectStrategy(null);
|
||||
|
||||
ImmutableWorkerInfo worker = strategy.findWorkerForTask(
|
||||
|
@ -182,7 +182,7 @@ public class EqualDistributionWorkerSelectStrategyTest
|
|||
ImmutableMap.of(
|
||||
"lhost",
|
||||
new ImmutableWorkerInfo(
|
||||
new Worker("http", "disableHost", "disableHost", 10, DISABLED_VERSION), 5,
|
||||
new Worker("http", "disableHost", "disableHost", 10, disabledVersion), 5,
|
||||
new HashSet<>(),
|
||||
new HashSet<>(),
|
||||
DateTimes.nowUtc()
|
||||
|
|
|
@ -242,12 +242,12 @@ public class PrioritizedExecutorServiceTest
|
|||
@Test
|
||||
public void testOrderedExecutionMultiplePriorityMix() throws ExecutionException, InterruptedException
|
||||
{
|
||||
final int DEFAULT = 0;
|
||||
final int MIN = -1;
|
||||
final int MAX = 1;
|
||||
exec = new PrioritizedExecutorService(exec.threadPoolExecutor, true, DEFAULT, config);
|
||||
final int _default = 0;
|
||||
final int min = -1;
|
||||
final int max = 1;
|
||||
exec = new PrioritizedExecutorService(exec.threadPoolExecutor, true, _default, config);
|
||||
final int numTasks = 999;
|
||||
final int[] priorities = new int[]{MAX, DEFAULT, MIN};
|
||||
final int[] priorities = new int[]{max, _default, min};
|
||||
final int tasksPerPriority = numTasks / priorities.length;
|
||||
final int[] priorityOffsets = new int[]{0, tasksPerPriority, tasksPerPriority * 2};
|
||||
final List<ListenableFuture<?>> futures = Lists.newArrayListWithExpectedSize(numTasks);
|
||||
|
|
|
@ -4330,11 +4330,11 @@ public class TopNQueryRunnerTest
|
|||
new TopNQueryConfig(),
|
||||
QueryRunnerTestHelper.noopIntervalChunkingQueryRunnerDecorator()
|
||||
);
|
||||
final QueryRunner<Result<TopNResultValue>> Runner = new FinalizeResultsQueryRunner(
|
||||
final QueryRunner<Result<TopNResultValue>> _runner = new FinalizeResultsQueryRunner(
|
||||
chest.mergeResults(chest.preMergeQueryDecoration(runner)),
|
||||
chest
|
||||
);
|
||||
return Runner.run(QueryPlus.wrap(query), context);
|
||||
return _runner.run(QueryPlus.wrap(query), context);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -134,18 +134,18 @@ public class StatusResource
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
final String NL = System.getProperty("line.separator");
|
||||
StringBuilder output = new StringBuilder();
|
||||
output.append(StringUtils.format("Druid version - %s", version)).append(NL).append(NL);
|
||||
String lineSeparator = System.lineSeparator();
|
||||
output.append(StringUtils.format("Druid version - %s", version)).append(lineSeparator).append(lineSeparator);
|
||||
|
||||
if (modules.size() > 0) {
|
||||
output.append("Registered Druid Modules").append(NL);
|
||||
output.append("Registered Druid Modules").append(lineSeparator);
|
||||
} else {
|
||||
output.append("No Druid Modules loaded !");
|
||||
}
|
||||
|
||||
for (ModuleVersion moduleVersion : modules) {
|
||||
output.append(moduleVersion).append(NL);
|
||||
output.append(moduleVersion).append(lineSeparator);
|
||||
}
|
||||
return output.toString();
|
||||
}
|
||||
|
|
|
@ -139,17 +139,17 @@ public class ServerDiscoverySelectorTest
|
|||
@Test
|
||||
public void testPickIPv6() throws Exception
|
||||
{
|
||||
final String ADDRESS = "2001:0db8:0000:0000:0000:ff00:0042:8329";
|
||||
final String address = "2001:0db8:0000:0000:0000:ff00:0042:8329";
|
||||
EasyMock.expect(serviceProvider.getInstance()).andReturn(instance).anyTimes();
|
||||
EasyMock.expect(instance.getAddress()).andReturn(ADDRESS).anyTimes();
|
||||
EasyMock.expect(instance.getAddress()).andReturn(address).anyTimes();
|
||||
EasyMock.expect(instance.getPort()).andReturn(PORT).anyTimes();
|
||||
EasyMock.expect(instance.getSslPort()).andReturn(-1).anyTimes();
|
||||
EasyMock.replay(instance, serviceProvider);
|
||||
Server server = serverDiscoverySelector.pick();
|
||||
Assert.assertEquals(PORT, server.getPort());
|
||||
Assert.assertEquals(ADDRESS, server.getAddress());
|
||||
Assert.assertEquals(address, server.getAddress());
|
||||
Assert.assertTrue(server.getHost().contains(Integer.toString(PORT)));
|
||||
Assert.assertTrue(server.getHost().contains(ADDRESS));
|
||||
Assert.assertTrue(server.getHost().contains(address));
|
||||
Assert.assertEquals("http", server.getScheme());
|
||||
EasyMock.verify(instance, serviceProvider);
|
||||
final URI uri = new URI(
|
||||
|
@ -162,7 +162,7 @@ public class ServerDiscoverySelectorTest
|
|||
null
|
||||
);
|
||||
Assert.assertEquals(PORT, uri.getPort());
|
||||
Assert.assertEquals(StringUtils.format("[%s]", ADDRESS), uri.getHost());
|
||||
Assert.assertEquals(StringUtils.format("[%s]", address), uri.getHost());
|
||||
Assert.assertEquals("http", uri.getScheme());
|
||||
}
|
||||
|
||||
|
@ -170,17 +170,17 @@ public class ServerDiscoverySelectorTest
|
|||
@Test
|
||||
public void testPickIPv6Bracket() throws Exception
|
||||
{
|
||||
final String ADDRESS = "[2001:0db8:0000:0000:0000:ff00:0042:8329]";
|
||||
final String address = "[2001:0db8:0000:0000:0000:ff00:0042:8329]";
|
||||
EasyMock.expect(serviceProvider.getInstance()).andReturn(instance).anyTimes();
|
||||
EasyMock.expect(instance.getAddress()).andReturn(ADDRESS).anyTimes();
|
||||
EasyMock.expect(instance.getAddress()).andReturn(address).anyTimes();
|
||||
EasyMock.expect(instance.getPort()).andReturn(PORT).anyTimes();
|
||||
EasyMock.expect(instance.getSslPort()).andReturn(-1).anyTimes();
|
||||
EasyMock.replay(instance, serviceProvider);
|
||||
Server server = serverDiscoverySelector.pick();
|
||||
Assert.assertEquals(PORT, server.getPort());
|
||||
Assert.assertEquals(ADDRESS, server.getAddress());
|
||||
Assert.assertEquals(address, server.getAddress());
|
||||
Assert.assertTrue(server.getHost().contains(Integer.toString(PORT)));
|
||||
Assert.assertTrue(server.getHost().contains(ADDRESS));
|
||||
Assert.assertTrue(server.getHost().contains(address));
|
||||
Assert.assertEquals("http", server.getScheme());
|
||||
EasyMock.verify(instance, serviceProvider);
|
||||
final URI uri = new URI(
|
||||
|
@ -193,7 +193,7 @@ public class ServerDiscoverySelectorTest
|
|||
null
|
||||
);
|
||||
Assert.assertEquals(PORT, uri.getPort());
|
||||
Assert.assertEquals(ADDRESS, uri.getHost());
|
||||
Assert.assertEquals(address, uri.getHost());
|
||||
Assert.assertEquals("http", uri.getScheme());
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expectLastCall().times(1);
|
||||
|
||||
EasyMock.replay(inventoryView, server, request);
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
null,
|
||||
null,
|
||||
|
@ -178,7 +178,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
AuthTestUtils.TEST_AUTHORIZER_MAPPER
|
||||
);
|
||||
Response response = DataSourcesResource.getQueryableDataSources("full", null, request);
|
||||
Response response = dataSourcesResource.getQueryableDataSources("full", null, request);
|
||||
Set<ImmutableDruidDataSource> result = (Set<ImmutableDruidDataSource>) response.getEntity();
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
Assert.assertEquals(2, result.size());
|
||||
|
@ -187,7 +187,7 @@ public class DataSourcesResourceTest
|
|||
new HashSet<>(result)
|
||||
);
|
||||
|
||||
response = DataSourcesResource.getQueryableDataSources(null, null, request);
|
||||
response = dataSourcesResource.getQueryableDataSources(null, null, request);
|
||||
List<String> result1 = (List<String>) response.getEntity();
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
Assert.assertEquals(2, result1.size());
|
||||
|
@ -255,7 +255,7 @@ public class DataSourcesResourceTest
|
|||
}
|
||||
};
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
null,
|
||||
null,
|
||||
|
@ -263,7 +263,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
authMapper
|
||||
);
|
||||
Response response = DataSourcesResource.getQueryableDataSources("full", null, request);
|
||||
Response response = dataSourcesResource.getQueryableDataSources("full", null, request);
|
||||
Set<ImmutableDruidDataSource> result = (Set<ImmutableDruidDataSource>) response.getEntity();
|
||||
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
|
@ -275,7 +275,7 @@ public class DataSourcesResourceTest
|
|||
new HashSet<>(result)
|
||||
);
|
||||
|
||||
response = DataSourcesResource.getQueryableDataSources(null, null, request);
|
||||
response = dataSourcesResource.getQueryableDataSources(null, null, request);
|
||||
List<String> result1 = (List<String>) response.getEntity();
|
||||
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
|
@ -302,7 +302,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expectLastCall().times(1);
|
||||
|
||||
EasyMock.replay(inventoryView, server, request);
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
null,
|
||||
null,
|
||||
|
@ -310,7 +310,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
AuthTestUtils.TEST_AUTHORIZER_MAPPER
|
||||
);
|
||||
Response response = DataSourcesResource.getQueryableDataSources(null, "simple", request);
|
||||
Response response = dataSourcesResource.getQueryableDataSources(null, "simple", request);
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
List<Map<String, Object>> results = (List<Map<String, Object>>) response.getEntity();
|
||||
int index = 0;
|
||||
|
@ -332,9 +332,9 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expect(inventoryView.getInventory()).andReturn(ImmutableList.of(server)).atLeastOnce();
|
||||
|
||||
EasyMock.replay(inventoryView, server);
|
||||
DataSourcesResource DataSourcesResource =
|
||||
DataSourcesResource dataSourcesResource =
|
||||
new DataSourcesResource(inventoryView, null, null, null, new AuthConfig(), null);
|
||||
Response response = DataSourcesResource.getTheDataSource("datasource1", "full");
|
||||
Response response = dataSourcesResource.getTheDataSource("datasource1", "full");
|
||||
ImmutableDruidDataSource result = (ImmutableDruidDataSource) response.getEntity();
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
Assert.assertEquals(dataSource1.toImmutableDruidDataSource(), result);
|
||||
|
@ -348,9 +348,9 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expect(inventoryView.getInventory()).andReturn(ImmutableList.of(server)).atLeastOnce();
|
||||
|
||||
EasyMock.replay(inventoryView, server);
|
||||
DataSourcesResource DataSourcesResource =
|
||||
DataSourcesResource dataSourcesResource =
|
||||
new DataSourcesResource(inventoryView, null, null, null, new AuthConfig(), null);
|
||||
Assert.assertEquals(204, DataSourcesResource.getTheDataSource("none", null).getStatus());
|
||||
Assert.assertEquals(204, dataSourcesResource.getTheDataSource("none", null).getStatus());
|
||||
EasyMock.verify(inventoryView, server);
|
||||
}
|
||||
|
||||
|
@ -366,9 +366,9 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expect(inventoryView.getInventory()).andReturn(ImmutableList.of(server)).atLeastOnce();
|
||||
|
||||
EasyMock.replay(inventoryView, server);
|
||||
DataSourcesResource DataSourcesResource =
|
||||
DataSourcesResource dataSourcesResource =
|
||||
new DataSourcesResource(inventoryView, null, null, null, new AuthConfig(), null);
|
||||
Response response = DataSourcesResource.getTheDataSource("datasource1", null);
|
||||
Response response = dataSourcesResource.getTheDataSource("datasource1", null);
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
Map<String, Map<String, Object>> result = (Map<String, Map<String, Object>>) response.getEntity();
|
||||
Assert.assertEquals(1, ((Map) (result.get("tiers").get(null))).get("segmentCount"));
|
||||
|
@ -406,9 +406,9 @@ public class DataSourcesResourceTest
|
|||
).atLeastOnce();
|
||||
|
||||
EasyMock.replay(inventoryView, server, server2, server3);
|
||||
DataSourcesResource DataSourcesResource =
|
||||
DataSourcesResource dataSourcesResource =
|
||||
new DataSourcesResource(inventoryView, null, null, null, new AuthConfig(), null);
|
||||
Response response = DataSourcesResource.getTheDataSource("datasource1", null);
|
||||
Response response = dataSourcesResource.getTheDataSource("datasource1", null);
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
Map<String, Map<String, Object>> result = (Map<String, Map<String, Object>>) response.getEntity();
|
||||
Assert.assertEquals(2, ((Map) (result.get("tiers").get("cold"))).get("segmentCount"));
|
||||
|
@ -552,7 +552,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expectLastCall().once();
|
||||
EasyMock.replay(indexingServiceClient, server);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
null,
|
||||
null,
|
||||
|
@ -560,7 +560,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
null
|
||||
);
|
||||
Response response = DataSourcesResource.deleteDataSourceSpecificInterval("datasource1", interval);
|
||||
Response response = dataSourcesResource.deleteDataSourceSpecificInterval("datasource1", interval);
|
||||
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
Assert.assertEquals(null, response.getEntity());
|
||||
|
@ -572,7 +572,7 @@ public class DataSourcesResourceTest
|
|||
{
|
||||
IndexingServiceClient indexingServiceClient = EasyMock.createStrictMock(IndexingServiceClient.class);
|
||||
EasyMock.replay(indexingServiceClient, server);
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
null,
|
||||
null,
|
||||
|
@ -580,7 +580,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
null
|
||||
);
|
||||
Response response = DataSourcesResource.deleteDataSource("datasource", "true", "???");
|
||||
Response response = dataSourcesResource.deleteDataSource("datasource", "true", "???");
|
||||
Assert.assertEquals(400, response.getStatus());
|
||||
Assert.assertNotNull(response.getEntity());
|
||||
Assert.assertTrue(response.getEntity().toString().contains("java.lang.IllegalArgumentException"));
|
||||
|
@ -594,7 +594,7 @@ public class DataSourcesResourceTest
|
|||
MetadataRuleManager databaseRuleManager = EasyMock.createMock(MetadataRuleManager.class);
|
||||
Rule loadRule = new IntervalLoadRule(Intervals.of("2013-01-02T00:00:00Z/2013-01-03T00:00:00Z"), null);
|
||||
Rule dropRule = new IntervalDropRule(Intervals.of("2013-01-01T00:00:00Z/2013-01-02T00:00:00Z"));
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
null,
|
||||
databaseRuleManager,
|
||||
|
@ -610,7 +610,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.replay(databaseRuleManager);
|
||||
|
||||
String interval1 = "2013-01-01T01:00:00Z/2013-01-01T02:00:00Z";
|
||||
Response response1 = DataSourcesResource.isHandOffComplete("dataSource1", interval1, 1, "v1");
|
||||
Response response1 = dataSourcesResource.isHandOffComplete("dataSource1", interval1, 1, "v1");
|
||||
Assert.assertTrue((boolean) response1.getEntity());
|
||||
|
||||
EasyMock.verify(databaseRuleManager);
|
||||
|
@ -626,7 +626,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.replay(inventoryView, databaseRuleManager);
|
||||
|
||||
String interval2 = "2013-01-02T01:00:00Z/2013-01-02T02:00:00Z";
|
||||
Response response2 = DataSourcesResource.isHandOffComplete("dataSource1", interval2, 1, "v1");
|
||||
Response response2 = dataSourcesResource.isHandOffComplete("dataSource1", interval2, 1, "v1");
|
||||
Assert.assertFalse((boolean) response2.getEntity());
|
||||
|
||||
EasyMock.verify(inventoryView, databaseRuleManager);
|
||||
|
@ -660,7 +660,7 @@ public class DataSourcesResourceTest
|
|||
.once();
|
||||
EasyMock.replay(inventoryView, databaseRuleManager);
|
||||
|
||||
Response response3 = DataSourcesResource.isHandOffComplete("dataSource1", interval3, 1, "v1");
|
||||
Response response3 = dataSourcesResource.isHandOffComplete("dataSource1", interval3, 1, "v1");
|
||||
Assert.assertTrue((boolean) response3.getEntity());
|
||||
|
||||
EasyMock.verify(inventoryView, databaseRuleManager);
|
||||
|
@ -675,7 +675,7 @@ public class DataSourcesResourceTest
|
|||
.once();
|
||||
EasyMock.replay(metadataSegmentManager);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
null,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -684,7 +684,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegment(dataSegmentList.get(0).getDataSource(), dataSegmentList.get(0).getId().toString());
|
||||
Response response = dataSourcesResource.enableDatasourceSegment(dataSegmentList.get(0).getDataSource(), dataSegmentList.get(0).getId().toString());
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
EasyMock.verify(metadataSegmentManager);
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ public class DataSourcesResourceTest
|
|||
.once();
|
||||
EasyMock.replay(metadataSegmentManager);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
null,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -707,7 +707,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegment(dataSegmentList.get(0).getDataSource(), dataSegmentList.get(0).getId().toString());
|
||||
Response response = dataSourcesResource.enableDatasourceSegment(dataSegmentList.get(0).getDataSource(), dataSegmentList.get(0).getId().toString());
|
||||
Assert.assertEquals(204, response.getStatus());
|
||||
EasyMock.verify(metadataSegmentManager);
|
||||
}
|
||||
|
@ -725,7 +725,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expect(server.getDataSource("datasource1")).andReturn(dataSource).once();
|
||||
EasyMock.replay(metadataSegmentManager, inventoryView, server);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -734,7 +734,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
new DataSourcesResource.MarkDatasourceSegmentsPayload(
|
||||
interval,
|
||||
|
@ -758,7 +758,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expect(server.getDataSource("datasource1")).andReturn(dataSource).once();
|
||||
EasyMock.replay(metadataSegmentManager, inventoryView, server);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -767,7 +767,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
new DataSourcesResource.MarkDatasourceSegmentsPayload(
|
||||
interval,
|
||||
|
@ -791,7 +791,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expect(server.getDataSource("datasource1")).andReturn(dataSource).once();
|
||||
EasyMock.replay(metadataSegmentManager, inventoryView, server);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -800,7 +800,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
new DataSourcesResource.MarkDatasourceSegmentsPayload(
|
||||
null,
|
||||
|
@ -824,7 +824,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expect(server.getDataSource("datasource1")).andReturn(dataSource).once();
|
||||
EasyMock.replay(metadataSegmentManager, inventoryView, server);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -833,7 +833,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
new DataSourcesResource.MarkDatasourceSegmentsPayload(
|
||||
interval,
|
||||
|
@ -852,7 +852,7 @@ public class DataSourcesResourceTest
|
|||
EasyMock.expect(server.getDataSource("datasource1")).andReturn(null).once();
|
||||
EasyMock.replay(metadataSegmentManager, inventoryView, server);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -861,7 +861,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
new DataSourcesResource.MarkDatasourceSegmentsPayload(
|
||||
Intervals.of("2010-01-22/P1D"),
|
||||
|
@ -877,7 +877,7 @@ public class DataSourcesResourceTest
|
|||
{
|
||||
MetadataSegmentManager metadataSegmentManager = EasyMock.createMock(MetadataSegmentManager.class);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -886,7 +886,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
new DataSourcesResource.MarkDatasourceSegmentsPayload(
|
||||
null,
|
||||
|
@ -901,7 +901,7 @@ public class DataSourcesResourceTest
|
|||
{
|
||||
MetadataSegmentManager metadataSegmentManager = EasyMock.createMock(MetadataSegmentManager.class);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -910,7 +910,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
new DataSourcesResource.MarkDatasourceSegmentsPayload(
|
||||
Intervals.of("2010-01-22/P1D"),
|
||||
|
@ -925,7 +925,7 @@ public class DataSourcesResourceTest
|
|||
{
|
||||
MetadataSegmentManager metadataSegmentManager = EasyMock.createMock(MetadataSegmentManager.class);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -934,7 +934,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
new DataSourcesResource.MarkDatasourceSegmentsPayload(
|
||||
null,
|
||||
|
@ -949,7 +949,7 @@ public class DataSourcesResourceTest
|
|||
{
|
||||
MetadataSegmentManager metadataSegmentManager = EasyMock.createMock(MetadataSegmentManager.class);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
metadataSegmentManager,
|
||||
null,
|
||||
|
@ -958,7 +958,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.enableDatasourceSegments(
|
||||
Response response = dataSourcesResource.enableDatasourceSegments(
|
||||
"datasource1",
|
||||
null
|
||||
);
|
||||
|
@ -1120,7 +1120,7 @@ public class DataSourcesResourceTest
|
|||
segmentIds
|
||||
);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1128,7 +1128,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
null
|
||||
);
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
Assert.assertEquals(null, response.getEntity());
|
||||
EasyMock.verify(segmentManager, inventoryView, server);
|
||||
|
@ -1153,7 +1153,7 @@ public class DataSourcesResourceTest
|
|||
segmentIds
|
||||
);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1161,7 +1161,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
null
|
||||
);
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(204, response.getStatus());
|
||||
Assert.assertEquals(null, response.getEntity());
|
||||
EasyMock.verify(segmentManager, inventoryView, server);
|
||||
|
@ -1188,7 +1188,7 @@ public class DataSourcesResourceTest
|
|||
segmentIds
|
||||
);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1196,7 +1196,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
null
|
||||
);
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(500, response.getStatus());
|
||||
Assert.assertNotNull(response.getEntity());
|
||||
EasyMock.verify(segmentManager, inventoryView, server);
|
||||
|
@ -1219,7 +1219,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1227,7 +1227,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
null
|
||||
);
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(200, response.getStatus());
|
||||
Assert.assertEquals(null, response.getEntity());
|
||||
EasyMock.verify(segmentManager, inventoryView, server);
|
||||
|
@ -1251,7 +1251,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1259,7 +1259,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
null
|
||||
);
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(204, response.getStatus());
|
||||
Assert.assertEquals(null, response.getEntity());
|
||||
EasyMock.verify(segmentManager, inventoryView, server);
|
||||
|
@ -1284,7 +1284,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1292,7 +1292,7 @@ public class DataSourcesResourceTest
|
|||
new AuthConfig(),
|
||||
null
|
||||
);
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(500, response.getStatus());
|
||||
Assert.assertNotNull(response.getEntity());
|
||||
EasyMock.verify(segmentManager, inventoryView, server);
|
||||
|
@ -1302,7 +1302,7 @@ public class DataSourcesResourceTest
|
|||
public void testMarkDatasourceUnusedNullPayload()
|
||||
{
|
||||
final MetadataSegmentManager segmentManager = EasyMock.createMock(MetadataSegmentManager.class);
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1313,7 +1313,7 @@ public class DataSourcesResourceTest
|
|||
|
||||
final DataSourcesResource.MarkDatasourceSegmentsPayload payload = null;
|
||||
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(400, response.getStatus());
|
||||
Assert.assertNotNull(response.getEntity());
|
||||
Assert.assertEquals(
|
||||
|
@ -1326,7 +1326,7 @@ public class DataSourcesResourceTest
|
|||
public void testMarkDatasourceUnusedInvalidPayload()
|
||||
{
|
||||
final MetadataSegmentManager segmentManager = EasyMock.createMock(MetadataSegmentManager.class);
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1340,7 +1340,7 @@ public class DataSourcesResourceTest
|
|||
null
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(400, response.getStatus());
|
||||
Assert.assertNotNull(response.getEntity());
|
||||
}
|
||||
|
@ -1349,7 +1349,7 @@ public class DataSourcesResourceTest
|
|||
public void testMarkDatasourceUnusedInvalidPayloadBothArguments()
|
||||
{
|
||||
final MetadataSegmentManager segmentManager = EasyMock.createMock(MetadataSegmentManager.class);
|
||||
DataSourcesResource DataSourcesResource = new DataSourcesResource(
|
||||
DataSourcesResource dataSourcesResource = new DataSourcesResource(
|
||||
inventoryView,
|
||||
segmentManager,
|
||||
null,
|
||||
|
@ -1363,7 +1363,7 @@ public class DataSourcesResourceTest
|
|||
ImmutableSet.of()
|
||||
);
|
||||
|
||||
Response response = DataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Response response = dataSourcesResource.markDatasourceUnused("datasource1", payload);
|
||||
Assert.assertEquals(400, response.getStatus());
|
||||
Assert.assertNotNull(response.getEntity());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue