@Test public void testSetCompletePropertiesOk() { final Properties props = getMockedProperties(); new DeviceProfile().setProperties( props ); }
@SuppressWarnings( "rawtypes" ) final void setProperties( final Dictionary aProperties ) { final Map<String, String> newProps = new HashMap<String, String>(); Enumeration keys = aProperties.keys(); while ( keys.hasMoreElements() ) { final String key = ( String )keys.nextElement(); if ( !KNOWN_KEYS.contains( key ) && !IGNORED_KEYS.contains( key ) ) { LOG.log( Level.WARNING, "Unknown/unsupported profile key: " + key ); continue; } final String value = aProperties.get( key ).toString(); newProps.put( key, value.trim() ); } final List<String> checkedKeys = new ArrayList<String>( KNOWN_KEYS ); checkedKeys.removeAll( newProps.keySet() ); if ( !checkedKeys.isEmpty() ) { throw new IllegalArgumentException( "Profile settings not complete! Missing keys are: " + checkedKeys.toString() ); } this.properties.putAll( newProps ); LOG.log( Level.INFO, "New device profile settings applied for {1} ({0}) ...", new Object[] { getType(), getDescription() } ); }
DeviceProfile implements Cloneable, Comparable<DeviceProfile> { @SuppressWarnings( "rawtypes" ) final void setProperties( final Dictionary aProperties ) { final Map<String, String> newProps = new HashMap<String, String>(); Enumeration keys = aProperties.keys(); while ( keys.hasMoreElements() ) { final String key = ( String )keys.nextElement(); if ( !KNOWN_KEYS.contains( key ) && !IGNORED_KEYS.contains( key ) ) { LOG.log( Level.WARNING, "Unknown/unsupported profile key: " + key ); continue; } final String value = aProperties.get( key ).toString(); newProps.put( key, value.trim() ); } final List<String> checkedKeys = new ArrayList<String>( KNOWN_KEYS ); checkedKeys.removeAll( newProps.keySet() ); if ( !checkedKeys.isEmpty() ) { throw new IllegalArgumentException( "Profile settings not complete! Missing keys are: " + checkedKeys.toString() ); } this.properties.putAll( newProps ); LOG.log( Level.INFO, "New device profile settings applied for {1} ({0}) ...", new Object[] { getType(), getDescription() } ); } }
DeviceProfile implements Cloneable, Comparable<DeviceProfile> { @SuppressWarnings( "rawtypes" ) final void setProperties( final Dictionary aProperties ) { final Map<String, String> newProps = new HashMap<String, String>(); Enumeration keys = aProperties.keys(); while ( keys.hasMoreElements() ) { final String key = ( String )keys.nextElement(); if ( !KNOWN_KEYS.contains( key ) && !IGNORED_KEYS.contains( key ) ) { LOG.log( Level.WARNING, "Unknown/unsupported profile key: " + key ); continue; } final String value = aProperties.get( key ).toString(); newProps.put( key, value.trim() ); } final List<String> checkedKeys = new ArrayList<String>( KNOWN_KEYS ); checkedKeys.removeAll( newProps.keySet() ); if ( !checkedKeys.isEmpty() ) { throw new IllegalArgumentException( "Profile settings not complete! Missing keys are: " + checkedKeys.toString() ); } this.properties.putAll( newProps ); LOG.log( Level.INFO, "New device profile settings applied for {1} ({0}) ...", new Object[] { getType(), getDescription() } ); } DeviceProfile(); }
DeviceProfile implements Cloneable, Comparable<DeviceProfile> { @SuppressWarnings( "rawtypes" ) final void setProperties( final Dictionary aProperties ) { final Map<String, String> newProps = new HashMap<String, String>(); Enumeration keys = aProperties.keys(); while ( keys.hasMoreElements() ) { final String key = ( String )keys.nextElement(); if ( !KNOWN_KEYS.contains( key ) && !IGNORED_KEYS.contains( key ) ) { LOG.log( Level.WARNING, "Unknown/unsupported profile key: " + key ); continue; } final String value = aProperties.get( key ).toString(); newProps.put( key, value.trim() ); } final List<String> checkedKeys = new ArrayList<String>( KNOWN_KEYS ); checkedKeys.removeAll( newProps.keySet() ); if ( !checkedKeys.isEmpty() ) { throw new IllegalArgumentException( "Profile settings not complete! Missing keys are: " + checkedKeys.toString() ); } this.properties.putAll( newProps ); LOG.log( Level.INFO, "New device profile settings applied for {1} ({0}) ...", new Object[] { getType(), getDescription() } ); } DeviceProfile(); @Override DeviceProfile clone(); @Override int compareTo( DeviceProfile aProfile ); @Override boolean equals( final Object aObject ); CaptureClockSource[] getCaptureClock(); Integer[] getCaptureSizes(); int getChannelCount(); int getChannelGroupCount(); NumberingScheme[] getChannelNumberingSchemes(); int getClockspeed(); String getDescription(); String[] getDeviceMetadataKeys(); int getDividerClockspeed(); DeviceInterface getInterface(); int getMaximumCaptureSizeFor( final int aChannelGroups ); int getOpenPortDelay(); Integer getReceiveTimeout(); Integer[] getSampleRates(); int getTriggerStages(); String getType(); @Override int hashCode(); boolean isCaptureSizeBoundToEnabledChannels(); boolean isComplexTriggersSupported(); boolean isDoubleDataRateSupported(); boolean isNoiseFilterSupported(); boolean isOpenPortDtr(); boolean isRleSupported(); boolean isSamplesInReverseOrder(); boolean isTestModeSupported(); boolean isTriggerSupported(); @Override String toString(); }
DeviceProfile implements Cloneable, Comparable<DeviceProfile> { @SuppressWarnings( "rawtypes" ) final void setProperties( final Dictionary aProperties ) { final Map<String, String> newProps = new HashMap<String, String>(); Enumeration keys = aProperties.keys(); while ( keys.hasMoreElements() ) { final String key = ( String )keys.nextElement(); if ( !KNOWN_KEYS.contains( key ) && !IGNORED_KEYS.contains( key ) ) { LOG.log( Level.WARNING, "Unknown/unsupported profile key: " + key ); continue; } final String value = aProperties.get( key ).toString(); newProps.put( key, value.trim() ); } final List<String> checkedKeys = new ArrayList<String>( KNOWN_KEYS ); checkedKeys.removeAll( newProps.keySet() ); if ( !checkedKeys.isEmpty() ) { throw new IllegalArgumentException( "Profile settings not complete! Missing keys are: " + checkedKeys.toString() ); } this.properties.putAll( newProps ); LOG.log( Level.INFO, "New device profile settings applied for {1} ({0}) ...", new Object[] { getType(), getDescription() } ); } DeviceProfile(); @Override DeviceProfile clone(); @Override int compareTo( DeviceProfile aProfile ); @Override boolean equals( final Object aObject ); CaptureClockSource[] getCaptureClock(); Integer[] getCaptureSizes(); int getChannelCount(); int getChannelGroupCount(); NumberingScheme[] getChannelNumberingSchemes(); int getClockspeed(); String getDescription(); String[] getDeviceMetadataKeys(); int getDividerClockspeed(); DeviceInterface getInterface(); int getMaximumCaptureSizeFor( final int aChannelGroups ); int getOpenPortDelay(); Integer getReceiveTimeout(); Integer[] getSampleRates(); int getTriggerStages(); String getType(); @Override int hashCode(); boolean isCaptureSizeBoundToEnabledChannels(); boolean isComplexTriggersSupported(); boolean isDoubleDataRateSupported(); boolean isNoiseFilterSupported(); boolean isOpenPortDtr(); boolean isRleSupported(); boolean isSamplesInReverseOrder(); boolean isTestModeSupported(); boolean isTriggerSupported(); @Override String toString(); static final String DEVICE_TYPE; static final String DEVICE_DESCRIPTION; static final String DEVICE_INTERFACE; static final String DEVICE_CLOCKSPEED; static final String DEVICE_DIVIDER_CLOCKSPEED; static final String DEVICE_SUPPORTS_DDR; static final String DEVICE_SAMPLERATES; static final String DEVICE_CAPTURECLOCK; static final String DEVICE_CAPTURESIZES; static final String DEVICE_FEATURE_NOISEFILTER; static final String DEVICE_FEATURE_RLE; static final String DEVICE_FEATURE_TEST_MODE; static final String DEVICE_FEATURE_TRIGGERS; static final String DEVICE_TRIGGER_STAGES; static final String DEVICE_TRIGGER_COMPLEX; static final String DEVICE_CHANNEL_COUNT; static final String DEVICE_CHANNEL_GROUPS; static final String DEVICE_CAPTURESIZE_BOUND; static final String DEVICE_CHANNEL_NUMBERING_SCHEMES; static final String DEVICE_OPEN_PORT_DELAY; static final String DEVICE_RECEIVE_TIMEOUT; static final String DEVICE_METADATA_KEYS; static final String DEVICE_SAMPLE_REVERSE_ORDER; static final String DEVICE_OPEN_PORT_DTR; }