summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common
Commit message (Collapse)AuthorAgeFilesLines
* TestByteBufferCopyStream, TestByteBufferInputStream: Reduce load and test timeSven Gothel2014-10-032-22/+25
|
* MappedByteBuffer*Stream:Sven Gothel2014-10-033-189/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Validate active and GC'ed mapped-buffer count in cleanAllSlices() via close() .. - Fix missing unmapping last buffer in notifyLengthChangeImpl(), branch criteria was off by one. - cleanSlice(..) now also issues cleanBuffer(..) on the GC'ed entry, hence if WeakReference is still alive, enforce it's release. - cleanBuffer(..) reverts FLUSH_PRE_HARD -> FLUSH_PRE_SOFT in case of an error. - flush() -> flush(boolean metaData) to expose FileChannel.force(metaData). - Add synchronous mode, flushing/syncing the mapped buffers when in READ_WRITE mapping mode and issue FileChannel.force() if not READ_ONLY. Above is implemented via flush()/flushImpl(..) for buffers and FileChannel, as well as in syncSlice(..) for buffers only. flush*()/syncSlice() is covered by: - setLength() - notifyLengthChange*(..) - nextSlice() Always issue flushImpl() in close(). - Windows: Clean all buffers in setLength(), otherwise Windows will report: - Windows: Catch MappedByteBuffer.force() IOException - Optimization of position(..) position(..) is now standalone to allow issuing flushSlice(..) before gathering the new mapped buffer. This shall avoid one extra cache miss. Hence rename positionImpl(..) -> position2(..). - All MappedByteBufferOutputStream.write(..) methods issue syncSlice(..) on the last written current slice to ensure new 'synchronous' mode is honored. +++ Unit tests: - Ensure test files are being deleted - TestByteBufferCopyStream: Reduced test file size to more sensible values. -
* Bug 1080 - Refine MappedByteBuffer*Stream impl. and API [doc], adding stream ↵Sven Gothel2014-09-293-14/+191
| | | | to stream copy as well as direct memory mapped ByteBuffer access
* Bug 1080 - Add write support for memory mapped big file I/O via specialized ↵Sven Gothel2014-09-262-1/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OutputStream impl. Added MappedByteBufferOutputStream as a child instance of MappedByteBufferInputStream, since the latter already manages the file's mapped buffer slices. Current design is: - MappedByteBufferInputStream (parent) - MappedByteBufferOutputStream this is due to InputStream and OutputStream not being interfaces, but most functionality is provided in one class. We could redesign both as follows: - MappedByteBufferIOStream (parent) - MappedByteBufferInputStream - MappedByteBufferOutputStream This might visualize things better .. dunno whether its worth the extra redirection. +++ MappedByteBufferInputStream: - Adding [file] resize support via custom FileResizeOp - All construction happens via ctors - Handle refCount, incr. by ctor and getOutputStream(..), decr by close - Check whether stream is closed already -> IOException - Simplify / Reuse code MappedByteBufferOutputStream: - Adding simple write operations
* Bug 1080 - Fix TestByteBufferInputStream: Handle OutOfMemoryError cause in ↵Sven Gothel2014-09-261-26/+43
| | | | IOException (Add note to FLUSH_NONE); Reduce test load / duration.
* Bug 1080 - Add read support for memory mapped big file I/O via specialized ↵Sven Gothel2014-09-251-0/+334
| | | | | | | | | | | | | | | InputStream impl., incl. mark/reset - ByteBufferInputStream simply impl. InputStream for an arbitrary 2MiB restricted ByteBuffer - Users may only need a smaller implementation for 'smaller' file sizes or for streaming a [native] ByteBuffer. - MappedByteBufferInputStream impl. InputStream for any file size, while slicing the total size to memory mapped buffers via the given FileChannel. The latter are mapped lazily and diff. flush/cache methods are supported to ease virtual memory usage. - TestByteBufferInputStream: Basic unit test for basic functionality and perf. stats.
* Bug 1063: Uri: Refine API doc; Add create(Encoded ..) ; Provide common impl. ↵Sven Gothel2014-09-102-24/+148
| | | | | | | | | | | | | | | | | | | | for getNormalized(), getDirectory(), getParent() and getRelativeOf() - Refine API doc - Add notion of {@code host} and {@code port} validation - Add create(Encoded ..), allowing creation of variants w/o re-encoding - Provide common impl. for getNormalized(), getDirectory(), getParent() and getRelativeOf() Above feature methods share common goals, hence use same implementation: - If opaque, cut-off query and merge after operation - cleanup path, i.e. /dummy/../test/ -> /test/ - cutoff file, dir - if requested - append optional appendix and cleanup again Return behavior various thought, i.e. null, this or allow exception. Enhanced test of above features.
* Bug 1063: Further Uri completion - As a result of JOGL Uri adoptionSven Gothel2014-09-081-11/+10
|
* Bug 1063: Complete Uri impl. and adoption throughout GlueGenSven Gothel2014-09-086-289/+338
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Uri: - Add error correction (fix) of path at ctor in case a a contained Uri is requested from an opaque one. The latter might come from URI/URL and is not properly encoded! See Uri.PARSE_HINT_FIX_PATH - Simplify conversion methods: - valueOf(URI/URL): Re-encode only if not opaque - getNativeFilePath() -> toFile() - Move IOUtil Uri related constants to class Uri - Add DEBUG and DEBUG_SHOWFIX - Complete adoption of URI -> Uri changes - IOUtil, JarUtil and TempJarCache still holds some left over deprecated methods, which will be removed after officially starting 2.3.0 (JOGL dependencies) - Otherwise not URI utilization left - Tests - Cleaned ip TestUri01 and TestUri03Resolving - TestUri03Resolving also tests URL -> Uri, and hence mentioned Uri.PARSE_HINT_FIX_PATH
* Bug 1063 - Refine Uri and Uri.Encode ; Fix unit tests (passing on GNU/Linux, ↵Sven Gothel2014-09-072-52/+31
| | | | | | | | | | | | | OSX and Windows) - Refine Uri - remove System.err.print* - scheme is of type Encode - Refine Uri.Encode - substring(..) shall return type Encode - Fix unit tests (passing on GNU/Linux, OSX and Windows)
* Bug 1063 - Uri.PATH_LEGAL: Remove reserved 'punct', encoding all reserved ↵Sven Gothel2014-09-071-15/+14
| | | | chars but '!', allows removal of PATH_MIN_LEGAL ; Add comment for Harmony values for review
* Bug 1063 - Utilize own Uri and Uri.Encoded class w/ proper encoding and ↵Sven Gothel2014-09-0710-100/+497
| | | | | | | | | | | | differentiating encoded/decoded variants by type [Part 1] - Add immutable com.jogamp.common.net.Uri class impl. RFC 2396 w/ encoding of RFC 3986 - Class Uri.Encoded is used to represent encoded parts - IOUtil: Remove unused methods (residing in Uri) and mark others deprecated (will move to Uri) - Adopt usage of Uri: This must be completet in follow-up commits!
* Bug 908: Fix URI/URL double encoding, ensuring encoded/decoded variants are ↵Sven Gothel2014-09-074-199/+333
| | | | | | | | | | | | | | | | | | | | used properly (Added unit test) Bug 908 was caused by confusing URI encoded parts (e.g. scheme-specific-part) and it's decoded variant. This especially happened due to: - the fact, that the encoded and unencoded variant uses the same String type, - the URI/URL decoding differs, is not complete (e.g. %20 .. SPACE remains in decoded part), - and does not comply w/ RFC 2396 and RFC 3986 (encoding), e.g. not all RESERVED chars are encoded. In branch 'v2.3.0_branch', we will introduce our own Uri and Uri.Encoded class to solve above issue by replacing all URI usage w/ Uri. - Backporting results of own Uri class introduction in branch 'v2.3.0_branch' - Ensure the encoded URI parts are used where required, i.e. IOUtil.compose(..) etc - TestNetIOURIReservedCharsBug908: Automated test, launching GlueGen jar file from an <i>odd pathname</i>.
* TestVersionSemantics: BACKWARD_COMPATIBLE_USER current vs 2.2.0Sven Gothel2014-08-281-2/+3
|
* IntIntHashMap: Reduce temp. ArrayList<Entry> instances in cloneSven Gothel2014-08-163-3/+9
|
* Merge remote-tracking branch 'github-mark/master' (Bug 1023, Bug 1024)Sven Gothel2014-07-051-15/+0
|\ | | | | | | | | | | | | | | | | Conflicts: src/java/com/jogamp/common/jvm/JNILibLoaderBase.java src/java/com/jogamp/common/os/Platform.java src/junit/com/jogamp/common/util/TestTempJarCache.java (re-injected that api-doc of addNativeJarLibsImpl)
| * Remove unused addNativeJarLibs() method; the only consumer was a unit testMark Raynsford2014-06-261-15/+0
| | | | | | | | of the method.
* | Code Clean-Up based on our Recommended Settings (jogamp-scripting ↵Sven Gothel2014-07-0348-1057/+1057
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
* | Fix 'typo' in messages: 'Catched' -> 'Caught'Sven Gothel2014-06-281-1/+1
|/
* TestVersionSemantics: No more expecting BACKWARD_COMPATIBLE* (Due to bumping ↵Sven Gothel2014-06-171-1/+1
| | | | to 2.2.0)
* Bump semver.jar to 731db3566b4096ecf6a08a9d33991400e66c5021 (sgothel/jogamp ↵Sven Gothel2014-05-131-2/+1
| | | | branch): Using direct regexp for excludes
* Unit Test: Modularize Semantic Version Test / Fix 'excludes'Sven Gothel2014-05-131-73/+25
| | | | | | | Refactor base semjar unit test class into com.jogamp.junit.util.VersionSemanticsUtil, part of new gluegen-test-util.jar. The new gluegen-test-util.jar shall be used by all other modules to test versioning.
* Unit Test: Added Semantic Version Test (Current version agains v2.1.5)Sven Gothel2014-05-131-0/+149
| | | | | | | | | | | | | TestVersionSemantics adds testing of semantic versioning of 2.1.5 gluegen-rt.jar against the current version within a unit test. Currently we expect BACKWARD_COMPATIBLE_USER and need to toggle this to NON_BACKWARD_COMPATIBLE, if actually perfoming non compatible major or minor version changes. The latter is allowed right now, since we increment from 2.1 -> 2.2! - Added https://github.com/jeluard/semantic-versioning semver.jar (Apache License Version 2.0)
* Bug 980: Refine Bitstream API 'signed' and 'unsigned' semantics - ↵Sven Gothel2014-02-215-44/+61
| | | | readUInt32(..) must return long due to EOF
* Bitstream: Refine c70c730b22c847668cf475dc6f841b85297ac3ab: 'toUint32Long' ↵Sven Gothel2014-02-212-4/+4
| | | | -> 'toUInt32Long', add 'uint32LongtoInt'
* Bitstream: Add static 'long toUint32Long(int)' and 'int toUint32Int(int)' ↵Sven Gothel2014-02-212-3/+28
| | | | conversion functions
* Bug 890: Adding versatile Bitstream implementationSven Gothel2014-02-206-0/+1021
| | | | | | | | | | | | | | | | We already have several locations where bitstream operations are required and partially implemented (JPEG decoder, media parsing, ..) as well as endian related conversion (elf parser, ..). Create a versatile Bitstream class allowing: - Utilize I/O operations on I/O streams, buffers and arrays - Consider MSBfirst / LSBfirst mode - Linear bit R/W operations - Bulk R/W operations w/ endian related type conversion - Allow mark/reset and switching streams and input/output mode - Optimized operations Complete set of unit tests included, covering hopefully all cases.
* Bug 945 - GlueGen's IOUtil does not consider file URI's authority when ↵Sven Gothel2014-01-221-13/+26
| | | | | | | | | | | | | | | | | | | | | | | converting to file-path or URI (Windows UNC / share host) Note: Authority for 'file-scheme' URI's is used on Windows to denote the host of the shared resource -> UNC Following methods of IOUtil didn't consider the authority for file-scheme URI: 'URL toURL(final URI uri)' 'String decodeURIToFilePath(final String uriPath)' 'String decodeURIIfFilePath(final URI uri)' Further more, the patterns 'patternSingleFS' and 'patternSingleBS' converted multiple '\' '/' to one replacement. However, we should not change the separator count and replace them one-by-one. TestIOUtilURIHandling: - Added shared-file-host 'filehost' test cases to file URIs and plain file path tests. - Passed on Unix and Windows. Added 'make/scripts/test-win32-smb_share.bat' - Testing actual windows share usage - Passed on Windows
* IOUtil.encodeToURI(): Only use method if requiredSven Gothel2013-11-281-0/+110
| | | | | | | Only use IOUtil.encodeToURI() if required, i.e. 'new URI(String)' but not 'new URI(scheme, ...)' since the latter already encodes the path. TestIOUtilURIHandling.test00BasicCoding() validates above findings.
* IOUtil.toURL(..) Apply decodeFromURI(uri.getPath()) if file-scheme; Add ↵Sven Gothel2013-11-281-16/+168
| | | | | | | | | | | | | | | | | | | IOUtil.decodeURIToFilePath(..) for native usage. Refine comments, API doc. toURL(..): Apply space conversion, decodeFromURI(..), on file-scheme path, ensuring decoded space. ++ Add decodeURIToFilePath(String uriPath) and decodeURIToFilePath(URI uri) Both methods shall simplify decoding a file-URI for native platform usage. Tested in TestIOUtilURIHandling +++
* Use org.junit.Assert instead of deprecated junit.framework.AssertSven Gothel2013-10-246-171/+165
|
* Fix Bug 857: GlueGen produces erroneous file URI on Windows, which breaks ↵Sven Gothel2013-10-186-241/+391
| | | | | | | | | | | | | | | | | | | | | | | | | Netbeans's JarURLStreamHandler - 'URL IOUtil.toURL(URI)' - Needs to encode the file-path portion on Windows(*) if exists. The file-path here shall only be encoded as follows: - backslash -> slash - ensure starting with slash (*) We perform above action for all OS, if 'false == File.separator.equals("/")' - Added high verbosity in DEBUG mode to easy debugging for future cases .. - Cleanup URI/URL unit tests, i.e. split URLCompositionTest into: - TestIOUtilURICompose - TestIOUtilURIHandling (Now covers Bug 857 as well) - TestUrisWithAssetHandler - TestURIQueryProps Tested all unit tests manually on GNU/Linux and Windows w/ JRE 7u45
* Bug 845: Add support for one big-fat jar file [java classes plus all native ↵Sven Gothel2013-10-011-2/+2
| | | | | | | | | | | | | | | | 'os.and.arch' libraries] JNILibLoaderBase.addNativeJarLibsImpl(..): If the modules's jar file contains the folder 'natives/<os.and.arch>/' we assume a big-fat jar and attempt to load all native libraries from the same. The test for above folder is performed via the class ClassLoader's getResource(..) and is considered inexpensive. If the folder exists and native libraries could be loaded, the method returns successfull. Otherwise, the 'slim' jar file is attempted to be loaded, even if such folder exist.
* Fix Bug 844: Cannot ctor URI w/ scheme alone, use string-based concatenation ↵Sven Gothel2013-10-011-1/+1
| | | | native URI root and jar file.
* Add '@FixMethodOrder(MethodSorters.NAME_ASCENDING)' to all *Test* classesSven Gothel2013-08-3130-0/+120
|
* Bump junit 4.8.2 -> 4.11 (incl. hamcrest 1.2) ; TestTempJarCache uses ↵Sven Gothel2013-08-311-0/+4
| | | | | | | | | | | | | '@FixMethodOrder(MethodSorters.NAME_ASCENDING)' annotation Issue: Java7 unit test order is no more predictable Fix: junit 4.11 performs a determined (not defined default) test order. Additionally user can force ascending method name test order Produced a drop-in junit.jar / junit-source.zip replacement, which includes - junit version version 4.11 - hamcrest-core version 1.3
* URIQueryProps: Custumize query separator, allowing user to favor ';' over '&'Sven Gothel2013-08-301-1/+1
|
* Add URIQueryProps: Simple tool to process URI queries as propertiesSven Gothel2013-08-281-0/+26
|
* *Ringbuffer: Remove Ringbuffer<T>.AllocEmptyArray interface to favor a more ↵Sven Gothel2013-08-243-32/+19
| | | | | | | | | | | | | | | simple approach; Split 'grow' into 'growEmpty' and 'growFull' - java.lang.reflect.Array can instantiate an array w/ a given array-type and length - array-type is Class<? extends T[]> - We either deduct the array-type via array.getClass(), or pass it (ctor for empty Ringbuffer). - Split 'growBuffer(T[] newElements, int amount, ..)' into: - 'growEmptyBuffer(T[] newElements)' - 'growFullBuffer(int amount)' Allowing a more clean API w/ simpler semantics.
* Add Ringbuffer interface an 2 implementations, synchronized (locking) ↵Sven Gothel2013-08-223-0/+462
| | | | | | | | | | | | | | | | | | | | | | | | SyncedRingbuffer and lock-free LFRingbuffer. SyncedRingbuffer is moved from JOGL to GlueGen, and generalized w/ common interface Ringbuffer to allow testing diff. implementations. - Added Ringbuffer.AllocEmptyArray factory interface, allowing to pass a constructor to construct the generic array. - Added functionality is growBuffer(..), allowing to either grow a full or empty buffer, using Ringbuffer.AllocEmptyArray. - Removed explicit 'clearRef' at get*(..), always clear the taken reference for better interface generalization. - Added LFRingbuffer, exposing lock-free get*(..) and put*(..) methods using the 'Always Keep One Slot Open' pattern using the read/write index as barriers only. - Ctor's copy an optional passed user array into the internal array, utilizing Ringbuffer.AllocEmptyArray. - Added unit tests.
* Fix URLCompositionTest for Bug 757 (3): If file, replace '/' in expected ↵Sven Gothel2013-06-191-2/+4
| | | | | | result w/ OS specific File.separatorChar Take 3 (duh!): JRE impl. varies .. i.e. plain URL w/o JAR path differs from URL w/ JAR scheme on Windows .. well.
* Fix URLCompositionTest for Bug 757 (2): If file, replace '/' in expected ↵Sven Gothel2013-06-191-1/+11
| | | | | | result w/ OS specific File.separatorChar The JAR entry shall stay untouched, i.e. separator is platform independent '/'.
* Fix URLCompositionTest for Bug 757: If file, replace '/' in expected result ↵Sven Gothel2013-06-191-10/+12
| | | | w/ OS specific File.separatorChar
* Fix Bug 757: Regression of URL to URI conversion (Encoded path not ↵Sven Gothel2013-06-193-8/+50
| | | | | | | | | | | | | | | | | | | | | | | | compatible w/ file scheme. Regression of (Bug 683, Commit b98825eb7cfb61aead4a7dff57471cd2d2c26823). The URI encoded path cannot be read by File I/O (if file scheme), since the latter requests an UTF8/16 name, not an URI encoded name (i.e. %20 for space). The encoded URL is produced if calling 'uri.toURL()' and hence the new 'IOUtil.toURL(URI)' provides a custom conversion recovering the UTF name via 'new File(uri).getPath()'. Tested w/ - synthetic URI/URL coposition (unit test) - manual w/ moving 'build' to 'build öä lala' for gluegen, joal and jogl. +++ Misc.: - 'URI JarUtil.getURIDirname(URI)' -> 'URI IOUtil.getDirname(URI)' ++
* Fix Bug 683 part1: IOUtil, JarUtil, TempJarCache, .. uses URI instead of URL ↵Sven Gothel2013-06-095-84/+180
| | | | to remove DNS Lookups etc ..
* Enhance VersionNumber*: Use only RegExp and cache default (no wrapped ↵Sven Gothel2013-05-311-9/+206
| | | | whitespace tokenizer); String match: Store end-of-match and flag defined components.
* Function- RunnableTask: Add PrintStream 'exceptionOut' argument allowing non ↵Sven Gothel2013-03-181-1/+1
| | | | | | | blocking exceptions to be shown. Exceptions occuring on non blocking off-thread tasks shall at least be made visible while not allowed to crash the system.
* Make JarUtil work with custom classloadersWade Walker2013-02-111-0/+77
| | | | | | | | Added the ability for users to set a "resolver" in JarUtil that lets it find resources that are loaded by a custom classloader. This is needed in OSGi apps (like Eclipse RCP apps), since OSGi resources do not have simple jar: URLs (they use a custom protocol called bundleresource:).
* Bug 681: Add Elf Parsing for other OS than Linux, if ARM and !ANDROID using ↵Sven Gothel2013-02-091-11/+45
| | | | | | | | /proc/self/exe (Linux) or a found java/jvm native lib. - PlatformPropsImpl.queryABITypeImpl: Check Elf Header for ARM + !ANDROID (i.e. add other OS than Linux, use native java/jmv lib) - NativeLibrary.enumerateLibraryPaths: Add 'sun.boot.library.path' to enumeration! - TestElfReader01: Add test for finding java/jvm native lib and parse it
* TestElfReader01.testGNULinuxSelfExe: Restrict to LINUXSven Gothel2013-02-081-1/+4
|