aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_iostream01.cpp
Commit message (Collapse)AuthorAgeFilesLines
* clang-tidy (C++ lint): Enable for vscode, optional @ commandline (see ↵Sven Gothel2022-11-261-0/+1
| | | | scripts/build.sh), simple lint fixes.
* ClangTidy: Fix test codeSven Gothel2022-11-211-4/+5
|
* async read_url_stream(): Add `url_header_sync` object to notify user whether ↵Sven Gothel2022-08-301-3/+9
| | | | | | | | | | | | | header is complete (or an error occured, i.e. past header streaming stage) `url_header_sync` allows user to wait until the url streamed header is completed, either - Final (http) CRLF message received - Any http header error response received - First data package received - End of operation This way content_size can be awaited and acted accordingly at read, e.g. a blocking read w/ content_size.
* Add `[[nodiscard]]` to Byte{In,Out}Stream read(), peek(), write() interface ↵Sven Gothel2022-08-051-4/+12
| | | | and all specializations, refine single byte API
* Add ByteOutStream and ByteOutStream_File POSIX 'fd' implementation, ...Sven Gothel2022-08-051-13/+10
| | | | | | - Add ByteOutStream interface - Add ByteOutStream_File implementation similar to ByteInStream_File, based on POSIX fd etc. - Add is_open() to ByteInStream and ByteOutStream interface.
* FreeBSD Support: Build infrastucture, use $os_name-$archabi, ... (1/2)Sven Gothel2022-07-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Build scripts - setup-machine-arch.sh - set os_name { 'linux' or 'freebsd' } - skip syslibdir for non linux - be quite if given arg "-quiet" - Set JAVA_HOME (if not done yet) - Set JUNIT_CP (if not done yet) - adopted all build/test scripts C++ compilation: - drop libatomic on all non Linux OS - Set SYS_INCLUDE_DIRS w/ FreeBSD += /usr/local/include, use it in compilation - FreeBSD: Set CMAKE_SYSTEM_PREFIX_PATH={/usr;/usr/local} - Use find_library() for LIBCURL_LIBNAME and LIBUNWIND_LIBNAME w/ REQUIRED if selected - Test: ownership_fix_tag: Use group 44(video) as defined in FreeBSD, Debian and Ubuntu - use 'chgrp -f' to not complain on errors, continue build OS/C++ file locations: - mini_httpd Java file locations: - openjdk - junit4 + hamcrest - IOUtil.getExeTestShellCode(): FreeBSD uses /bin/test as /bin/true is n/a (for executable temp jar dir, i.e. fat jars)
* Test w/ `mini_httpd`: Use `jau::io::uri_tk::protocol_supported("http:")` ↵Sven Gothel2022-07-071-12/+12
| | | | instead of `#ifdef USE_LIBCURL`; Fix test package for TestByteStream01 and fix Clock.cxx name
* Java: Move 'org.jau.nio' content -> 'org.jau.io' and 'org.jau.nio.Uri' -> ↵Sven Gothel2022-07-071-15/+15
| | | | ''org.jau.nio.UriTk'; C++: 'jau::io::uri' -> 'jau::io::uri_tk'
* Make io-tests flexible to detected whether protocol is supported ↵Sven Gothel2022-06-281-11/+25
| | | | (-DUSE_LIBCURL=ON or not)
* Catch2: Adopt tests to v3.0.1Sven Gothel2022-06-191-3/+0
|
* Use libcurl optional, enable via cmake option `-DUSE_LIBCURL=ON` and remove ↵Sven Gothel2022-06-181-4/+16
| | | | dependencies w/o using it
* gcc 9.4 (Ubuntu 20.04): Fix error: ignoring return value of ‘int ↵Sven Gothel2022-06-181-3/+5
| | | | system(const char*)’, declared with attribute warn_unused_result [-Werror=unused-result]
* test_*: Adopt to jau::fs::remove() changesSven Gothel2022-06-161-1/+1
|
* Bump v0.13.0: jau::io changes for robust and simplified ByteInStream usage ↵v0.13.0Sven Gothel2022-06-041-12/+78
| | | | | | | | | | | | | | | | | | sourced as file or via remote URL * `string_util.hpp`: Add `jau::to_string()` support for `std::string` and `std::string_view` as well as for `std::vector<T>` lists * Add namespace `jau::io::uri`, limited URI scheme functionality to query whether implementation may handle the protocol. - Query *libcurl* supported protocols at runtime - Test for local file protocol - Test whether protocol in given uri is supported by *libcurl* * `jau::io::read_url_stream()`, sync and async, return immediately if protocol in given url is not supportet - async variant returns `std::unique_ptr<std::thread>`, where a nullptr is used for no support * `jau::io::ByteInStream_File` recognizes the local file protocol and cuts off `file://` is used. - Fix: Recognition of a non-existing path, unaccessbile path or non-file case properly * `jau::io::ByteInStream_URL` recognizes a non supported protocol via async `jau::io::read_url_stream()`. * Added convenient `jau::io::std::unique_ptr<ByteInStream> to_ByteInStream()` - Returning either a `jau::io::ByteInStream_File`, `jau::io::ByteInStream_URL` or nullptr if `path_or_url` is not supported * Make Java class `org.jau.ney.Uri` standalone, drop dependencies for easier reusage.
* io::read_url_stream: Fix content_length (-1 == unknown), add consume_header ↵Sven Gothel2022-05-291-12/+86
| | | | | | | | | | | | | | | | | | | | | | w/ response_code for errors >= 400 and buffer.interruptReader() - curl replies -1 for unknown content_length - also consume the curl header to detect response_code errors >= 400 (404 not found) - in case of an error, we need to interrupt the ringbuffer-reader thread -> buffer.interruptReader(), otherwise the thread would be blocked until timeout and renders application to not be responsive. - interruptReader() has been added for the synchronous- and asynchronous read_url_stream() functions - interruptReader() has been exposed as ByteInStream_Feed::interruptReader() and added to ByteInStream_Feed::set_eof(). - the above is tested via test_iostream01 for synchronous- and asynchronous read_url_stream() functions using a non-existing URL entity - the above is tested via test_bytestream01 for ByteInStream_URL using a non-existing URL entity and for and ByteInStream_Feed having the feeder thread prematurely end transmission.
* ByteInStream: Add content_size methods and replace exp_size, mark/implement ↵Sven Gothel2022-05-291-3/+3
| | | | all methods noexcept, see Botan related notes; Add test_bytestream01 unit tests.
* Add IOUtils Module/Group; Rename Byte{->In}Stream interface and implementationsSven Gothel2022-05-281-2/+2
|
* test_iostream01: Test w/ actual file_sizeSven Gothel2022-05-281-0/+6
|
* Integrating byte_stream.* and io_util.* incl. unit test from Elevator ↵Sven Gothel2022-05-281-0/+153
project for better encapsulation, test and generic use Fixed: ByteStream_File::check_available(): 'm_bytes_consumed - m_content_size >= n', missed subtracting m_content_size (duh) test_iostream01 uses the fragile std::system() call to start/stop mini_httpd as the http server for testing streaming with curl.