@Test public void test_consume_produce_current_tape_not_null_not_empty_priority_read_do_not_return_any_next_read_order() throws QueueException { TapeDriveWorker driveWorker = mock(TapeDriveWorker.class); TapeCatalog tapeCatalog = mock(TapeCatalog.class); when(driveWorker.getCurrentTape()).thenReturn(tapeCatalog); when(driveWorker.getIndex()).thenReturn(1); when(driveWorker.getPriority()) .thenReturn(ReadWritePriority.READ); ReadOrder readOrder = mock(ReadOrder.class); when(readOrder.isWriteOrder()).thenReturn(false); when(queueRepository.receive(any(), eq(QueueMessageType.WriteOrder))) .thenReturn(Optional.empty()); when(queueRepository.receive(eq(QueueMessageType.ReadOrder))).thenReturn(Optional.of(readOrder)); when(queueRepository.receive(any(), eq(QueueMessageType.ReadOrder))) .thenReturn(Optional.empty()) .thenReturn(Optional.empty()); Optional<? extends ReadWriteOrder> order = tapeDriveWorkerManager.consume(driveWorker); verify(queueRepository, new Times(2)).receive(any(), eq(QueueMessageType.WriteOrder)); verify(queueRepository, new Times(2)).receive(any(), eq(QueueMessageType.ReadOrder)); verify(queueRepository, new Times(1)).receive(eq(QueueMessageType.WriteOrder)); verify(queueRepository, new Times(0)).receive(eq(QueueMessageType.ReadOrder)); Assertions.assertThat(order).isNotPresent(); }
@Override public Optional<? extends ReadWriteOrder> consume(TapeDriveWorker driveWorker) throws QueueException { return produce(driveWorker); }
TapeDriveWorkerManager implements TapeDriveOrderConsumer, TapeDriveOrderProducer { @Override public Optional<? extends ReadWriteOrder> consume(TapeDriveWorker driveWorker) throws QueueException { return produce(driveWorker); } }
TapeDriveWorkerManager implements TapeDriveOrderConsumer, TapeDriveOrderProducer { @Override public Optional<? extends ReadWriteOrder> consume(TapeDriveWorker driveWorker) throws QueueException { return produce(driveWorker); } TapeDriveWorkerManager(
        QueueRepository readWriteQueue,
        ArchiveReferentialRepository archiveReferentialRepository,
        ReadRequestReferentialRepository readRequestReferentialRepository,
        TapeLibraryPool tapeLibraryPool,
        Map<Integer, TapeCatalog> driveTape, String inputTarPath, boolean forceOverrideNonEmptyCartridges,
        ArchiveOutputRetentionPolicy archiveOutputRetentionPolicy); }
TapeDriveWorkerManager implements TapeDriveOrderConsumer, TapeDriveOrderProducer { @Override public Optional<? extends ReadWriteOrder> consume(TapeDriveWorker driveWorker) throws QueueException { return produce(driveWorker); } TapeDriveWorkerManager(
        QueueRepository readWriteQueue,
        ArchiveReferentialRepository archiveReferentialRepository,
        ReadRequestReferentialRepository readRequestReferentialRepository,
        TapeLibraryPool tapeLibraryPool,
        Map<Integer, TapeCatalog> driveTape, String inputTarPath, boolean forceOverrideNonEmptyCartridges,
        ArchiveOutputRetentionPolicy archiveOutputRetentionPolicy); void startWorkers(); void enqueue(QueueMessageEntity entity); void shutdown(); void shutdown(long timeout, TimeUnit timeUnit); @Override QueueRepository getQueue(); @Override Optional<? extends ReadWriteOrder> consume(TapeDriveWorker driveWorker); @Override synchronized Optional<? extends ReadWriteOrder> produce(TapeDriveWorker driveWorker); }
TapeDriveWorkerManager implements TapeDriveOrderConsumer, TapeDriveOrderProducer { @Override public Optional<? extends ReadWriteOrder> consume(TapeDriveWorker driveWorker) throws QueueException { return produce(driveWorker); } TapeDriveWorkerManager(
        QueueRepository readWriteQueue,
        ArchiveReferentialRepository archiveReferentialRepository,
        ReadRequestReferentialRepository readRequestReferentialRepository,
        TapeLibraryPool tapeLibraryPool,
        Map<Integer, TapeCatalog> driveTape, String inputTarPath, boolean forceOverrideNonEmptyCartridges,
        ArchiveOutputRetentionPolicy archiveOutputRetentionPolicy); void startWorkers(); void enqueue(QueueMessageEntity entity); void shutdown(); void shutdown(long timeout, TimeUnit timeUnit); @Override QueueRepository getQueue(); @Override Optional<? extends ReadWriteOrder> consume(TapeDriveWorker driveWorker); @Override synchronized Optional<? extends ReadWriteOrder> produce(TapeDriveWorker driveWorker);  }