cosmos 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +195 -0
- data/README.md +3 -3
- data/data/crc.txt +52 -52
- data/lib/cosmos.rb +1 -1
- data/lib/cosmos/core_ext/time.rb +11 -9
- data/lib/cosmos/gui/choosers/telemetry_chooser.rb +0 -2
- data/lib/cosmos/gui/dialogs/about_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/exception_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +11 -5
- data/lib/cosmos/gui/dialogs/splash.rb +32 -10
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -1
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +2 -2
- data/lib/cosmos/gui/qt.rb +22 -22
- data/lib/cosmos/io/json_drb.rb +4 -4
- data/lib/cosmos/io/json_rpc.rb +21 -21
- data/lib/cosmos/packet_logs/packet_log_writer.rb +18 -20
- data/lib/cosmos/packets/commands.rb +8 -6
- data/lib/cosmos/packets/limits.rb +3 -2
- data/lib/cosmos/packets/packet.rb +14 -11
- data/lib/cosmos/packets/parsers/limits_parser.rb +1 -1
- data/lib/cosmos/packets/parsers/macro_parser.rb +4 -4
- data/lib/cosmos/packets/parsers/state_parser.rb +1 -1
- data/lib/cosmos/packets/structure.rb +2 -2
- data/lib/cosmos/packets/telemetry.rb +5 -4
- data/lib/cosmos/script/script.rb +6 -6
- data/lib/cosmos/streams/tcpip_socket_stream.rb +2 -1
- data/lib/cosmos/streams/template_stream_protocol.rb +1 -1
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +5 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +4 -3
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +9 -3
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +15 -11
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +1 -1
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +2 -2
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +2 -2
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +0 -2
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +1 -1
- data/lib/cosmos/tools/replay/replay.rb +2 -2
- data/lib/cosmos/tools/script_runner/script_audit.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +3 -7
- data/lib/cosmos/tools/table_manager/table_config.rb +1 -1
- data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
- data/lib/cosmos/tools/test_runner/test_runner.rb +2 -2
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +2 -1
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +1 -1
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +3 -3
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +1 -3
- data/lib/cosmos/top_level.rb +2 -6
- data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/win32_main.rb +11 -7
- data/spec/ccsds/ccsds_packet_spec.rb +28 -28
- data/spec/ccsds/ccsds_parser_spec.rb +27 -27
- data/spec/config/config_parser_spec.rb +88 -88
- data/spec/conversions/conversion_spec.rb +3 -3
- data/spec/conversions/generic_conversion_spec.rb +9 -9
- data/spec/conversions/new_packet_log_conversion_spec.rb +4 -4
- data/spec/conversions/polynomial_conversion_spec.rb +7 -7
- data/spec/conversions/processor_conversion_spec.rb +9 -9
- data/spec/conversions/received_count_conversion_spec.rb +7 -7
- data/spec/conversions/received_time_formatted_conversion_spec.rb +9 -9
- data/spec/conversions/received_time_seconds_conversion_spec.rb +9 -9
- data/spec/conversions/segmented_polynomial_conversion_spec.rb +11 -11
- data/spec/conversions/unix_time_formatted_conversion_spec.rb +13 -13
- data/spec/conversions/unix_time_seconds_conversion_spec.rb +13 -13
- data/spec/core_ext/array_spec.rb +76 -76
- data/spec/core_ext/class_spec.rb +3 -3
- data/spec/core_ext/cosmos_io_spec.rb +16 -16
- data/spec/core_ext/exception_spec.rb +19 -19
- data/spec/core_ext/file_spec.rb +16 -16
- data/spec/core_ext/hash_spec.rb +3 -3
- data/spec/core_ext/io_spec.rb +2 -2
- data/spec/core_ext/kernel_spec.rb +2 -2
- data/spec/core_ext/math_spec.rb +43 -43
- data/spec/core_ext/matrix_spec.rb +22 -22
- data/spec/core_ext/objectspace_spec.rb +6 -6
- data/spec/core_ext/range_spec.rb +2 -2
- data/spec/core_ext/socket_spec.rb +4 -4
- data/spec/core_ext/string_spec.rb +67 -67
- data/spec/core_ext/stringio_spec.rb +2 -2
- data/spec/core_ext/time_spec.rb +82 -82
- data/spec/gui/line_graph/line_clip_spec.rb +34 -34
- data/spec/interfaces/interface_spec.rb +46 -46
- data/spec/interfaces/linc_interface_spec.rb +26 -26
- data/spec/interfaces/serial_interface_spec.rb +16 -16
- data/spec/interfaces/simulated_target_interface_spec.rb +21 -21
- data/spec/interfaces/stream_interface_spec.rb +22 -22
- data/spec/interfaces/tcpip_client_interface_spec.rb +14 -14
- data/spec/interfaces/tcpip_server_interface_spec.rb +41 -41
- data/spec/interfaces/udp_interface_spec.rb +46 -46
- data/spec/io/buffered_file_spec.rb +50 -50
- data/spec/io/io_multiplexer_spec.rb +9 -9
- data/spec/io/json_drb_object_spec.rb +7 -7
- data/spec/io/json_drb_spec.rb +55 -55
- data/spec/io/json_rpc_spec.rb +68 -68
- data/spec/io/raw_logger_pair_spec.rb +28 -28
- data/spec/io/raw_logger_spec.rb +22 -22
- data/spec/io/serial_driver_spec.rb +3 -3
- data/spec/io/stderr_spec.rb +2 -2
- data/spec/io/stdout_spec.rb +2 -2
- data/spec/io/tcpip_server_spec.rb +62 -62
- data/spec/io/udp_sockets_spec.rb +19 -19
- data/spec/io/win32_serial_driver_spec.rb +10 -10
- data/spec/packet_logs/meta_packet_log_writer_spec.rb +32 -32
- data/spec/packet_logs/packet_log_reader_spec.rb +138 -138
- data/spec/packet_logs/packet_log_writer_pair_spec.rb +3 -3
- data/spec/packet_logs/packet_log_writer_spec.rb +26 -26
- data/spec/packets/binary_accessor_spec.rb +672 -672
- data/spec/packets/commands_spec.rb +123 -123
- data/spec/packets/limits_response_spec.rb +1 -1
- data/spec/packets/limits_spec.rb +69 -69
- data/spec/packets/packet_config_spec.rb +93 -93
- data/spec/packets/packet_item_limits_spec.rb +46 -46
- data/spec/packets/packet_item_spec.rb +108 -108
- data/spec/packets/packet_spec.rb +364 -348
- data/spec/packets/parsers/format_string_parser_spec.rb +13 -13
- data/spec/packets/parsers/limits_parser_spec.rb +8 -8
- data/spec/packets/parsers/limits_response_parser_spec.rb +9 -9
- data/spec/packets/parsers/macro_parser_spec.rb +34 -6
- data/spec/packets/parsers/packet_parser_spec.rb +6 -6
- data/spec/packets/parsers/processor_parser_spec.rb +7 -7
- data/spec/packets/parsers/state_parser_spec.rb +23 -23
- data/spec/packets/structure_item_spec.rb +62 -62
- data/spec/packets/structure_spec.rb +183 -183
- data/spec/packets/telemetry_spec.rb +174 -174
- data/spec/processors/new_packet_log_processor_spec.rb +4 -4
- data/spec/processors/processor_spec.rb +9 -9
- data/spec/processors/statistics_processor_spec.rb +21 -21
- data/spec/processors/watermark_processor_spec.rb +12 -12
- data/spec/script/script_spec.rb +158 -158
- data/spec/spec_helper.rb +44 -13
- data/spec/streams/burst_stream_protocol_spec.rb +8 -8
- data/spec/streams/fixed_stream_protocol_spec.rb +26 -26
- data/spec/streams/length_stream_protocol_spec.rb +27 -27
- data/spec/streams/preidentified_stream_protocol_spec.rb +25 -25
- data/spec/streams/serial_stream_spec.rb +19 -19
- data/spec/streams/stream_protocol_spec.rb +52 -52
- data/spec/streams/stream_spec.rb +1 -1
- data/spec/streams/tcpip_client_stream_spec.rb +7 -7
- data/spec/streams/tcpip_socket_stream_spec.rb +84 -49
- data/spec/streams/template_stream_protocol_spec.rb +17 -17
- data/spec/streams/terminated_stream_protocol_spec.rb +19 -19
- data/spec/system/system_spec.rb +95 -95
- data/spec/system/target_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/api_spec.rb +386 -386
- data/spec/tools/cmd_tlm_server/background_task_spec.rb +3 -3
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +8 -8
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +57 -57
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +85 -85
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +11 -11
- data/spec/tools/cmd_tlm_server/connections_spec.rb +23 -23
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +57 -57
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +17 -17
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +15 -15
- data/spec/tools/cmd_tlm_server/routers_spec.rb +36 -36
- data/spec/top_level/top_level_spec.rb +60 -60
- data/spec/utilities/crc_spec.rb +6 -6
- data/spec/utilities/csv_spec.rb +13 -13
- data/spec/utilities/logger_spec.rb +20 -20
- data/spec/utilities/message_log_spec.rb +13 -13
- data/spec/utilities/quaternion_spec.rb +30 -30
- data/spec/utilities/ruby_lex_utils_spec.rb +14 -14
- data/test/benchmarks/binary_accessor_benchmark.rb +14 -0
- data/test/benchmarks/gsub_benchmark.rb +114 -0
- data/test/performance/PACKETS.bat +1 -0
- data/test/performance/Rakefile +77 -0
- data/test/performance/THREADS.bat +1 -0
- data/test/performance/config/data/attitude.bin +0 -0
- data/test/performance/config/data/crc.txt +206 -0
- data/test/performance/config/data/diamond.STL +58 -0
- data/test/performance/config/data/groundoff.gif +0 -0
- data/test/performance/config/data/groundon.gif +0 -0
- data/test/performance/config/data/hselectoff.gif +0 -0
- data/test/performance/config/data/hselecton.gif +0 -0
- data/test/performance/config/data/hswitchoff.gif +0 -0
- data/test/performance/config/data/hswitchon.gif +0 -0
- data/test/performance/config/data/meta_init.txt +4 -0
- data/test/performance/config/data/position.bin +0 -0
- data/test/performance/config/data/poweroff.gif +0 -0
- data/test/performance/config/data/poweron.gif +0 -0
- data/test/performance/config/data/satellite.gif +0 -0
- data/test/performance/config/data/tada.wav +0 -0
- data/test/performance/config/data/vswitchoff.gif +0 -0
- data/test/performance/config/data/vswitchon.gif +0 -0
- data/test/performance/config/system/system_packets.txt +39 -0
- data/test/performance/config/system/system_threads.txt +59 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -0
- data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -0
- data/test/performance/config/targets/COSMOS/screens/version.txt +19 -0
- data/test/performance/config/targets/COSMOS/target.txt +11 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +17 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +18 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -0
- data/test/performance/config/targets/EXAMPLE/lib/example_interface.rb +22 -0
- data/test/performance/config/targets/EXAMPLE/target.txt +7 -0
- data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -0
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +34 -0
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -0
- data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -0
- data/test/performance/config/tools/handbook_creator/default_toc.xsl +59 -0
- data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -0
- data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
- data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
- data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -0
- data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -0
- data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
- data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -0
- data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
- data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
- data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
- data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -0
- data/test/performance/config/tools/launcher/launcher_packets.txt +29 -0
- data/test/performance/config/tools/launcher/launcher_threads.txt +70 -0
- data/test/performance/config/tools/limits_monitor/README.txt +1 -0
- data/test/performance/config/tools/opengl_builder/README.txt +1 -0
- data/test/performance/config/tools/script_runner/script_runner.txt +3 -0
- data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -0
- data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -0
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -0
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -0
- data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -0
- data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -0
- data/test/performance/config/tools/test_runner/test_runner.txt +17 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -0
- data/test/performance/config/tools/tlm_grapher/README.txt +1 -0
- data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +41 -0
- data/test/performance/lib/example_background_task.rb +57 -0
- data/test/performance/lib/example_target.rb +120 -0
- data/test/performance/lib/scpi_target.rb +74 -0
- data/test/performance/lib/user_version.rb +3 -0
- data/test/performance/outputs/handbooks/README.txt +1 -0
- data/test/performance/outputs/logs/README.txt +1 -0
- data/test/performance/outputs/saved_config/README.txt +1 -0
- data/test/performance/outputs/tables/README.txt +1 -0
- data/test/performance/outputs/tmp/README.txt +1 -0
- data/test/performance/procedures/checks.rb +11 -0
- data/test/performance/procedures/clear_util.rb +7 -0
- data/test/performance/procedures/collect.rb +18 -0
- data/test/performance/procedures/collect_util.rb +14 -0
- data/test/performance/procedures/cosmos_api_test.rb +293 -0
- data/test/performance/procedures/disconnect.rb +29 -0
- data/test/performance/procedures/example_test.rb +182 -0
- data/test/performance/procedures/plot_test.rb +8 -0
- data/test/performance/procedures/procedure.rb +3 -0
- data/test/performance/procedures/run_example_test.rb +3 -0
- data/test/performance/procedures/test.rb +51 -0
- data/test/performance/tools/CmdExtractor +14 -0
- data/test/performance/tools/CmdExtractor.bat +59 -0
- data/test/performance/tools/CmdSender +14 -0
- data/test/performance/tools/CmdSender.bat +59 -0
- data/test/performance/tools/CmdTlmServer +16 -0
- data/test/performance/tools/CmdTlmServer.bat +59 -0
- data/test/performance/tools/CmdTlmServerMemProf +20 -0
- data/test/performance/tools/CmdTlmServerMemProf.bat +59 -0
- data/test/performance/tools/DataViewer +14 -0
- data/test/performance/tools/DataViewer.bat +59 -0
- data/test/performance/tools/ExampleTarget +14 -0
- data/test/performance/tools/ExampleTarget.bat +59 -0
- data/test/performance/tools/HandbookCreator +14 -0
- data/test/performance/tools/HandbookCreator.bat +61 -0
- data/test/performance/tools/Launcher +14 -0
- data/test/performance/tools/Launcher.bat +59 -0
- data/test/performance/tools/LimitsMonitor +14 -0
- data/test/performance/tools/LimitsMonitor.bat +59 -0
- data/test/performance/tools/OpenGLBuilder +14 -0
- data/test/performance/tools/OpenGLBuilder.bat +59 -0
- data/test/performance/tools/PacketViewer +14 -0
- data/test/performance/tools/PacketViewer.bat +59 -0
- data/test/performance/tools/Replay +14 -0
- data/test/performance/tools/Replay.bat +59 -0
- data/test/performance/tools/ScpiTarget +14 -0
- data/test/performance/tools/ScpiTarget.bat +59 -0
- data/test/performance/tools/ScriptRunner +14 -0
- data/test/performance/tools/ScriptRunner.bat +59 -0
- data/test/performance/tools/TableManager +14 -0
- data/test/performance/tools/TableManager.bat +59 -0
- data/test/performance/tools/TestRunner +14 -0
- data/test/performance/tools/TestRunner.bat +59 -0
- data/test/performance/tools/TlmExtractor +14 -0
- data/test/performance/tools/TlmExtractor.bat +59 -0
- data/test/performance/tools/TlmGrapher +14 -0
- data/test/performance/tools/TlmGrapher.bat +59 -0
- data/test/performance/tools/TlmViewer +14 -0
- data/test/performance/tools/TlmViewer.bat +59 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -0
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -0
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -0
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/userpath.txt +1 -0
- metadata +197 -2
@@ -21,81 +21,81 @@ module Cosmos
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "initialize" do
|
24
|
-
it "
|
25
|
-
@sp.bytes_read.
|
26
|
-
@sp.bytes_written.
|
27
|
-
@sp.interface.
|
28
|
-
@sp.stream.
|
29
|
-
@sp.post_read_data_callback.
|
30
|
-
@sp.post_read_packet_callback.
|
31
|
-
@sp.pre_write_packet_callback.
|
24
|
+
it "initializes attributes" do
|
25
|
+
expect(@sp.bytes_read).to eql 0
|
26
|
+
expect(@sp.bytes_written).to eql 0
|
27
|
+
expect(@sp.interface).to be_nil
|
28
|
+
expect(@sp.stream).to be_nil
|
29
|
+
expect(@sp.post_read_data_callback).to be_nil
|
30
|
+
expect(@sp.post_read_packet_callback).to be_nil
|
31
|
+
expect(@sp.pre_write_packet_callback).to be_nil
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "interface=" do
|
36
|
-
it "
|
36
|
+
it "sets the interface" do
|
37
37
|
class MyInterface1 < Interface; end
|
38
38
|
interface = MyInterface1.new
|
39
39
|
@sp.interface = interface
|
40
|
-
@sp.interface.
|
40
|
+
expect(@sp.interface).to eql interface
|
41
41
|
end
|
42
42
|
|
43
|
-
it "
|
43
|
+
it "sets the post_read_data callback" do
|
44
44
|
class MyInterface2 < Interface
|
45
45
|
def post_read_data(buffer); 1; end
|
46
46
|
end
|
47
47
|
interface = MyInterface2.new
|
48
48
|
@sp.interface = interface
|
49
|
-
@sp.post_read_data_callback.call(nil).
|
49
|
+
expect(@sp.post_read_data_callback.call(nil)).to eql 1
|
50
50
|
end
|
51
51
|
|
52
|
-
it "
|
52
|
+
it "sets the post_read_packet callback" do
|
53
53
|
class MyInterface3 < Interface
|
54
54
|
def post_read_packet(packet); 2; end
|
55
55
|
end
|
56
56
|
interface = MyInterface3.new
|
57
57
|
@sp.interface = interface
|
58
|
-
@sp.post_read_packet_callback.call(nil).
|
58
|
+
expect(@sp.post_read_packet_callback.call(nil)).to eql 2
|
59
59
|
end
|
60
60
|
|
61
|
-
it "
|
61
|
+
it "sets the pre_write_packet callback" do
|
62
62
|
class MyInterface4 < Interface
|
63
63
|
def pre_write_packet(packet); 3; end
|
64
64
|
end
|
65
65
|
interface = MyInterface4.new
|
66
66
|
@sp.interface = interface
|
67
|
-
@sp.pre_write_packet_callback.call(nil).
|
67
|
+
expect(@sp.pre_write_packet_callback.call(nil)).to eql 3
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
describe "connect" do
|
72
|
-
it "
|
72
|
+
it "sets the stream" do
|
73
73
|
class MyStream1 < Stream; end
|
74
74
|
stream = MyStream1.new
|
75
75
|
allow(stream).to receive(:connect)
|
76
76
|
@sp.connect(stream)
|
77
|
-
@sp.stream.
|
77
|
+
expect(@sp.stream).to eql stream
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "connected" do
|
82
|
-
it "
|
83
|
-
@sp.connected
|
82
|
+
it "returns false if the stream hasn't been set" do
|
83
|
+
expect(@sp.connected?).to be_falsey
|
84
84
|
end
|
85
85
|
|
86
|
-
it "
|
86
|
+
it "returns the status of the stream connection" do
|
87
87
|
class MyStream2 < Stream
|
88
88
|
def connect; end
|
89
89
|
def connected?; true; end
|
90
90
|
end
|
91
91
|
stream = MyStream2.new
|
92
92
|
@sp.connect(stream)
|
93
|
-
@sp.connected
|
93
|
+
expect(@sp.connected?).to be_truthy
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
97
|
describe "disconnect" do
|
98
|
-
it "
|
98
|
+
it "calls disconnect on the stream" do
|
99
99
|
$test = false
|
100
100
|
class MyStream3 < Stream
|
101
101
|
def connect; end
|
@@ -103,14 +103,14 @@ module Cosmos
|
|
103
103
|
end
|
104
104
|
stream = MyStream3.new
|
105
105
|
@sp.connect(stream)
|
106
|
-
$test.
|
106
|
+
expect($test).to be_falsey
|
107
107
|
@sp.disconnect
|
108
|
-
$test.
|
108
|
+
expect($test).to be_truthy
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
112
|
describe "read" do
|
113
|
-
it "
|
113
|
+
it "reads data from the stream" do
|
114
114
|
class MyStream33 < Stream
|
115
115
|
def connect; end
|
116
116
|
def connected?; true; end
|
@@ -119,10 +119,10 @@ module Cosmos
|
|
119
119
|
stream = MyStream33.new
|
120
120
|
@sp.connect(stream)
|
121
121
|
packet = @sp.read
|
122
|
-
packet.length.
|
122
|
+
expect(packet.length).to eql 4
|
123
123
|
end
|
124
124
|
|
125
|
-
it "
|
125
|
+
it "handles timeouts from the stream" do
|
126
126
|
class MyStream4 < Stream
|
127
127
|
def connect; end
|
128
128
|
def connected?; true; end
|
@@ -130,10 +130,10 @@ module Cosmos
|
|
130
130
|
end
|
131
131
|
stream = MyStream4.new
|
132
132
|
@sp.connect(stream)
|
133
|
-
@sp.read.
|
133
|
+
expect(@sp.read).to be_nil
|
134
134
|
end
|
135
135
|
|
136
|
-
it "
|
136
|
+
it "handles a sync pattern" do
|
137
137
|
$read_cnt = 0
|
138
138
|
class MyStream5 < Stream
|
139
139
|
def connect; end
|
@@ -154,10 +154,10 @@ module Cosmos
|
|
154
154
|
stream = MyStream5.new
|
155
155
|
@sp.connect(stream)
|
156
156
|
packet = @sp.read
|
157
|
-
packet.length.
|
157
|
+
expect(packet.length).to eql 4 # sync plus two bytes
|
158
158
|
end
|
159
159
|
|
160
|
-
it "
|
160
|
+
it "handles a sync pattern split across reads" do
|
161
161
|
$read_cnt = 0
|
162
162
|
class MyStream6 < Stream
|
163
163
|
def connect; end
|
@@ -178,10 +178,10 @@ module Cosmos
|
|
178
178
|
stream = MyStream6.new
|
179
179
|
@sp.connect(stream)
|
180
180
|
packet = @sp.read
|
181
|
-
packet.length.
|
181
|
+
expect(packet.length).to eql 3 # sync plus one byte
|
182
182
|
end
|
183
183
|
|
184
|
-
it "
|
184
|
+
it "handles a false positive sync pattern" do
|
185
185
|
$read_cnt = 0
|
186
186
|
class MyStream7 < Stream
|
187
187
|
def connect; end
|
@@ -202,10 +202,10 @@ module Cosmos
|
|
202
202
|
stream = MyStream7.new
|
203
203
|
@sp.connect(stream)
|
204
204
|
packet = @sp.read
|
205
|
-
packet.length.
|
205
|
+
expect(packet.length).to eql 3 # sync plus one byte
|
206
206
|
end
|
207
207
|
|
208
|
-
it "
|
208
|
+
it "discards leading bytes from the stream" do
|
209
209
|
class MyStream8 < Stream
|
210
210
|
def connect; end
|
211
211
|
def connected?; true; end
|
@@ -217,11 +217,11 @@ module Cosmos
|
|
217
217
|
stream = MyStream8.new
|
218
218
|
@sp.connect(stream)
|
219
219
|
packet = @sp.read
|
220
|
-
packet.length.
|
221
|
-
packet.buffer.formatted.
|
220
|
+
expect(packet.length).to eql 2
|
221
|
+
expect(packet.buffer.formatted).to match(/03 04/)
|
222
222
|
end
|
223
223
|
|
224
|
-
it "
|
224
|
+
it "calls the post_read_data method on the inteface" do
|
225
225
|
class MyStream9 < Stream
|
226
226
|
def connect; end
|
227
227
|
def connected?; true; end
|
@@ -237,8 +237,8 @@ module Cosmos
|
|
237
237
|
stream = MyStream9.new
|
238
238
|
@sp.connect(stream)
|
239
239
|
packet = @sp.read
|
240
|
-
packet.length.
|
241
|
-
packet.buffer.formatted.
|
240
|
+
expect(packet.length).to eql 4
|
241
|
+
expect(packet.buffer.formatted).to match(/00 01 02 03/)
|
242
242
|
|
243
243
|
# Simulate the interface returning an empty string which means to skip
|
244
244
|
# this packet and go back to reading data.
|
@@ -257,7 +257,7 @@ module Cosmos
|
|
257
257
|
interface = MyInterface5.new
|
258
258
|
@sp.interface = interface
|
259
259
|
packet = @sp.read
|
260
|
-
packet.length.
|
260
|
+
expect(packet.length).to eql 2
|
261
261
|
|
262
262
|
# Simulate the interface returning nil which means the connection is
|
263
263
|
# lost.
|
@@ -268,10 +268,10 @@ module Cosmos
|
|
268
268
|
interface = MyInterface5.new
|
269
269
|
@sp.interface = interface
|
270
270
|
packet = @sp.read
|
271
|
-
packet.
|
271
|
+
expect(packet).to be_nil
|
272
272
|
end
|
273
273
|
|
274
|
-
it "
|
274
|
+
it "calls the post_read_packet method on the inteface" do
|
275
275
|
class MyStream10 < Stream
|
276
276
|
def connect; end
|
277
277
|
def connected?; true; end
|
@@ -290,13 +290,13 @@ module Cosmos
|
|
290
290
|
stream = MyStream10.new
|
291
291
|
@sp.connect(stream)
|
292
292
|
packet = @sp.read
|
293
|
-
packet.length.
|
294
|
-
packet.buffer.formatted.
|
293
|
+
expect(packet.length).to eql 4
|
294
|
+
expect(packet.buffer.formatted).to match(/00 01 02 03/)
|
295
295
|
end
|
296
296
|
end
|
297
297
|
|
298
298
|
describe "write" do
|
299
|
-
it "
|
299
|
+
it "calls pre_write_packet on the interface" do
|
300
300
|
$buffer = ''
|
301
301
|
class MyStream11 < Stream
|
302
302
|
def connect; end
|
@@ -310,10 +310,10 @@ module Cosmos
|
|
310
310
|
@sp.interface = MyInterface7.new
|
311
311
|
@sp.connect(MyStream11.new)
|
312
312
|
@sp.write(packet)
|
313
|
-
$buffer.
|
313
|
+
expect($buffer).to eql "\x01\02\03\04"
|
314
314
|
end
|
315
315
|
|
316
|
-
it "
|
316
|
+
it "writes the packet buffer to the stream" do
|
317
317
|
$buffer = ''
|
318
318
|
class MyStream11 < Stream
|
319
319
|
def connect; end
|
@@ -323,12 +323,12 @@ module Cosmos
|
|
323
323
|
packet = Packet.new(nil, nil, :BIG_ENDIAN, nil, "\x01\x02\x03\x04")
|
324
324
|
@sp.connect(MyStream11.new)
|
325
325
|
@sp.write(packet)
|
326
|
-
$buffer.
|
326
|
+
expect($buffer).to eql "\x01\02\03\04"
|
327
327
|
end
|
328
328
|
end
|
329
329
|
|
330
330
|
describe "write_raw" do
|
331
|
-
it "
|
331
|
+
it "writes the raw buffer to the stream" do
|
332
332
|
$buffer = ''
|
333
333
|
class MyStream11 < Stream
|
334
334
|
def connect; end
|
@@ -337,7 +337,7 @@ module Cosmos
|
|
337
337
|
end
|
338
338
|
@sp.connect(MyStream11.new)
|
339
339
|
@sp.write_raw("\x01\x02\x03\x04")
|
340
|
-
$buffer.
|
340
|
+
expect($buffer).to eql "\x01\02\03\04"
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
data/spec/streams/stream_spec.rb
CHANGED
@@ -16,7 +16,7 @@ module Cosmos
|
|
16
16
|
describe Stream do
|
17
17
|
|
18
18
|
describe "read, write, connected?, disconnect" do
|
19
|
-
it "
|
19
|
+
it "raises an error" do
|
20
20
|
expect { Stream.new.read }.to raise_error(/not defined/)
|
21
21
|
expect { Stream.new.write(nil) }.to raise_error(/not defined/)
|
22
22
|
expect { Stream.new.connect }.to raise_error(/not defined/)
|
@@ -27,28 +27,28 @@ module Cosmos
|
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "initialize" do
|
30
|
-
it "
|
30
|
+
it "complains if the host is bad" do
|
31
31
|
expect { TcpipClientStream.new('asdf',8888,8888,nil,nil) }.to raise_error(/Invalid hostname/)
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "uses the same socket if read_port == write_port" do
|
35
35
|
ss = TcpipClientStream.new('localhost',8888,8888,nil,nil)
|
36
36
|
ss.connect
|
37
|
-
ss.connected
|
37
|
+
expect(ss.connected?).to be_truthy
|
38
38
|
ss.disconnect
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "creates the write socket" do
|
42
42
|
ss = TcpipClientStream.new('localhost',8888,nil,nil,nil)
|
43
43
|
ss.connect
|
44
|
-
ss.connected
|
44
|
+
expect(ss.connected?).to be_truthy
|
45
45
|
ss.disconnect
|
46
46
|
end
|
47
47
|
|
48
|
-
it "
|
48
|
+
it "creates the read socket" do
|
49
49
|
ss = TcpipClientStream.new('localhost',nil,8888,nil,nil)
|
50
50
|
ss.connect
|
51
|
-
ss.connected
|
51
|
+
expect(ss.connected?).to be_truthy
|
52
52
|
ss.disconnect
|
53
53
|
end
|
54
54
|
end
|
@@ -10,76 +10,111 @@
|
|
10
10
|
|
11
11
|
require 'spec_helper'
|
12
12
|
require 'cosmos/streams/tcpip_socket_stream'
|
13
|
+
require 'socket'
|
13
14
|
|
14
15
|
module Cosmos
|
15
16
|
|
16
17
|
describe TcpipSocketStream do
|
17
18
|
describe "initialize, connected?" do
|
18
|
-
it "
|
19
|
+
it "is not be connected when initialized" do
|
19
20
|
ss = TcpipSocketStream.new(nil,nil,nil,nil)
|
20
|
-
ss.connected
|
21
|
+
expect(ss.connected?).to be false
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
25
|
describe "read" do
|
25
|
-
it "
|
26
|
+
it "raises an error if no read socket given" do
|
26
27
|
ss = TcpipSocketStream.new('write',nil,nil,nil)
|
27
28
|
ss.connect
|
28
29
|
expect { ss.read }.to raise_error("Attempt to read from write only stream")
|
29
30
|
end
|
30
31
|
|
31
|
-
it "
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
it "calls read_nonblock from the socket" do
|
33
|
+
server = TCPServer.new(2000) # Server bound to port 2000
|
34
|
+
thread = Thread.new do
|
35
|
+
loop do
|
36
|
+
client = server.accept # Wait for a client to connect
|
37
|
+
sleep 0.1
|
38
|
+
client.write "test"
|
39
|
+
client.close
|
40
|
+
end
|
41
|
+
end
|
42
|
+
socket = TCPSocket.new('localhost', 2000)
|
43
|
+
ss = TcpipSocketStream.new(nil,socket,nil,nil)
|
44
|
+
expect(ss.read_nonblock).to eql ''
|
45
|
+
sleep 0.2
|
46
|
+
expect(ss.read_nonblock).to eql 'test'
|
47
|
+
Cosmos.close_socket(socket)
|
48
|
+
Cosmos.close_socket(server)
|
49
|
+
thread.kill
|
50
|
+
sleep 0.1
|
37
51
|
end
|
38
52
|
|
39
|
-
it "
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
'test'
|
53
|
+
it "handles socket blocking exceptions" do
|
54
|
+
server = TCPServer.new(2000) # Server bound to port 2000
|
55
|
+
thread = Thread.new do
|
56
|
+
loop do
|
57
|
+
client = server.accept # Wait for a client to connect
|
58
|
+
sleep 0.2
|
59
|
+
client.write "test"
|
60
|
+
client.close
|
48
61
|
end
|
49
62
|
end
|
50
|
-
|
51
|
-
|
52
|
-
ss
|
53
|
-
|
54
|
-
|
63
|
+
socket = TCPSocket.new('localhost', 2000)
|
64
|
+
ss = TcpipSocketStream.new(nil,socket,nil,nil)
|
65
|
+
expect(ss.read).to eql 'test'
|
66
|
+
Cosmos.close_socket(socket)
|
67
|
+
Cosmos.close_socket(server)
|
68
|
+
thread.kill
|
69
|
+
sleep 0.1
|
55
70
|
end
|
56
71
|
|
57
|
-
it "
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
72
|
+
it "handles socket timeouts" do
|
73
|
+
server = TCPServer.new(2000) # Server bound to port 2000
|
74
|
+
thread = Thread.new do
|
75
|
+
loop do
|
76
|
+
client = server.accept # Wait for a client to connect
|
77
|
+
sleep 0.2
|
78
|
+
client.close
|
79
|
+
end
|
80
|
+
end
|
81
|
+
socket = TCPSocket.new('localhost', 2000)
|
82
|
+
ss = TcpipSocketStream.new(nil,socket,nil,0.1)
|
63
83
|
expect { ss.read }.to raise_error(Timeout::Error)
|
84
|
+
sleep 0.2
|
85
|
+
Cosmos.close_socket(socket)
|
86
|
+
Cosmos.close_socket(server)
|
87
|
+
thread.kill
|
88
|
+
sleep 0.1
|
64
89
|
end
|
65
90
|
|
66
|
-
it "
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
91
|
+
it "handles socket connection reset exceptions" do
|
92
|
+
server = TCPServer.new(2000) # Server bound to port 2000
|
93
|
+
thread = Thread.new do
|
94
|
+
loop do
|
95
|
+
client = server.accept # Wait for a client to connect
|
96
|
+
client.close
|
97
|
+
end
|
98
|
+
end
|
99
|
+
socket = TCPSocket.new('localhost', 2000)
|
100
|
+
ss = TcpipSocketStream.new(nil,socket,nil,5)
|
101
|
+
# Close the socket before trying to read from it
|
102
|
+
Cosmos.close_socket(socket)
|
103
|
+
expect(ss.read).to eql ''
|
104
|
+
Cosmos.close_socket(server)
|
105
|
+
thread.kill
|
106
|
+
sleep 0.1
|
72
107
|
end
|
73
108
|
end
|
74
109
|
|
75
110
|
describe "write" do
|
76
|
-
it "
|
111
|
+
it "raises an error if no write port given" do
|
77
112
|
ss = TcpipSocketStream.new(nil,'read',nil,nil)
|
78
113
|
ss.connect
|
79
114
|
expect { ss.write('test') }.to raise_error("Attempt to write to read only stream")
|
80
115
|
end
|
81
116
|
|
82
|
-
it "
|
117
|
+
it "calls write from the driver" do
|
83
118
|
write = double("write_socket")
|
84
119
|
# Simulate only writing two bytes at a time
|
85
120
|
expect(write).to receive(:write_nonblock).twice.and_return(2)
|
@@ -88,7 +123,7 @@ module Cosmos
|
|
88
123
|
ss.write('test')
|
89
124
|
end
|
90
125
|
|
91
|
-
it "
|
126
|
+
it "handles socket blocking exceptions" do
|
92
127
|
write = double("write_socket")
|
93
128
|
allow(write).to receive(:write_nonblock) do
|
94
129
|
case $index
|
@@ -106,7 +141,7 @@ module Cosmos
|
|
106
141
|
ss.write('test')
|
107
142
|
end
|
108
143
|
|
109
|
-
it "
|
144
|
+
it "handles socket timeouts" do
|
110
145
|
write = double("write_socket")
|
111
146
|
allow(write).to receive(:write_nonblock).and_raise(Errno::EWOULDBLOCK)
|
112
147
|
expect(IO).to receive(:select).at_least(:once).and_return(nil)
|
@@ -117,39 +152,39 @@ module Cosmos
|
|
117
152
|
end
|
118
153
|
|
119
154
|
describe "disconnect" do
|
120
|
-
it "
|
155
|
+
it "closes the write socket" do
|
121
156
|
write = double("write_socket")
|
122
157
|
expect(write).to receive(:closed?).and_return(false)
|
123
158
|
expect(write).to receive(:close)
|
124
159
|
ss = TcpipSocketStream.new(write,nil,nil,nil)
|
125
160
|
ss.connect
|
126
|
-
ss.connected
|
161
|
+
expect(ss.connected?).to be_truthy
|
127
162
|
ss.disconnect
|
128
|
-
ss.connected
|
163
|
+
expect(ss.connected?).to be_falsey
|
129
164
|
end
|
130
165
|
|
131
|
-
it "
|
166
|
+
it "closes the read socket" do
|
132
167
|
read = double("read_socket")
|
133
168
|
expect(read).to receive(:closed?).and_return(false)
|
134
169
|
expect(read).to receive(:close)
|
135
170
|
ss = TcpipSocketStream.new(nil,read,nil,nil)
|
136
171
|
ss.connect
|
137
|
-
ss.connected
|
172
|
+
expect(ss.connected?).to be_truthy
|
138
173
|
ss.disconnect
|
139
|
-
ss.connected
|
174
|
+
expect(ss.connected?).to be_falsey
|
140
175
|
end
|
141
176
|
|
142
|
-
it "
|
177
|
+
it "does not close the socket twice" do
|
143
178
|
socket = double("socket")
|
144
179
|
expect(socket).to receive(:closed?).and_return(false, true, true, true)
|
145
180
|
expect(socket).to receive(:close).once
|
146
181
|
ss = TcpipSocketStream.new(socket,socket,nil,nil)
|
147
182
|
ss.connect
|
148
|
-
ss.connected
|
183
|
+
expect(ss.connected?).to be_truthy
|
149
184
|
ss.disconnect
|
150
|
-
ss.connected
|
185
|
+
expect(ss.connected?).to be_falsey
|
151
186
|
ss.disconnect
|
152
|
-
ss.connected
|
187
|
+
expect(ss.connected?).to be_falsey
|
153
188
|
end
|
154
189
|
end
|
155
190
|
|