Search in sources :

Example 1 with Service

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()));
}
Also used : Service(org.apache.calcite.avatica.remote.Service) Test(org.junit.Test)

Example 2 with Service

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()));
}
Also used : Service(org.apache.calcite.avatica.remote.Service) Test(org.junit.Test)

Example 3 with Service

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()));
}
Also used : Service(org.apache.calcite.avatica.remote.Service) Test(org.junit.Test)

Example 4 with Service

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()));
}
Also used : Service(org.apache.calcite.avatica.remote.Service) Test(org.junit.Test)

Example 5 with Service

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()));
}
Also used : Service(org.apache.calcite.avatica.remote.Service) Test(org.junit.Test)

Aggregations

Service (org.apache.calcite.avatica.remote.Service)14 Test (org.junit.Test)11 LocalService (org.apache.calcite.avatica.remote.LocalService)4 ArrayList (java.util.ArrayList)2 Meta (org.apache.calcite.avatica.Meta)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 Map (java.util.Map)1 ServletException (javax.servlet.ServletException)1 JsonHandler (org.apache.calcite.avatica.remote.JsonHandler)1 JsonService (org.apache.calcite.avatica.remote.JsonService)1 LocalJsonService (org.apache.calcite.avatica.remote.LocalJsonService)1 TypedValue (org.apache.calcite.avatica.remote.TypedValue)1 HttpServer (org.apache.calcite.avatica.server.HttpServer)1 Server (org.apache.druid.client.selector.Server)1