Search in sources :

Example 1 with TestingEventListenerManager

use of io.trino.testing.TestingEventListenerManager in project trino by trinodb.

the class TestAccessControlManager method testRegisterMultipleEventListeners.

@Test
public void testRegisterMultipleEventListeners() throws IOException {
    EventListener firstListener = new EventListener() {
    };
    EventListener secondListener = new EventListener() {
    };
    String systemAccessControlName = "event-listening-sac";
    TestingEventListenerManager eventListenerManager = emptyEventListenerManager();
    AccessControlManager accessControlManager = createAccessControlManager(eventListenerManager, ImmutableList.of("access-control.name=" + systemAccessControlName));
    accessControlManager.addSystemAccessControlFactory(eventListeningSystemAccessControlFactory(systemAccessControlName, firstListener, secondListener));
    accessControlManager.loadSystemAccessControl();
    assertThat(eventListenerManager.getConfiguredEventListeners()).contains(firstListener, secondListener);
}
Also used : TestingEventListenerManager(io.trino.testing.TestingEventListenerManager) EventListener(io.trino.spi.eventlistener.EventListener) Test(org.testng.annotations.Test)

Example 2 with TestingEventListenerManager

use of io.trino.testing.TestingEventListenerManager in project trino by trinodb.

the class TestAccessControlManager method testRegisterSingleEventListener.

@Test
public void testRegisterSingleEventListener() throws IOException {
    EventListener expectedListener = new EventListener() {
    };
    String systemAccessControlName = "event-listening-sac";
    TestingEventListenerManager eventListenerManager = emptyEventListenerManager();
    AccessControlManager accessControlManager = createAccessControlManager(eventListenerManager, ImmutableList.of("access-control.name=" + systemAccessControlName));
    accessControlManager.addSystemAccessControlFactory(eventListeningSystemAccessControlFactory(systemAccessControlName, expectedListener));
    accessControlManager.loadSystemAccessControl();
    assertThat(eventListenerManager.getConfiguredEventListeners()).contains(expectedListener);
}
Also used : TestingEventListenerManager(io.trino.testing.TestingEventListenerManager) EventListener(io.trino.spi.eventlistener.EventListener) Test(org.testng.annotations.Test)

Aggregations

EventListener (io.trino.spi.eventlistener.EventListener)2 TestingEventListenerManager (io.trino.testing.TestingEventListenerManager)2 Test (org.testng.annotations.Test)2