Skip to content

Commit 9feb931

Browse files
Merge pull request #58 from jaydeepkumar1984/trunk_cep_37_cassandra_20531_1
parens in next line for three Test files
2 parents e5b622a + 9f6e69b commit 9feb931

3 files changed

Lines changed: 59 additions & 41 deletions

File tree

test/unit/org/apache/cassandra/repair/autorepair/AutoRepairStateTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ public void testGetLongestUnrepairedSecNull()
185185
try
186186
{
187187
assertEquals(0, state.getLongestUnrepairedSec());
188-
} catch (Exception e) {
188+
}
189+
catch (Exception e)
190+
{
189191
assertNull(e);
190192
}
191193
}
@@ -201,7 +203,9 @@ public void testGetLongestUnrepairedSec()
201203
try
202204
{
203205
assertEquals(1, state.getLongestUnrepairedSec());
204-
} catch (Exception e) {
206+
}
207+
catch (Exception e)
208+
{
205209
assertNull(e);
206210
}
207211
}

test/unit/org/apache/cassandra/service/ActiveRepairServiceTest.java

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
* Licensed to the Apache Software Foundation (ASF) under one
3-
* or more contributor license agreements. See the NOTICE file
4-
* distributed with this work for additional information
5-
* regarding copyright ownership. The ASF licenses this file
6-
* to you under the Apache License, Version 2.0 (the
7-
* "License"); you may not use this file except in compliance
8-
* with the License. You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing,
13-
* software distributed under the License is distributed on an
14-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15-
* KIND, either express or implied. See the License for the
16-
* specific language governing permissions and limitations
17-
* under the License.
18-
*/
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
1919
package org.apache.cassandra.service;
2020

2121
import java.net.UnknownHostException;
@@ -40,6 +40,7 @@
4040
import org.apache.cassandra.service.disk.usage.DiskUsageMonitor;
4141
import org.apache.cassandra.utils.TimeUUID;
4242
import org.apache.cassandra.utils.concurrent.Condition;
43+
4344
import org.junit.Assert;
4445
import org.junit.Before;
4546
import org.junit.BeforeClass;
@@ -229,12 +230,12 @@ public void testGetNeighborsTimesTwoInSpecifiedHosts() throws Throwable
229230
}
230231

231232
expected.remove(FBUtilities.getBroadcastAddressAndPort());
232-
Collection<String> hosts = Arrays.asList(FBUtilities.getBroadcastAddressAndPort().getHostAddressAndPort(),expected.get(0).getHostAddressAndPort());
233+
Collection<String> hosts = Arrays.asList(FBUtilities.getBroadcastAddressAndPort().getHostAddressAndPort(), expected.get(0).getHostAddressAndPort());
233234
Iterable<Range<Token>> ranges = StorageService.instance.getLocalReplicas(KEYSPACE5).ranges();
234235

235236
assertEquals(expected.get(0), ActiveRepairService.instance().getNeighbors(KEYSPACE5, ranges,
236-
ranges.iterator().next(),
237-
null, hosts).endpoints().iterator().next());
237+
ranges.iterator().next(),
238+
null, hosts).endpoints().iterator().next());
238239
}
239240

240241
@Test(expected = IllegalArgumentException.class)
@@ -264,7 +265,6 @@ public void testParentRepairStatus() throws Throwable
264265
List<String> failed = StorageService.instance.getParentRepairStatus(3);
265266
assertNotNull(failed);
266267
assertEquals(ActiveRepairService.ParentRepairStatus.FAILED, ActiveRepairService.ParentRepairStatus.valueOf(failed.get(0)));
267-
268268
}
269269

270270
Set<InetAddressAndPort> addTokens(int max) throws Throwable
@@ -339,10 +339,10 @@ private static RepairOption opts(String... params)
339339
{
340340
assert params.length % 2 == 0 : "unbalanced key value pairs";
341341
Map<String, String> opt = new HashMap<>();
342-
for (int i=0; i<(params.length >> 1); i++)
342+
for (int i = 0; i < (params.length >> 1); i++)
343343
{
344344
int idx = i << 1;
345-
opt.put(params[idx], params[idx+1]);
345+
opt.put(params[idx], params[idx + 1]);
346346
}
347347
return RepairOption.parse(opt, DatabaseDescriptor.getPartitioner());
348348
}
@@ -362,19 +362,19 @@ public void repairedAt() throws Exception
362362
Assert.assertNotEquals(UNREPAIRED_SSTABLE, ActiveRepairService.instance().getRepairedAt(opts(INCREMENTAL_KEY, b2s(true)), false));
363363
// subrange incremental repair
364364
Assert.assertNotEquals(UNREPAIRED_SSTABLE, ActiveRepairService.instance().getRepairedAt(opts(INCREMENTAL_KEY, b2s(true),
365-
RANGES_KEY, "1:2"), false));
365+
RANGES_KEY, "1:2"), false));
366366

367367
// hosts incremental repair
368368
Assert.assertEquals(UNREPAIRED_SSTABLE, ActiveRepairService.instance().getRepairedAt(opts(INCREMENTAL_KEY, b2s(true),
369-
HOSTS_KEY, "127.0.0.1"), false));
369+
HOSTS_KEY, "127.0.0.1"), false));
370370
// dc incremental repair
371371
Assert.assertEquals(UNREPAIRED_SSTABLE, ActiveRepairService.instance().getRepairedAt(opts(INCREMENTAL_KEY, b2s(true),
372-
DATACENTERS_KEY, "DC2"), false));
372+
DATACENTERS_KEY, "DC2"), false));
373373
// forced incremental repair
374374
Assert.assertNotEquals(UNREPAIRED_SSTABLE, ActiveRepairService.instance().getRepairedAt(opts(INCREMENTAL_KEY, b2s(true),
375-
FORCE_REPAIR_KEY, b2s(true)), false));
375+
FORCE_REPAIR_KEY, b2s(true)), false));
376376
Assert.assertEquals(UNREPAIRED_SSTABLE, ActiveRepairService.instance().getRepairedAt(opts(INCREMENTAL_KEY, b2s(true),
377-
FORCE_REPAIR_KEY, b2s(true)), true));
377+
FORCE_REPAIR_KEY, b2s(true)), true));
378378

