[ 
https://issues.apache.org/jira/browse/KNOX-3426?focusedWorklogId=1038575&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1038575
 ]

ASF GitHub Bot logged work on KNOX-3426:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Aug/26 22:34
            Start Date: 28/Aug/26 22:34
    Worklog Time Spent: 10m 
      Work Description: lmccay commented on code in PR #1361:
URL: https://github.com/apache/knox/pull/1361#discussion_r3884468550


##########
gateway-server/src/test/java/org/apache/knox/gateway/services/knoxidf/delegation/DelegationPolicySchemaTest.java:
##########
@@ -0,0 +1,230 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.knox.gateway.services.knoxidf.delegation;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.knox.gateway.database.AbstractDataSourceFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * Validates that the DELEGATION_POLICIES DDL scripts parse and execute 
correctly
+ * against in-memory databases, and that schema constraints are enforced.
+ */
+public class DelegationPolicySchemaTest {
+
+  private static final String DERBY_DB = "delegationpolicies";
+  private static final String DERBY_URL = "jdbc:derby:memory:" + DERBY_DB + 
";create=true";
+  private static final String DERBY_SHUTDOWN_URL = "jdbc:derby:memory:" + 
DERBY_DB + ";shutdown=true";
+  private static final String HSQL_URL = 
"jdbc:hsqldb:mem:delegationschema;ifexists=false";
+  private static final String HSQL_USER = "SA";
+  private static final String HSQL_PASSWORD = "";
+
+  private static Connection derbyConn;
+  private static Connection hsqlConn;
+
+  @BeforeClass
+  public static void setUp() throws Exception {
+    java.util.Locale.setDefault(java.util.Locale.US);
+    derbyConn = DriverManager.getConnection(DERBY_URL);
+    hsqlConn = DriverManager.getConnection(HSQL_URL, HSQL_USER, HSQL_PASSWORD);
+    // Run Derby DDL once - no IF NOT EXISTS, so run once at class level
+    runScript(derbyConn, 
loadSql(AbstractDataSourceFactory.DERBY_KNOXIDF_DELEGATION_POLICY_TABLES_SQL));
+    // Run standard DDL on HSQLDB
+    runScript(hsqlConn, 
loadSql(AbstractDataSourceFactory.KNOXIDF_DELEGATION_POLICY_TABLES_SQL));
+  }

Review Comment:
   This is understandable given the lack of oracle backend to test with. 
@hsheinblatt what do you think about the suggestion here?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 1038575)
    Time Spent: 40m  (was: 0.5h)

> Delegation policy schema and JDBC implementation
> ------------------------------------------------
>
>                 Key: KNOX-3426
>                 URL: https://issues.apache.org/jira/browse/KNOX-3426
>             Project: Apache Knox
>          Issue Type: Task
>          Components: JWT
>            Reporter: Harrison Sheinblatt
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Persistent storage for delegation policies, with a service interface and JDBC 
> implementation. After these tasks, delegation policies can be stored and 
> retrieved.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to