-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:airbytehq/airbyte into bmoric/fas…
…ter-file-4
- Loading branch information
Showing
46 changed files
with
1,239 additions
and
1,870 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
airbyte-cdk/bulk/core/load/src/test/kotlin/io/airbyte/cdk/load/util/TimeStringUtilityTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.load.util | ||
|
||
import io.airbyte.cdk.load.data.TimeStringToInteger | ||
import java.time.LocalDate | ||
import java.time.LocalDateTime | ||
import java.time.LocalTime | ||
import java.time.OffsetTime | ||
import java.time.ZoneOffset | ||
import java.time.ZonedDateTime | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Assertions.assertThrows | ||
import org.junit.jupiter.api.Test | ||
|
||
internal class TimeStringUtilityTest { | ||
|
||
@Test | ||
fun testToLocalDate() { | ||
val localDateString = "2024-11-18" | ||
val localDate = TimeStringUtility.toLocalDate(localDateString) | ||
assertEquals( | ||
LocalDate.parse(localDateString, TimeStringToInteger.DATE_TIME_FORMATTER), | ||
localDate | ||
) | ||
} | ||
|
||
@Test | ||
fun testToLocalDateInvalidDateString() { | ||
val invalidDateStr = "invalid-date" | ||
assertThrows(java.time.format.DateTimeParseException::class.java) { | ||
TimeStringUtility.toLocalDate(invalidDateStr) | ||
} | ||
} | ||
|
||
@Test | ||
fun testToLocalDateTime() { | ||
val localDateTimeString = "2024-11-18T12:34:56Z" | ||
val localDateTime = TimeStringUtility.toLocalDateTime(localDateTimeString) | ||
assertEquals( | ||
LocalDateTime.parse(localDateTimeString, TimeStringToInteger.DATE_TIME_FORMATTER), | ||
localDateTime | ||
) | ||
} | ||
|
||
@Test | ||
fun testToOffsetWithTimezone() { | ||
val offsetWithTimezoneString = "12:34:56Z" | ||
val offsetWithTimezone = TimeStringUtility.toOffset(offsetWithTimezoneString) | ||
assertEquals( | ||
OffsetTime.parse(offsetWithTimezoneString, TimeStringToInteger.TIME_FORMATTER) | ||
.toLocalTime(), | ||
offsetWithTimezone | ||
) | ||
} | ||
|
||
@Test | ||
fun testToOffsetWithoutTimezone() { | ||
val offsetWithoutTimezoneString = "12:34:56" | ||
val offsetWithoutTimezone = TimeStringUtility.toOffset(offsetWithoutTimezoneString) | ||
assertEquals( | ||
LocalTime.parse(offsetWithoutTimezoneString, TimeStringToInteger.TIME_FORMATTER), | ||
offsetWithoutTimezone | ||
) | ||
} | ||
|
||
@Test | ||
fun testToOffsetDateTimeWithTimezone() { | ||
val offsetWithTimezoneString = "2024-11-18T12:34:56Z" | ||
val offsetWithTimezone = TimeStringUtility.toOffsetDateTime(offsetWithTimezoneString) | ||
assertEquals( | ||
ZonedDateTime.parse(offsetWithTimezoneString, TimeStringToInteger.DATE_TIME_FORMATTER) | ||
.toOffsetDateTime(), | ||
offsetWithTimezone | ||
) | ||
} | ||
|
||
@Test | ||
fun testToOffsetDateTimeWithoutTimezone() { | ||
val offsetWithoutTimezoneString = "2024-11-18T12:34:56" | ||
val offsetWithoutTimezone = TimeStringUtility.toOffsetDateTime(offsetWithoutTimezoneString) | ||
assertEquals( | ||
LocalDateTime.parse( | ||
offsetWithoutTimezoneString, | ||
TimeStringToInteger.DATE_TIME_FORMATTER | ||
) | ||
.atOffset(ZoneOffset.UTC), | ||
offsetWithoutTimezone | ||
) | ||
} | ||
|
||
@Test | ||
fun testToOffsetDateTimeInvalidFormat() { | ||
val invalidDateTime = "invalid-datetime" | ||
assertThrows(java.time.format.DateTimeParseException::class.java) { | ||
TimeStringUtility.toOffsetDateTime(invalidDateTime) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
...rc/testFixtures/kotlin/io/airbyte/cdk/load/data/icerberg/parquet/TimeStringUtilityTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.