Search in sources :

Example 1 with CommandQueue

use of org.eclipse.dataspaceconnector.spi.command.CommandQueue in project DataSpaceConnector by eclipse-dataspaceconnector.

the class AbstractContractNegotiationIntegrationTest method setUp.

/**
 * Prepares the test setup
 */
@BeforeEach
void setUp() {
    // Create contract validation service mock, method mocking has to be done in test methods
    validationService = mock(ContractValidationService.class);
    // Create a monitor that logs to the console
    Monitor monitor = new ConsoleMonitor();
    // Create CommandQueue mock
    CommandQueue<ContractNegotiationCommand> queue = (CommandQueue<ContractNegotiationCommand>) mock(CommandQueue.class);
    when(queue.dequeue(anyInt())).thenReturn(new ArrayList<>());
    // Create CommandRunner mock
    CommandRunner<ContractNegotiationCommand> runner = (CommandRunner<ContractNegotiationCommand>) mock(CommandRunner.class);
    providerStore = new InMemoryContractNegotiationStore();
    consumerStore = new InMemoryContractNegotiationStore();
    providerManager = ProviderContractNegotiationManagerImpl.Builder.newInstance().dispatcherRegistry(new FakeProviderDispatcherRegistry()).monitor(monitor).validationService(validationService).waitStrategy(() -> 1000).commandQueue(queue).commandRunner(runner).observable(providerObservable).store(providerStore).policyStore(policyStore).build();
    consumerManager = ConsumerContractNegotiationManagerImpl.Builder.newInstance().dispatcherRegistry(new FakeConsumerDispatcherRegistry()).monitor(monitor).validationService(validationService).waitStrategy(() -> 1000).commandQueue(queue).commandRunner(runner).observable(consumerObservable).store(consumerStore).policyStore(policyStore).build();
    countDownLatch = new CountDownLatch(2);
}
Also used : ConsoleMonitor(org.eclipse.dataspaceconnector.spi.monitor.ConsoleMonitor) CommandQueue(org.eclipse.dataspaceconnector.spi.command.CommandQueue) ContractValidationService(org.eclipse.dataspaceconnector.spi.contract.validation.ContractValidationService) CountDownLatch(java.util.concurrent.CountDownLatch) ConsoleMonitor(org.eclipse.dataspaceconnector.spi.monitor.ConsoleMonitor) Monitor(org.eclipse.dataspaceconnector.spi.monitor.Monitor) InMemoryContractNegotiationStore(org.eclipse.dataspaceconnector.core.defaults.negotiationstore.InMemoryContractNegotiationStore) ContractNegotiationCommand(org.eclipse.dataspaceconnector.spi.types.domain.contract.negotiation.command.ContractNegotiationCommand) CommandRunner(org.eclipse.dataspaceconnector.spi.command.CommandRunner) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

CountDownLatch (java.util.concurrent.CountDownLatch)1 InMemoryContractNegotiationStore (org.eclipse.dataspaceconnector.core.defaults.negotiationstore.InMemoryContractNegotiationStore)1 CommandQueue (org.eclipse.dataspaceconnector.spi.command.CommandQueue)1 CommandRunner (org.eclipse.dataspaceconnector.spi.command.CommandRunner)1 ContractValidationService (org.eclipse.dataspaceconnector.spi.contract.validation.ContractValidationService)1 ConsoleMonitor (org.eclipse.dataspaceconnector.spi.monitor.ConsoleMonitor)1 Monitor (org.eclipse.dataspaceconnector.spi.monitor.Monitor)1 ContractNegotiationCommand (org.eclipse.dataspaceconnector.spi.types.domain.contract.negotiation.command.ContractNegotiationCommand)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1