@@ -0,0 +1,3530 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.apache.shardingsphere.infra.context.kernel;%0A%0Aimport org.apache.shardingsphere.infra.binder.LogicSQL;%0Aimport org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;%0Aimport org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;%0Aimport org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;%0Aimport org.apache.shardingsphere.infra.executor.sql.context.ExecutionContext;%0Aimport org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;%0Aimport org.apache.shardingsphere.infra.metadata.resource.ShardingSphereResource;%0Aimport org.apache.shardingsphere.infra.metadata.rule.ShardingSphereRuleMetaData;%0Aimport org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;%0Aimport org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;%0Aimport org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLSelectStatement;%0Aimport org.hamcrest.Matchers;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.util.Collections;%0Aimport java.util.Optional;%0Aimport java.util.Properties;%0A%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.mockito.Mockito.RETURNS_DEEP_STUBS;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Apublic class KernelProcessorTest %7B%0A%0A    private KernelProcessor kernelProcessor;%0A%0A    @Before%0A    public void setUp() throws Exception %7B%0A        kernelProcessor = new KernelProcessor();%0A    %7D%0A%0A    @Test%0A    public void testGenerateExecutionContext() %7B%0A        SQLStatementContext%3CSQLStatement%3E sqlStatementContext = mock(SQLStatementContext.class);%0A        MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);%0A        when(selectStatement.getLock()).thenReturn(Optional.empty());%0A        when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);%0A        final LogicSQL logicSQL = new LogicSQL(sqlStatementContext, %22select * from t_order%22, Collections.emptyList());%0A        final ShardingSphereMetaData metaData = new ShardingSphereMetaData(%22logic_schema%22,%0A                mock(ShardingSphereResource.class, RETURNS_DEEP_STUBS),%0A                new ShardingSphereRuleMetaData(Collections.emptyList(),%0A                        Collections.emptyList()),%0A                mock(ShardingSphereSchema.class));%0A        Properties properties = new Properties();%0A        properties.setProperty(ConfigurationPropertyKey.SQL_SHOW.getKey(), Boolean.TRUE.toString());%0A        final ConfigurationProperties props = new ConfigurationProperties(properties);%0A        final ExecutionContext result = kernelProcessor.generateExecutionContext(logicSQL, metaData, props);%0A        assertThat(1, Matchers.is(result.getExecutionUnits().size()));%0A    %7D%0A%7D%0A

add test for KernelProcessor class. (#9664)