-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What changes were proposed in this pull request? Add more configurations for the config API ### Why are the changes needed? Fix #5987 Front end can use this config option to optimize the user experience. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? ![image](https://github.com/user-attachments/assets/a5f26c61-9e10-4dfa-bbcd-54cb887b1b71)
- Loading branch information
Showing
3 changed files
with
51 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
server/src/test/java/org/apache/gravitino/server/web/TestConfigServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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.gravitino.server.web; | ||
|
||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.io.PrintWriter; | ||
import javax.servlet.http.HttpServletResponse; | ||
import org.apache.gravitino.server.ServerConfig; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class TestConfigServlet { | ||
|
||
@Test | ||
public void testConfigServlet() throws Exception { | ||
ServerConfig serverConfig = new ServerConfig(); | ||
ConfigServlet configServlet = new ConfigServlet(serverConfig); | ||
configServlet.init(); | ||
HttpServletResponse res = mock(HttpServletResponse.class); | ||
PrintWriter writer = mock(PrintWriter.class); | ||
when(res.getWriter()).thenReturn(writer); | ||
configServlet.doGet(null, res); | ||
verify(writer) | ||
.write( | ||
"{\"gravitino.authorization.enable\":false,\"gravitino.authenticators\":[\"simple\"]}"); | ||
configServlet.destroy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters