Skip to content

Commit

Permalink
[code style](fe) Include test sources (apache#9366)
Browse files Browse the repository at this point in the history
Include test sources, we also need to check them.
  • Loading branch information
xleoken authored May 9, 2022
1 parent ae01862 commit d1b85d5
Show file tree
Hide file tree
Showing 113 changed files with 140 additions and 208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

package org.apache.doris.common.jmockit;

import org.apache.doris.common.jmockit.ParameterReflection;

import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class HllTest {
public void testFindFirstNonZeroBitPosition() {
Assert.assertTrue(Hll.getLongTailZeroNum(0) == 0);
Assert.assertTrue(Hll.getLongTailZeroNum(1) == 0);
Assert.assertTrue(Hll.getLongTailZeroNum(1l << 30) == 30);
Assert.assertTrue(Hll.getLongTailZeroNum(1l << 62) == 62);
Assert.assertTrue(Hll.getLongTailZeroNum(1L << 30) == 30);
Assert.assertTrue(Hll.getLongTailZeroNum(1L << 62) == 62);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,11 @@
import org.apache.doris.catalog.Database;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.Table;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.ExceptionChecker;
import org.apache.doris.common.FeConstants;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.ShowExecutor;
import org.apache.doris.qe.ShowResultSet;
import org.apache.doris.thrift.TStorageFormat;
import org.apache.doris.utframe.UtFrameUtils;

import org.junit.AfterClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@

import com.google.common.collect.Maps;

import org.apache.hadoop.yarn.webapp.hamlet.HamletSpec;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

package org.apache.doris.analysis;

import org.apache.doris.analysis.CreateSqlBlockRuleStmt;
import org.apache.doris.blockrule.SqlBlockRule;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.ExceptionChecker;
import org.apache.doris.common.UserException;
import org.apache.doris.mysql.privilege.MockedAuth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
import com.google.common.collect.BoundType;
import com.google.common.collect.Lists;
import com.google.common.collect.Range;
import com.google.common.collect.RangeSet;
import com.google.common.collect.TreeRangeSet;

import java.util.List;

import mockit.Expectations;
import mockit.Injectable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ public void testUnsupportedResourceType(@Mocked Catalog catalog, @Injectable Pal
CreateResourceStmt stmt = new CreateResourceStmt(true, resourceName1, properties);
stmt.analyze(analyzer);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.doris.blockrule.SqlBlockRule;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.ExceptionChecker;
import org.apache.doris.common.UserException;
import org.apache.doris.mysql.privilege.MockedAuth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,4 @@ public void testCreateIcebergTable() throws UserException {
"\"iceberg.hive.metastore.uris\" = \"thrift://127.0.0.1:9087\",\n" +
"\"iceberg.table\" = \"test\")", stmt.toString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ public void testBadPass(@Injectable Analyzer analyzer) throws UserException, Ana
stmt.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public void testNoCol() throws AnalysisException {
clause.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ public void testNoPriv() throws UserException, AnalysisException {
stmt.analyze(AccessTestUtil.fetchBlockAnalyzer());
Assert.fail("no exception");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.doris.analysis;

import org.apache.doris.catalog.Catalog;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.UserException;

Expand Down Expand Up @@ -46,4 +45,4 @@ public void testNoIndex() throws UserException {
DropIndexClause clause = new DropIndexClause("", false, new TableName("db", "table"), false);
clause.analyze(analyzer);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ public void testNoRollup() throws AnalysisException {
clause.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ public void testNoTableFail() throws UserException, AnalysisException {
Assert.fail("No Exception throws.");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ public void testNoUser() throws UserException, AnalysisException {
stmt.analyze(analyzer);
Assert.fail("No Exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ public void testEmpty() throws AnalysisException {
stmt.analyze(null);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ public void testInsertArrayStmt() throws Exception {
parseAndAnalyze("insert into test.table1 values (1, [[1, 2], [3, 4]]);");
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import com.google.common.collect.Maps;
import mockit.Expectations;
import mockit.Mocked;
import org.apache.doris.catalog.Catalog;
import org.apache.doris.catalog.FakeCatalog;
import org.apache.doris.common.UserException;
import org.apache.doris.mysql.privilege.PaloAuth;
import org.apache.doris.mysql.privilege.PrivPredicate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ public void testNormal() {
Assert.assertEquals(2, stmt.getConnectionId());
Assert.assertEquals("KILL 2", stmt.toString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ public void testNoLabel() throws AnalysisException {
Assert.fail("No exception throws");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ private List<ImportColumnDesc> getColumns(String columns) throws Exception {
new SqlScanner(
new StringReader(columnsSQL))))).getColumns();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ public void testNoColDef() throws AnalysisException {
clause.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.jmockit.Deencapsulation;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.StmtExecutor;
import org.apache.doris.thrift.TFileFormatType;
import org.apache.doris.utframe.DorisAssert;
import org.apache.doris.utframe.UtFrameUtils;

import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ public void testColEmpty() throws AnalysisException {
clause.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ public void testHexLengthError() throws AnalysisException {
Separator separator = new Separator("\\x011");
separator.analyze();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ public void testUnsupported() throws AnalysisException {
var.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ public void testBadPassword() throws UserException, AnalysisException {
Assert.fail("No exception throws.");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public void testNullVar() throws UserException, AnalysisException {
stmt.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public void testNormal() {
Assert.assertEquals("GLOBAL", SetType.GLOBAL.toString());
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ public void testNoProperty() throws UserException, AnalysisException {
stmt.analyze(analyzer);
Assert.fail("No exception throws");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public void testUnknownProperty() throws UserException, AnalysisException {
var.analyze(analyzer, true);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.doris.mysql.privilege.PaloAuth;
import org.apache.doris.qe.ConnectContext;

import org.apache.doris.qe.SqlModeHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -69,4 +68,4 @@ public void testNoVariable() throws UserException, AnalysisException {
var.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ public void testExecMemLimit() throws Exception {
stmtExecutor.execute();
Assert.assertEquals(21474836480L, connectContext.getSessionVariable().getMaxExecMemByte());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ public void testNoTbl() throws AnalysisException {
stmt.analyze(analyzer);
Assert.fail("No Exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public void testNormal() throws UserException, AnalysisException {
Assert.assertEquals(1, stmt.getMetaData().getColumnCount());
Assert.assertEquals("DbName", stmt.getMetaData().getColumn(0).getName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ public void testNormal() throws UserException, AnalysisException {
Assert.assertEquals(1, stmt.getMetaData().getColumnCount());
Assert.assertEquals("Database", stmt.getMetaData().getColumn(0).getName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public void testNormal() {
Assert.assertEquals("Savepoints", metaData.getColumn(5).getName());
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ public void testNoTbl() throws UserException {
ShowIndexStmt stmt = new ShowIndexStmt("testDb", new TableName("", ""));
stmt.analyze(analyzer);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package org.apache.doris.analysis;

import org.apache.doris.analysis.BinaryPredicate.Operator;
import org.apache.doris.analysis.CompoundPredicate;
import org.apache.doris.analysis.LikePredicate;
import org.apache.doris.catalog.Catalog;
import org.apache.doris.catalog.FakeCatalog;
import org.apache.doris.common.AnalysisException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ public void testNormal() throws UserException, AnalysisException {
Assert.assertEquals("DbId", stmt.getMetaData().getColumn(3).getName());
Assert.assertEquals("TableId", stmt.getMetaData().getColumn(4).getName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public void testWhere() throws UserException, AnalysisException {
stmt.analyze(analyzer);
Assert.assertEquals("SHOW RESOURCES WHERE `name` LIKE \'abc\' LIMIT 10", stmt.toString());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ public void testNoTbl() throws AnalysisException {
stmt.analyze(analyzer);
Assert.fail("No exception throws.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ public void testNoDb() throws UserException {
stmt.analyze(analyzer);
Assert.assertEquals("testCluster:testDb", stmt.getDbName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@

package org.apache.doris.analysis;

import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.UserException;
import org.apache.doris.mysql.privilege.MockedAuth;
import org.apache.doris.mysql.privilege.PaloAuth;
import org.apache.doris.qe.ConnectContext;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import mockit.Mocked;
import org.apache.doris.common.*;
import org.apache.doris.mysql.privilege.*;
import org.apache.doris.qe.*;
import org.junit.*;

public class ShowTableIdStmtTest {
private Analyzer analyzer;
Expand All @@ -39,7 +44,7 @@ public void setUp() {
}

@Test
public void testNormal() throws UserException, AnalysisException {
public void testNormal() throws UserException, AnalysisException {
ShowTableIdStmt stmt = new ShowTableIdStmt(123456);
stmt.analyze(analyzer);
Assert.assertEquals("SHOW TABLE 123456", stmt.toString());
Expand All @@ -48,4 +53,4 @@ public void testNormal() throws UserException, AnalysisException {
Assert.assertEquals("TableName", stmt.getMetaData().getColumn(1).getName());
Assert.assertEquals("DbId", stmt.getMetaData().getColumn(2).getName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ public void testNormal() throws UserException, AnalysisException {
stmt.analyze(analyzer);
Assert.assertEquals("SHOW PROPERTY FOR 'testCluster:testUser' LIKE '%load_cluster%'", stmt.toString());
}
}
}
Loading

0 comments on commit d1b85d5

Please sign in to comment.