UdpStreamProcessor implements StreamProcessor { public ChannelHandler[] createChannelHandlers() { return new ChannelHandler[] { new RawUdpDataToMTSPacketDecoder(packetBuffer, this), new MTSPacketToPESPacketDecoder(), new PESPacketToApplicationDataDecoder(), new DecodedStreamDataHandler(packetBuffer) }; } 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 testCreateChannelHandlers() { StreamMonitor streamMonitor = mock(StreamMonitor.class); when(streamMonitor.getTitle()).thenReturn(Optional.of("title")); when(streamMonitor.getStreamUri()).thenReturn(Optional.of(URI.create("udp: RolloverCondition rolloverCondition = mock(RolloverCondition.class); String filenameTemplate = "template"; FilenameGenerator filenameGenerator = mock(FilenameGenerator.class); List<MetacardType> metacardTypeList = Collections.singletonList(mock(MetacardType.class)); CatalogFramework catalogFramework = mock(CatalogFramework.class); UdpStreamProcessor udpStreamProcessor = new UdpStreamProcessor(streamMonitor, mockBundleContext); udpStreamProcessor.setRolloverCondition(rolloverCondition); udpStreamProcessor.setFilenameTemplate(filenameTemplate); udpStreamProcessor.setFilenameGenerator(filenameGenerator); udpStreamProcessor.setMetacardTypeList(metacardTypeList); udpStreamProcessor.setCatalogFramework(catalogFramework); udpStreamProcessor.setStreamCreationPlugin(context -> {}); udpStreamProcessor.setStreamShutdownPlugin(mock(StreamShutdownPlugin.class)); udpStreamProcessor.setParentMetacardUpdater(mock(MetacardUpdater.class)); udpStreamProcessor.setSecurityLogger(mock(SecurityLogger.class)); udpStreamProcessor.init(); try { assertThat(udpStreamProcessor.createChannelHandlers(), notNullValue()); } finally { udpStreamProcessor.shutdown(); } }