Search in sources :

Example 1 with ExplainerServiceHandlerRegistry

use of org.kie.kogito.trusty.service.common.handlers.ExplainerServiceHandlerRegistry in project kogito-apps by kiegroup.

the class TrustyServiceTest method setup.

@BeforeEach
@SuppressWarnings("unchecked")
void setup() {
    explainabilityRequestProducerMock = mock(ExplainabilityRequestProducer.class);
    trustyStorageServiceMock = mock(TrustyStorageService.class);
    limeExplainerServiceHandler = new LIMEExplainerServiceHandler(trustyStorageServiceMock);
    counterfactualExplainerServiceHandler = new CounterfactualExplainerServiceHandler(trustyStorageServiceMock, mock(CounterfactualExplainabilityResultsManagerSlidingWindow.class), mock(CounterfactualExplainabilityResultsManagerDuplicates.class));
    explanationHandlers = mock(Instance.class);
    when(explanationHandlers.stream()).thenReturn(Stream.of(limeExplainerServiceHandler, counterfactualExplainerServiceHandler));
    trustyService = new TrustyServiceImpl(false, explainabilityRequestProducerMock, trustyStorageServiceMock, new ExplainerServiceHandlerRegistry(explanationHandlers), MAX_RUNNING_TIME_SECONDS);
}
Also used : LIMEExplainerServiceHandler(org.kie.kogito.trusty.service.common.handlers.LIMEExplainerServiceHandler) Instance(javax.enterprise.inject.Instance) ExplainabilityRequestProducer(org.kie.kogito.trusty.service.common.messaging.outgoing.ExplainabilityRequestProducer) TrustyStorageService(org.kie.kogito.trusty.storage.common.TrustyStorageService) CounterfactualExplainerServiceHandler(org.kie.kogito.trusty.service.common.handlers.CounterfactualExplainerServiceHandler) ExplainerServiceHandlerRegistry(org.kie.kogito.trusty.service.common.handlers.ExplainerServiceHandlerRegistry) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with ExplainerServiceHandlerRegistry

use of org.kie.kogito.trusty.service.common.handlers.ExplainerServiceHandlerRegistry in project kogito-apps by kiegroup.

the class ExplainabilityResultConsumerTest method setup.

@BeforeEach
@SuppressWarnings("unchecked")
void setup() {
    trustyService = mock(TrustyService.class);
    storageExceptionsProvider = mock(StorageExceptionsProvider.class);
    trustyStorage = mock(TrustyStorageService.class);
    limeExplainerServiceHandler = new LIMEExplainerServiceHandler(trustyStorage);
    counterfactualExplainerServiceHandler = new CounterfactualExplainerServiceHandler(trustyStorage, mock(CounterfactualExplainabilityResultsManagerSlidingWindow.class), mock(CounterfactualExplainabilityResultsManagerDuplicates.class));
    explanationHandlers = mock(Instance.class);
    when(explanationHandlers.stream()).thenReturn(Stream.of(limeExplainerServiceHandler, counterfactualExplainerServiceHandler));
    explainerServiceHandlerRegistry = new ExplainerServiceHandlerRegistry(explanationHandlers);
    consumer = new ExplainabilityResultConsumer(trustyService, explainerServiceHandlerRegistry, TrustyServiceTestUtils.MAPPER, storageExceptionsProvider, SmallRyeManagedExecutor.builder().build());
}
Also used : LIMEExplainerServiceHandler(org.kie.kogito.trusty.service.common.handlers.LIMEExplainerServiceHandler) Instance(javax.enterprise.inject.Instance) StorageExceptionsProvider(org.kie.kogito.trusty.storage.api.StorageExceptionsProvider) TrustyStorageService(org.kie.kogito.trusty.storage.common.TrustyStorageService) TrustyService(org.kie.kogito.trusty.service.common.TrustyService) CounterfactualExplainerServiceHandler(org.kie.kogito.trusty.service.common.handlers.CounterfactualExplainerServiceHandler) ExplainerServiceHandlerRegistry(org.kie.kogito.trusty.service.common.handlers.ExplainerServiceHandlerRegistry) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Instance (javax.enterprise.inject.Instance)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 CounterfactualExplainerServiceHandler (org.kie.kogito.trusty.service.common.handlers.CounterfactualExplainerServiceHandler)2 ExplainerServiceHandlerRegistry (org.kie.kogito.trusty.service.common.handlers.ExplainerServiceHandlerRegistry)2 LIMEExplainerServiceHandler (org.kie.kogito.trusty.service.common.handlers.LIMEExplainerServiceHandler)2 TrustyStorageService (org.kie.kogito.trusty.storage.common.TrustyStorageService)2 TrustyService (org.kie.kogito.trusty.service.common.TrustyService)1 ExplainabilityRequestProducer (org.kie.kogito.trusty.service.common.messaging.outgoing.ExplainabilityRequestProducer)1 StorageExceptionsProvider (org.kie.kogito.trusty.storage.api.StorageExceptionsProvider)1