-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#6499] improvement(server): Support custom configuration options in the REST API /configs
#6501
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,10 @@ | |
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import com.google.common.collect.Lists; | ||
import java.io.PrintWriter; | ||
import javax.servlet.http.HttpServletResponse; | ||
import org.apache.gravitino.Configs; | ||
import org.apache.gravitino.server.ServerConfig; | ||
import org.junit.jupiter.api.Test; | ||
|
||
|
@@ -43,4 +45,23 @@ public void testConfigServlet() throws Exception { | |
"{\"gravitino.authorization.enable\":false,\"gravitino.authenticators\":[\"simple\"]}"); | ||
configServlet.destroy(); | ||
} | ||
|
||
@Test | ||
public void testConfigServletWithVisibleConfigs() throws Exception { | ||
ServerConfig serverConfig = new ServerConfig(); | ||
serverConfig.set( | ||
Configs.VISIBLE_CONFIGS, | ||
Lists.newArrayList(Configs.AUDIT_LOG_FORMATTER_CLASS_NAME.getKey())); | ||
serverConfig.set(Configs.AUDIT_LOG_FORMATTER_CLASS_NAME, "test"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Em ... this is an interesting test case. Can we use something more realistic? I'm not sure who wants to know the audit log formatter class? Maybe there are something I missed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I can use a more realistic case. |
||
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.audit.formatter.className\":\"test\",\"gravitino.authorization.enable\":false,\"gravitino.authenticators\":[\"simple\"]}"); | ||
configServlet.destroy(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:) This is a pretty honest name. It can be parsed as "... I have many configs, but I can only show you some ...".