[ci] Add checkstyle prohibit rule System.out.println (#6778)
* [ci] Add checkstyle prohibit rule System.out.println * Correct RegexpSingleline placerefactor-ui
parent
cd8205217a
commit
6045728428
|
|
@ -17,18 +17,19 @@
|
|||
|
||||
package org.apache.dolphinscheduler.common.utils;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SnowFlakeUtilsTest {
|
||||
@Test
|
||||
public void testNextId() {
|
||||
try {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
Thread.sleep(1);
|
||||
System.out.println(SnowFlakeUtils.getInstance().nextId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
public void testNoGenerateDuplicateId() throws SnowFlakeUtils.SnowFlakeException {
|
||||
HashSet<Long> existsSnowFlakeId = new HashSet<>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
Long currentId = SnowFlakeUtils.getInstance().nextId();
|
||||
Assert.assertFalse(existsSnowFlakeId.contains(currentId));
|
||||
existsSnowFlakeId.add(currentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ public class StringTest {
|
|||
}
|
||||
}
|
||||
double during = (System.currentTimeMillis() - start) / 1000.0;
|
||||
System.out.println(during);
|
||||
Assert.assertEquals("1_0000000000_0000000001", origin);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -671,7 +671,6 @@ public abstract class UpgradeDao {
|
|||
taskDefinitionLog.setName(name);
|
||||
taskDefinitionLog.setWorkerGroup(task.get("workerGroup").asText());
|
||||
long taskCode = SnowFlakeUtils.getInstance().nextId();
|
||||
// System.out.println(taskCode);
|
||||
taskDefinitionLog.setCode(taskCode);
|
||||
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
|
||||
taskDefinitionLog.setProjectCode(processDefinition.getProjectCode());
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ public class HiveDatasourceProcessorTest {
|
|||
PowerMockito.when(CommonUtils.getKerberosStartupState()).thenReturn(false);
|
||||
HiveConnectionParam connectionParams = (HiveConnectionParam) hiveDatasourceProcessor
|
||||
.createConnectionParams(hiveDataSourceParamDTO);
|
||||
System.out.println(JSONUtils.toJsonString(connectionParams));
|
||||
Assert.assertNotNull(connectionParams);
|
||||
Assert.assertEquals("jdbc:hive2://localhost1:5142,localhost2:5142", connectionParams.getAddress());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ public class MysqlDatasourceProcessorTest {
|
|||
PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test");
|
||||
MysqlConnectionParam connectionParams = (MysqlConnectionParam) mysqlDatasourceProcessor
|
||||
.createConnectionParams(mysqlDatasourceParamDTO);
|
||||
System.out.println(JSONUtils.toJsonString(connectionParams));
|
||||
Assert.assertEquals("jdbc:mysql://localhost:3306", connectionParams.getAddress());
|
||||
Assert.assertEquals("jdbc:mysql://localhost:3306/default", connectionParams.getJdbcUrl());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ public class WorkerRegistryClientTest {
|
|||
@Test
|
||||
public void testRegistry() {
|
||||
//workerRegistryClient.initWorkRegistry();
|
||||
// System.out.println(this.workerGroups.iterator());
|
||||
//Set<String> workerGroups = Sets.newHashSet("127.0.0.1");
|
||||
//workerRegistryClient.registry();
|
||||
// workerRegistryClient.handleDeadServer();
|
||||
|
|
|
|||
|
|
@ -103,9 +103,7 @@ public class TaskPriorityQueueImplTest {
|
|||
queue.poll(1000, TimeUnit.MILLISECONDS);
|
||||
queue.poll(1000, TimeUnit.MILLISECONDS);
|
||||
Assert.assertTrue(queue.size() == 0);
|
||||
System.out.println(System.currentTimeMillis());
|
||||
queue.poll(1000, TimeUnit.MILLISECONDS);
|
||||
System.out.println(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@
|
|||
<property name="ignorePattern" value="^ *\* *[^ ]+$"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="System\.out\.println"/>
|
||||
<property name="message" value="Prohibit invoking System.out.println in source code !"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="OuterTypeFilename">
|
||||
<property name="severity" value="error"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue