use of org.apache.calcite.avatica.remote.Service in project calcite-avatica by apache.
the class HttpServerBuilderTest method lotsOfExtraRolesWithExplitRealm.
@Test
public void lotsOfExtraRolesWithExplitRealm() {
final String[] extraRoles = new String[] { "BAR.COM", "BAZ.COM", "FOO.COM" };
final Service mockService = Mockito.mock(Service.class);
HttpServer server = new HttpServer.Builder().withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", "EXAMPLE.COM", extraRoles).withHandler(mockService, Serialization.JSON).build();
assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
assertArrayEquals(new String[] { "EXAMPLE.COM", "BAR.COM", "BAZ.COM", "FOO.COM" }, server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
}
use of org.apache.calcite.avatica.remote.Service in project calcite-avatica by apache.
the class HttpServerBuilderTest method emptyExtraRoles.
@Test
public void emptyExtraRoles() {
final String[] extraRoles = new String[0];
final Service mockService = Mockito.mock(Service.class);
HttpServer server = new HttpServer.Builder().withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", extraRoles).withHandler(mockService, Serialization.JSON).build();
assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
assertArrayEquals(new String[] { "EXAMPLE.COM" }, server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
}
use of org.apache.calcite.avatica.remote.Service in project calcite-avatica by apache.
the class HttpServerBuilderTest method extraAllowedRolesConfigured.
@Test
public void extraAllowedRolesConfigured() {
final String[] extraRoles = new String[] { "BAR.COM" };
final Service mockService = Mockito.mock(Service.class);
HttpServer server = new HttpServer.Builder().withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", extraRoles).withHandler(mockService, Serialization.JSON).build();
assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
assertArrayEquals(new String[] { "EXAMPLE.COM", "BAR.COM" }, server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
}
use of org.apache.calcite.avatica.remote.Service in project calcite-avatica by apache.
the class HttpServerBuilderTest method lotsOfExtraRoles.
@Test
public void lotsOfExtraRoles() {
final String[] extraRoles = new String[] { "BAR.COM", "BAZ.COM", "FOO.COM" };
final Service mockService = Mockito.mock(Service.class);
HttpServer server = new HttpServer.Builder().withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", extraRoles).withHandler(mockService, Serialization.JSON).build();
assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
assertArrayEquals(new String[] { "EXAMPLE.COM", "BAR.COM", "BAZ.COM", "FOO.COM" }, server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
}
use of org.apache.calcite.avatica.remote.Service in project calcite-avatica by apache.
the class HttpServerBuilderTest method nullExtraRoles.
@Test
public void nullExtraRoles() {
final String[] extraRoles = null;
final Service mockService = Mockito.mock(Service.class);
HttpServer server = new HttpServer.Builder().withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", extraRoles).withHandler(mockService, Serialization.JSON).build();
assertNull(server.getConfig().getAllowedRoles());
assertArrayEquals(new String[] { "EXAMPLE.COM" }, server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
}
Aggregations