UdpStreamMonitor implements StreamMonitor { public void setMonitoredAddress(String monitoredAddress) { notNull(monitoredAddress, "monitoredAddress must be non-null"); URI uri; try { uri = new URI(monitoredAddress); InetAddress.getByName(uri.getHost()); if (uri.getScheme() == null || !uri.getScheme().equals("udp")) { throw new URISyntaxException(uri.toString(), "Monitored Address is not UDP protocol"); } } catch (UnknownHostException | URISyntaxException e) { throw new IllegalArgumentException( String.format( "the monitored address could not be resolved: monitoredAddress=%s", monitoredAddress)); } inclusiveBetween(MONITORED_PORT_MIN, MONITORED_PORT_MAX, uri.getPort()); this.streamUri = uri; this.monitoredPort = uri.getPort(); this.monitoredAddress = uri.getHost(); } UdpStreamMonitor(final BundleContext bundleContext);   UdpStreamMonitor(UdpStreamProcessor udpStreamProcessor); void setStreamCreationPlugin(StreamCreationPlugin streamCreationPlugin); void setStreamShutdownPlugin(StreamShutdownPlugin streamShutdownPlugin); Boolean getStartImmediately(); void setStartImmediately(Boolean startImmediately); Double getDistanceTolerance(); void setDistanceTolerance(Double distanceTolerance); String getNetworkInterface(); void setNetworkInterface(String networkInterface); void setParentMetacardUpdater(MetacardUpdater parentMetacardUpdater); Long getMetacardUpdateInitialDelay(); void setMetacardUpdateInitialDelay(Long metacardUpdateInitialDelay); void setFilenameGenerator(FilenameGenerator filenameGenerator); void setFilenameTemplate(String template); String getFileNameTemplate(); void setRolloverCondition(RolloverCondition rolloverCondition); void setUuidGenerator(final UuidGenerator uuidGenerator); void init(); @Override void startMonitoring(); @Override void stopMonitoring(); @Override boolean isMonitoring(); void setParentTitle(String parentTitle); String getStartDateAsString(); @Override Optional<URI> getStreamUri(); @Override Optional<String> getTitle(); void setMetacardTypeList(List<MetacardType> metacardTypeList); void setCatalogFramework(CatalogFramework catalogFramework); void destroy(int arg); void setStreamEndPlugin(StreamEndPlugin streamEndPlugin); void updateCallback(Map<String, Object> properties); String getMonitoredAddress(); void setMonitoredAddress(String monitoredAddress); Integer getByteCountRolloverCondition(); void setMegabyteCountRolloverCondition(Integer count); Long getElapsedTimeRolloverCondition(); void setElapsedTimeRolloverCondition(Long milliseconds); static final long MEGABYTE_COUNT_MIN; static final long MEGABYTE_COUNT_MAX; static final long ELAPSED_TIME_MIN; static final long ELAPSED_TIME_MAX; static final String METATYPE_TITLE; static final String METATYPE_MONITORED_ADDRESS; static final String METATYPE_BYTE_COUNT_ROLLOVER_CONDITION; static final String METATYPE_ELAPSED_TIME_ROLLOVER_CONDITION; static final String METATYPE_METACARD_UPDATE_INITIAL_DELAY; static final String METATYPE_FILENAME_TEMPLATE; static final String METATYPE_DISTANCE_TOLERANCE; static final String METATYPE_NETWORK_INTERFACE; }
@Test(expected = IllegalArgumentException.class) public void testMonitoredAddressNoProtocol() { String addr = "127.0.0.1:50000"; udpStreamMonitor.setMonitoredAddress(addr); }
@Test(expected = IllegalArgumentException.class) public void testMonitoredAddressUnsupportedProtocol() { String addr = "tcp: udpStreamMonitor.setMonitoredAddress(addr); }
@Test(expected = IllegalArgumentException.class) public void testMonitoredAddressNoPort() { String addr = "udp: udpStreamMonitor.setMonitoredAddress(addr); }
@Test(expected = NullPointerException.class) public void testMonitoredAddressNullArg() { udpStreamMonitor.setMonitoredAddress(null); }
@Test(expected = IllegalArgumentException.class) public void testMonitoredAddressUnresolvableArg() { udpStreamMonitor.setMonitoredAddress("127.0.0.0.1"); }