379379
// full repair
380380
Assert.assertEquals(UNREPAIRED_SSTABLE, ActiveRepairService.instance().getRepairedAt(opts(INCREMENTAL_KEY, b2s(false)), false));
@@ -420,7 +420,8 @@ public void testRejectWhenPoolFullStrategy() throws InterruptedException
420420

421421
// Submission is unblocked
422422
Thread.sleep(250);
423-
validationExecutor.submit(() -> {});
423+
validationExecutor.submit(() -> {
424+
});
424425
}
425426
finally
426427
{
@@ -457,8 +458,8 @@ public void testQueueWhenPoolFullStrategy() throws InterruptedException
457458
allSubmitted.await(TASK_SECONDS + 1, TimeUnit.SECONDS);
458459

459460
// Give the tasks we expect to execute immediately chance to be scheduled
460-
Util.spinAssertEquals(2 , ((ExecutorPlus) validationExecutor)::getActiveTaskCount, 1);
461-
Util.spinAssertEquals(3 , ((ExecutorPlus) validationExecutor)::getPendingTaskCount, 1);
461+
Util.spinAssertEquals(2, ((ExecutorPlus) validationExecutor)::getActiveTaskCount, 1);
462+
Util.spinAssertEquals(3, ((ExecutorPlus) validationExecutor)::getPendingTaskCount, 1);
462463

463464
// verify that we've reached a steady state with 2 threads actively processing and 3 queued tasks
464465
Assert.assertEquals(2, ((ExecutorPlus) validationExecutor).getActiveTaskCount());

test/unit/org/apache/cassandra/tools/nodetool/SSTableRepairedSetTest.java

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,23 @@ public class SSTableRepairedSetTest
5050
private SSTableRepairedSet cmd;
5151

5252
@Before
53-
public void setUp() {
53+
public void setUp()
54+
{
5455
MockitoAnnotations.initMocks(this);
55-
PrintStream noopStream = new PrintStream(new OutputStream() {@Override public void write(int b) {}});
56+
PrintStream noopStream = new PrintStream(new OutputStream()
57+
{
58+
@Override
59+
public void write(int b)
60+
{
61+
}
62+
});
5663
when(probe.output()).thenReturn(new Output(noopStream, noopStream));
5764
cmd = new SSTableRepairedSet();
5865
}
5966

6067
@Test
61-
public void testNoKeyspace() {
68+
public void testNoKeyspace()
69+
{
6270
when(probe.getNonLocalStrategyKeyspaces()).thenReturn(new ArrayList<>(Arrays.asList("ks1", "ks2")));
6371
when(probe.getKeyspaces()).thenReturn(new ArrayList<>(Arrays.asList("ks1", "ks2")));
6472
when(probe.getAutoRepairTablesForKeyspace("ks1")).thenReturn(new ArrayList<>(Arrays.asList("table1", "table2")));
@@ -73,7 +81,8 @@ public void testNoKeyspace() {
7381
}
7482

7583
@Test
76-
public void testBothRepairedAndUnrepaired() {
84+
public void testBothRepairedAndUnrepaired()
85+
{
7786
cmd.args = Arrays.asList("keyspace");
7887
cmd.isRepaired = true;
7988
cmd.isUnrepaired = true;
@@ -82,14 +91,16 @@ public void testBothRepairedAndUnrepaired() {
8291
}
8392

8493
@Test
85-
public void testNeitherRepairedNorUnrepaired() {
94+
public void testNeitherRepairedNorUnrepaired()
95+
{
8696
cmd.args = Arrays.asList("keyspace");
8797
cmd.execute(probe);
8898
verify(probe, never()).mutateSSTableRepairedState(anyBoolean(), anyBoolean(), anyString(), anyList());
8999
}
90100

91101
@Test
92-
public void testRepairedPreview() {
102+
public void testRepairedPreview()
103+
{
93104
cmd.args = Arrays.asList("keyspace");
94105
when(probe.getKeyspaces()).thenReturn(new ArrayList<>(Arrays.asList("keyspace")));
95106
cmd.isRepaired = true;
@@ -98,7 +109,8 @@ public void testRepairedPreview() {
98109
}
99110

100111
@Test
101-
public void testUnrepairedReallySet() {
112+
public void testUnrepairedReallySet()
113+
{
102114
cmd.args = Arrays.asList("keyspace");
103115
when(probe.getKeyspaces()).thenReturn(new ArrayList<>(Arrays.asList("keyspace")));
104116
cmd.isUnrepaired = true;
@@ -108,7 +120,8 @@ public void testUnrepairedReallySet() {
108120
}
109121

110122
@Test
111-
public void testExecuteWithTableNames() {
123+
public void testExecuteWithTableNames()
124+
{
112125
cmd.args = Arrays.asList("keyspace", "table1", "table2");
113126
when(probe.getKeyspaces()).thenReturn(new ArrayList<>(Arrays.asList("keyspace")));
114127
cmd.isRepaired = true;

0 commit comments

Comments
 (0)