Class UtilsTest

java.lang.Object
org.apache.kafka.common.utils.UtilsTest

public class UtilsTest extends Object
  • Constructor Details

    • UtilsTest

      public UtilsTest()
  • Method Details

    • testMurmur2

      @Test public void testMurmur2()
    • testMurmur2Checksum

      @Test public void testMurmur2Checksum()
    • testGetHostValid

      @ParameterizedTest @CsvSource({"PLAINTEXT","SASL_PLAINTEXT","SSL","SASL_SSL"}) public void testGetHostValid(String protocol)
    • testGetHostInvalid

      @ParameterizedTest @CsvSource({"PLAINTEXT","SASL_PLAINTEXT","SSL","SASL_SSL"}) public void testGetHostInvalid(String protocol)
    • testHostPattern

      @Test public void testHostPattern()
    • testGetPort

      @Test public void testGetPort()
    • testFormatAddress

      @Test public void testFormatAddress()
    • testFormatBytes

      @Test public void testFormatBytes()
    • testMkString

      @Test public void testMkString()
    • testAbs

      @Test public void testAbs()
    • writeToBuffer

      @Test public void writeToBuffer() throws IOException
      Throws:
      IOException
    • toArray

      @Test public void toArray()
    • toArrayDirectByteBuffer

      @Test public void toArrayDirectByteBuffer()
    • getNullableSizePrefixedArrayExact

      @Test public void getNullableSizePrefixedArrayExact()
    • getNullableSizePrefixedArrayExactEmpty

      @Test public void getNullableSizePrefixedArrayExactEmpty()
    • getNullableSizePrefixedArrayRemainder

      @Test public void getNullableSizePrefixedArrayRemainder()
    • getNullableSizePrefixedArrayNull

      @Test public void getNullableSizePrefixedArrayNull()
    • getNullableSizePrefixedArrayInvalid

      @Test public void getNullableSizePrefixedArrayInvalid()
    • getNullableSizePrefixedArrayUnderflow

      @Test public void getNullableSizePrefixedArrayUnderflow()
    • utf8ByteArraySerde

      @Test public void utf8ByteArraySerde()
    • utf8ByteBufferSerde

      @Test public void utf8ByteBufferSerde()
    • testReadBytes

      @Test public void testReadBytes()
    • testFileAsStringSimpleFile

      @Test public void testFileAsStringSimpleFile() throws IOException
      Throws:
      IOException
    • testFileAsStringNamedPipe

      @Timeout(60L) @Test public void testFileAsStringNamedPipe() throws Exception
      Test to read content of named pipe as string. As reading/writing to a pipe can block, timeout test after a minute (test finishes within 100 ms normally).
      Throws:
      Exception
    • testMin

      @Test public void testMin()
    • testMax

      @Test public void testMax()
    • mkStringTest

      @Test public void mkStringTest()
    • parseMapTest

      @Test public void parseMapTest()
    • ensureCapacityTest

      @Test public void ensureCapacityTest()
    • testCloseAll

      @Test public void testCloseAll()
    • testReadFullyOrFailWithRealFile

      @Test public void testReadFullyOrFailWithRealFile() throws IOException
      Throws:
      IOException
    • testReadFullyOrFailWithPartialFileChannelReads

      @Test public void testReadFullyOrFailWithPartialFileChannelReads() throws IOException
      Tests that `readFullyOrFail` behaves correctly if multiple `FileChannel.read` operations are required to fill the destination buffer.
      Throws:
      IOException
    • testReadFullyWithPartialFileChannelReads

      @Test public void testReadFullyWithPartialFileChannelReads() throws IOException
      Tests that `readFullyOrFail` behaves correctly if multiple `FileChannel.read` operations are required to fill the destination buffer.
      Throws:
      IOException
    • testReadFullyIfEofIsReached

      @Test public void testReadFullyIfEofIsReached() throws IOException
      Throws:
      IOException
    • testLoadProps

      @Test public void testLoadProps() throws IOException
      Throws:
      IOException
    • testCreateGoalList

      @Test public void testCreateGoalList() throws IOException
      Test custom goal list file is parsed correctly
      Throws:
      IOException
    • testRecursiveDelete

      @Timeout(120L) @Test public void testRecursiveDelete() throws IOException
      Throws:
      IOException
    • testRecursiveDeleteWithDeletedFile

      @Test public void testRecursiveDeleteWithDeletedFile() throws IOException
      Throws:
      IOException
    • testIgnoreMissingSubFiles

      @Test public void testIgnoreMissingSubFiles() throws IOException
      Throws:
      IOException
    • testDeleteIgnoringMissingFilesWhenConcurrentDeletion

      @Test public void testDeleteIgnoringMissingFilesWhenConcurrentDeletion() throws IOException
      Verify Utils.delete(_, ignoreMissingSubFiles=true) uses FilesWrapper.deleteIfExists(). Fixes KSTORAGE-2060: concurrent deletion should not throw exception.
      Throws:
      IOException
    • testDeleteNotIgnoringMissingFilesWhenConcurrentDeletion

      @Test public void testDeleteNotIgnoringMissingFilesWhenConcurrentDeletion() throws IOException
      Verify Utils.delete(_, ignoreMissingSubFiles=false) uses FilesWrapper.delete(). When file is missing, NoSuchFileException should propagate.
      Throws:
      IOException
    • testConvertTo32BitField

      @Test public void testConvertTo32BitField()
    • testUnion

      @Test public void testUnion()
    • testUnionOfOne

      @Test public void testUnionOfOne()
    • testUnionOfMany

      @Test public void testUnionOfMany()
    • testUnionOfNone

      @Test public void testUnionOfNone()
    • testIntersection

      @Test public void testIntersection()
    • testIntersectionOfOne

      @Test public void testIntersectionOfOne()
    • testIntersectionOfMany

      @Test public void testIntersectionOfMany()
    • testDisjointIntersectionOfMany

      @Test public void testDisjointIntersectionOfMany()
    • testDiff

      @Test public void testDiff()
    • testPropsToMap

      @Test public void testPropsToMap()
    • testPropsToMapNonStringKey

      @Test public void testPropsToMapNonStringKey()
    • testPropsToMapWithDefaults

      @Test public void testPropsToMapWithDefaults()
    • testPropsToMapWithDefaultsAndSameKey

      @Test public void testPropsToMapWithDefaultsAndSameKey()
    • testCastToStringObjectMap

      @Test public void testCastToStringObjectMap()
    • testCastToStringObjectMapNonStringKey

      @Test public void testCastToStringObjectMapNonStringKey()
    • testCastToStringObjectMapPropertiesAsInput

      @Test public void testCastToStringObjectMapPropertiesAsInput()
    • testCastToStringObjectMapPropertiesNonStringKey

      @Test public void testCastToStringObjectMapPropertiesNonStringKey()
    • testCastToStringObjectMapPropertiesWithDefaults

      @Test public void testCastToStringObjectMapPropertiesWithDefaults()
    • testCastToStringObjectMapPropertiesWithDefaultsAndSameKey

      @Test public void testCastToStringObjectMapPropertiesWithDefaultsAndSameKey()
    • testCloseAllQuietly

      @Test public void testCloseAllQuietly()
    • shouldAcceptValidDateFormats

      @Test public void shouldAcceptValidDateFormats() throws ParseException
      Throws:
      ParseException
    • shouldThrowOnInvalidDateFormatOrNullTimestamp

      @Test public void shouldThrowOnInvalidDateFormatOrNullTimestamp()
    • testCharacterArrayEquality

      @Test public void testCharacterArrayEquality()
    • testToLogDateTimeFormat

      @Test public void testToLogDateTimeFormat()
    • testReplaceSuffix

      @Test public void testReplaceSuffix()
    • testEntriesWithPrefix

      @Test public void testEntriesWithPrefix()
    • testTryAll

      @Test public void testTryAll() throws Throwable
      Throws:
      Throwable
    • testMsToNs

      @Test public void testMsToNs()