paul-rogers commented on a change in pull request #1997: DRILL-7604: Allow session options to be set in HTTP queries URL: https://github.com/apache/drill/pull/1997#discussion_r384885463
########## File path: exec/java-exec/src/test/java/org/apache/drill/exec/server/rest/TestQueryWrapper.java ########## @@ -0,0 +1,224 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.drill.exec.server.rest; + +import io.netty.channel.DefaultChannelPromise; +import io.netty.channel.local.LocalAddress; +import org.apache.drill.exec.ExecConstants; +import org.apache.drill.exec.proto.UserBitShared; +import org.apache.drill.exec.rpc.user.UserSession; +import org.apache.drill.exec.server.Drillbit; +import org.apache.drill.exec.server.options.SystemOptionManager; +import org.apache.drill.exec.server.rest.auth.DrillUserPrincipal; +import org.apache.drill.exec.work.WorkManager; +import org.apache.drill.test.ClusterFixture; +import org.apache.drill.test.ClusterTest; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.junit.Test; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import static org.apache.drill.exec.ExecConstants.ENABLE_VERBOSE_ERRORS_KEY; +import static org.apache.drill.exec.ExecConstants.OUTPUT_FORMAT_OPTION; +import static org.apache.drill.exec.ExecConstants.PARQUET_FLAT_BATCH_MEMORY_SIZE_VALIDATOR; +import static org.apache.drill.exec.ExecConstants.QUERY_MAX_ROWS; +import static org.apache.drill.exec.ExecConstants.TEXT_ESTIMATED_ROW_SIZE; +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +public class TestQueryWrapper extends ClusterTest { + + private static DrillRestServer server; + private static WorkManager workManager; + private static WebServer webServer; + + private void setupServer() throws IOException { + boolean impersonationEnabled = false; + setupServer(impersonationEnabled); + } Review comment: I think I saw a comment from @arina-ielchiieva about this. The ideomatic way to set up a server is to do it in a `@BeforeClass` method. You can call the code you have below. This structure runs in parallel with the `@AfterClass` logic in the base class. If you want to start the server with impersonation enabled in some tests, disabled in others, then you can put the setup logic in a base class (without the `@BeforeClass` annotation), then have each test call the `setupServer()` method in its own `@BeforeClass`. See the `BaseCsvTest` and its subclases for an example. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
