deniskuzZ commented on code in PR #5870:
URL: https://github.com/apache/hive/pull/5870#discussion_r2155329314


##########
standalone-metastore/metastore-rest-catalog/src/test/java/org/apache/iceberg/rest/TestHMSCatalogAuthNone.java:
##########
@@ -36,45 +39,41 @@
 import org.apache.iceberg.rest.requests.CreateTableRequest;
 import org.apache.iceberg.rest.requests.RenameTableRequest;
 import org.apache.iceberg.types.Types;
-import static org.apache.iceberg.types.Types.NestedField.required;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public class TestHMSCatalog extends HMSTestBase {
-  public TestHMSCatalog() {
-    super();
-  }
-  
+public class TestHMSCatalogAuthNone extends HMSTestBase {
   @Before
   @Override
   public void setUp() throws Exception {
-      super.setUp();
+    conf = MetastoreConf.newMetastoreConf();
+    MetastoreConf.setVar(conf, 
MetastoreConf.ConfVars.ICEBERG_CATALOG_SERVLET_AUTH, "none");
+    super.setUp();
   }
-  
+
   @After
   @Override
   public void tearDown() throws Exception {
-      super.tearDown();
+    super.tearDown();
   }
 
   @Test
   public void testCreateNamespaceHttp() throws Exception {
     String ns = "nstesthttp";
     // list namespaces
     URL url = new URL("http://hive@localhost:"; + catalogPort + 
"/"+catalogPath+"/v1/namespaces");
-    String jwt = generateJWT();
     // check namespaces list (ie 0)
-    Object response = clientCall(jwt, url, "GET", null);
+    Object response = clientCall(url, "GET", Collections.emptyMap(), null);

Review Comment:
   meanwhile we could easily parametrize it
   ````
   protected ServletSecurity.AuthType authType; - JWT & NONE
   protected RESTCatalog restCatalog;
   ````
   
   in setUp (use RESTCatalog client instead of manually constructed http 
requests)
   ````
       MetastoreConf.setVar(conf, 
MetastoreConf.ConfVars.ICEBERG_CATALOG_SERVLET_AUTH, authType.name());
       
       restCatalog = initCatalog(catalog.name());
     }
   
     private RESTCatalog initCatalog(String catalogName) throws Exception {
       URI catalogUri = URI.create("http://localhost:"; + catalogPort + "/" + 
catalogPath);
       RESTCatalog catalog = new RESTCatalog();
   
       Map<String, String> properties = Maps.newHashMap();
       properties.put(CatalogProperties.URI, catalogUri.toString());
       if (authType == ServletSecurity.AuthType.JWT) {
         properties.put("token", generateJWT());
       }
       catalog.initialize(catalogName, properties);
       return catalog;
     }
   ````
   generic test snippet
   ````
   @Test
     public void testTableAPI() throws Exception {
       Schema schema = getTestSchema();
       final String tblName = "tbl_" + Integer.toHexString(RND.nextInt(65536));
       final TableIdentifier TBL = TableIdentifier.of(DB_NAME, tblName);
       String location = temp.newFolder(TBL.toString()).toString();
   
       restCatalog
           .buildTable(TBL, schema)
           .withLocation(location)
           .create();
   
       Table table = catalog.loadTable(TBL);
       Assert.assertEquals(location, table.location());
   
       // rename table
       final String rtblName = "TBL_" + Integer.toHexString(RND.nextInt(65536));
       final TableIdentifier rtableIdent = TableIdentifier.of(DB_NAME, 
rtblName);
   
       restCatalog.renameTable(TBL, rtableIdent);
       table = catalog.loadTable(rtableIdent);
       Assert.assertEquals(
           String.join(".", catalog.name(),
           rtableIdent.toString()), table.name());
     }
   ````



-- 
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.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to