UdpStreamProcessor implements StreamProcessor { public void setStreamEndPlugin(StreamEndPlugin streamEndPlugin) { this.streamEndPlugin = streamEndPlugin; } UdpStreamProcessor(final StreamMonitor streamMonitor, final BundleContext bundleContext); Subject getSubject(); void setSubject(Subject subject); Subject getSecuritySubject(String ipAddress); void setStreamCreationPlugin(StreamCreationPlugin streamCreationPlugin); @Nullable Double getDistanceTolerance(); void setDistanceTolerance(@Nullable Double distanceTolerance); @Override long getMetacardUpdateInitialDelay(); void setMetacardUpdateInitialDelay(Long metacardUpdateInitialDelay); @Override Optional<URI> getStreamUri(); @Override Optional<String> getTitle(); @Override String toString(); void setMegabyteCountRolloverCondition(Integer count); void setElapsedTimeRolloverCondition(Long milliseconds); PacketBuffer getPacketBuffer(); void shutdown(); void setStreamEndPlugin(StreamEndPlugin streamEndPlugin); void checkForRollover(); void doRollover(File tempFile); boolean isReady(); void setRolloverAction(RolloverAction rolloverAction); CatalogFramework getCatalogFramework(); void setCatalogFramework(CatalogFramework catalogFramework); FilenameGenerator getFilenameGenerator(); void setFilenameGenerator(FilenameGenerator filenameGenerator); String getFilenameTemplate(); void setFilenameTemplate(String filenameTemplate); List<MetacardType> getMetacardTypeList(); void setMetacardTypeList(List<MetacardType> metacardTypeList); Timer getTimer(); void setTimer(Timer timer); void init(); void setRolloverCondition(RolloverCondition rolloverCondition); ChannelHandler[] createChannelHandlers(); void setStreamShutdownPlugin(StreamShutdownPlugin streamShutdownPlugin); MetacardUpdater getParentMetacardUpdater(); void setParentMetacardUpdater(MetacardUpdater parentMetacardUpdater); UuidGenerator getUuidGenerator(); void setUuidGenerator(UuidGenerator uuidGenerator); SubjectOperations getSubjectOperations(); void setSubjectOperations(SubjectOperations subjectOperations); SecurityLogger getSecurityLogger(); void setSecurityLogger(SecurityLogger securityLogger); static final long MAX_METACARD_UPDATE_INITIAL_DELAY; }
@Test public void testSetStreamEndPlugin() throws InterruptedException { StreamMonitor streamMonitor = mock(StreamMonitor.class); UdpStreamProcessor udpStreamProcessor = new UdpStreamProcessor(streamMonitor, mockBundleContext); RolloverCondition rolloverCondition = mock(RolloverCondition.class); when(rolloverCondition.isRolloverReady(any())).thenReturn(true); StreamEndPlugin streamEndPlugin = mock(StreamEndPlugin.class); udpStreamProcessor.setStreamEndPlugin(streamEndPlugin); udpStreamProcessor.setRolloverCondition(rolloverCondition); udpStreamProcessor.setRolloverAction(mock(RolloverAction.class)); udpStreamProcessor.getPacketBuffer().write(new byte[] {0x00}); Thread.sleep(1000); udpStreamProcessor.checkForRollover(); verify(streamEndPlugin).streamEnded(any()); }