Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
id("dd-trace-java.config-inversion-linter")
id("dd-trace-java.ci-jobs")

id("com.diffplug.spotless") version "8.2.1"
id("com.diffplug.spotless") version "8.4.0"
id("me.champeau.gradle.japicmp") version "0.4.3"
id("com.github.spotbugs") version "6.4.8"
id("de.thetaphi.forbiddenapis") version "3.10"
Expand Down Expand Up @@ -39,6 +39,7 @@ with(extensions["spotlessPredeclare"] as SpotlessExtension) {
removeUnusedImports()

googleJavaFormat("1.34.1")
tableTestFormatter("1.1.1")
}
groovyGradle {
greclipse()
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
`java-gradle-plugin`
`kotlin-dsl`
`jvm-test-suite`
id("com.diffplug.spotless") version "8.2.1"
id("com.diffplug.spotless") version "8.4.0"
}

// The buildSrc still needs to target Java 8 as build time instrumentation and muzzle plugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
java
id("com.diffplug.spotless") version "8.2.1"
id("com.diffplug.spotless") version "8.4.0"
id("com.gradleup.shadow") version "8.3.9"
}

Expand Down
28 changes: 14 additions & 14 deletions components/json/src/test/java/datadog/json/JsonMapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ void testMappingToMapFromNonObjectJson(String json) {
}

@TableTest({
"Scenario | Input | Expected ",
"null input | | '[]' ",
"empty list | [] | '[]' ",
"single value | [value1] | '[\"value1\"]' ",
"two values | [value1, value2] | '[\"value1\",\"value2\"]' ",
"quoted values | [va\"lu\"e1, value2] | '[\"va\\\"lu\\\"e1\",\"value2\"]' "
"Scenario | Input | Expected ",
"null input | | '[]' ",
"empty list | [] | '[]' ",
"single value | [value1] | '[\"value1\"]' ",
"two values | [value1, value2] | '[\"value1\",\"value2\"]' ",
"quoted values | [va\"lu\"e1, value2] | '[\"va\\\"lu\\\"e1\",\"value2\"]'"
})
@ParameterizedTest(name = "test mapping iterable to JSON array: {0}")
void testMappingIterableToJsonArray(List<String> input, String expected) throws IOException {
Expand Down Expand Up @@ -137,14 +137,14 @@ void testMappingToListFromEmptyJsonObject(String json) throws IOException {
}

@TableTest({
"Scenario | input | expected ",
" null value | | '' ",
" empty string | '' | '' ",
" \\b | '\b' | '\"\\b\"' ",
" \\t | '\t' | '\"\\t\"' ",
" \\f | '\f' | '\"\\f\"' ",
" a | 'a' | '\"a\"' ",
" / | '/' | '\"\\/\"' ",
"Scenario | input | expected ",
"null value | | '' ",
"empty string | '' | '' ",
"\\b | '\b' | '\"\\b\"'",
"\\t | '\t' | '\"\\t\"'",
"\\f | '\f' | '\"\\f\"'",
"a | 'a' | '\"a\"' ",
"/ | '/' | '\"\\/\"'"
})
@ParameterizedTest(name = "test mapping to JSON string: {0}")
@MethodSource("testMappingToJsonStringArguments")
Expand Down
52 changes: 26 additions & 26 deletions dd-trace-api/src/test/java/datadog/trace/api/DDSpanIdTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
class DDSpanIdTest {

@TableTest({
"scenario | stringId | expectedId ",
"zero | '0' | 0 ",
"one | '1' | 1 ",
"max | '18446744073709551615' | DDSpanId.MAX ",
"long max | '9223372036854775807' | Long.MAX_VALUE ",
"long max plus one | '9223372036854775808' | Long.MIN_VALUE "
"scenario | stringId | expectedId ",
"zero | '0' | 0 ",
"one | '1' | 1 ",
"max | '18446744073709551615' | DDSpanId.MAX ",
"long max | '9223372036854775807' | Long.MAX_VALUE",
"long max plus one | '9223372036854775808' | Long.MIN_VALUE"
})
@ParameterizedTest(name = "convert ids from/to String [{index}]")
void convertIdsFromToString(String stringId, long expectedId) {
Expand All @@ -51,15 +51,15 @@ void failOnIllegalString(String stringId) {
}

@TableTest({
"scenario | hexId | expectedId ",
"zero | '0' | 0 ",
"one | '1' | 1 ",
"max | 'ffffffffffffffff' | DDSpanId.MAX ",
"long max | '7fffffffffffffff' | Long.MAX_VALUE ",
"long min | '8000000000000000' | Long.MIN_VALUE ",
"long min with leading zeros | '00008000000000000000' | Long.MIN_VALUE ",
"hex sample | 'cafebabe' | 3405691582 ",
"fifteen hex digits | '123456789abcdef' | 81985529216486895 "
"scenario | hexId | expectedId ",
"zero | '0' | 0 ",
"one | '1' | 1 ",
"max | 'ffffffffffffffff' | DDSpanId.MAX ",
"long max | '7fffffffffffffff' | Long.MAX_VALUE ",
"long min | '8000000000000000' | Long.MIN_VALUE ",
"long min with leading zeros | '00008000000000000000' | Long.MIN_VALUE ",
"hex sample | 'cafebabe' | 3405691582 ",
"fifteen hex digits | '123456789abcdef' | 81985529216486895"
})
@ParameterizedTest(name = "convert ids from/to hex String [{index}]")
void convertIdsFromToHexString(String hexId, long expectedId) {
Expand All @@ -77,17 +77,17 @@ void convertIdsFromToHexString(String hexId, long expectedId) {
}

@TableTest({
"scenario | hexId | start | length | lowerCaseOnly | expectedId ",
"null input | | 1 | 1 | false | ",
"empty input | '' | 1 | 1 | false | ",
"negative start | '00' | -1 | 1 | false | ",
"zero length | '00' | 0 | 0 | false | ",
"single zero at index 0 | '00' | 0 | 1 | false | DDSpanId.ZERO",
"single zero at index 1 | '00' | 1 | 1 | false | DDSpanId.ZERO",
"single zero at index 1 duplicate | '00' | 1 | 1 | false | DDSpanId.ZERO",
"max lower-case | 'ffffffffffffffff' | 0 | 16 | true | DDSpanId.MAX ",
"upper-case rejected when lower-case only| 'ffffffffffffFfff' | 0 | 16 | true | ",
"upper-case accepted when lower disabled | 'ffffffffffffFfff' | 0 | 16 | false | DDSpanId.MAX "
"scenario | hexId | start | length | lowerCaseOnly | expectedId ",
"null input | | 1 | 1 | false | ",
"empty input | '' | 1 | 1 | false | ",
"negative start | '00' | -1 | 1 | false | ",
"zero length | '00' | 0 | 0 | false | ",
"single zero at index 0 | '00' | 0 | 1 | false | DDSpanId.ZERO",
"single zero at index 1 | '00' | 1 | 1 | false | DDSpanId.ZERO",
"single zero at index 1 duplicate | '00' | 1 | 1 | false | DDSpanId.ZERO",
"max lower-case | 'ffffffffffffffff' | 0 | 16 | true | DDSpanId.MAX ",
"upper-case rejected when lower-case only | 'ffffffffffffFfff' | 0 | 16 | true | ",
"upper-case accepted when lower disabled | 'ffffffffffffFfff' | 0 | 16 | false | DDSpanId.MAX "
})
@ParameterizedTest(name = "convert ids from part of hex String [{index}]")
void convertIdsFromPartOfHexString(
Expand Down
62 changes: 31 additions & 31 deletions dd-trace-api/src/test/java/datadog/trace/api/DDTraceIdTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
class DDTraceIdTest {

@TableTest({
"scenario | longId | expectedString | expectedHex ",
"zero | 0 | '0' | '00000000000000000000000000000000'",
"one | 1 | '1' | '00000000000000000000000000000001'",
"minus one | -1 | '18446744073709551615'| '0000000000000000ffffffffffffffff'",
"long max | Long.MAX_VALUE | '9223372036854775807' | '00000000000000007fffffffffffffff'",
"long min | Long.MIN_VALUE | '9223372036854775808' | '00000000000000008000000000000000'"
"scenario | longId | expectedString | expectedHex ",
"zero | 0 | '0' | '00000000000000000000000000000000'",
"one | 1 | '1' | '00000000000000000000000000000001'",
"minus one | -1 | '18446744073709551615' | '0000000000000000ffffffffffffffff'",
"long max | Long.MAX_VALUE | '9223372036854775807' | '00000000000000007fffffffffffffff'",
"long min | Long.MIN_VALUE | '9223372036854775808' | '00000000000000008000000000000000'"
})
@ParameterizedTest(name = "convert 64-bit ids from/to long and check strings [{index}]")
void convert64BitIdsFromToLongAndCheckStrings(
Expand All @@ -39,12 +39,12 @@ void convert64BitIdsFromToLongAndCheckStrings(
}

@TableTest({
"scenario | stringId | expectedId ",
"zero | '0' | DD64bTraceId.ZERO ",
"one | '1' | DD64bTraceId.ONE ",
"max | '18446744073709551615' | DD64bTraceId.MAX ",
"long max | '9223372036854775807' | DD64bTraceId.LONG_MAX",
"long max plus one | '9223372036854775808' | DD64bTraceId.LONG_MIN"
"scenario | stringId | expectedId ",
"zero | '0' | DD64bTraceId.ZERO ",
"one | '1' | DD64bTraceId.ONE ",
"max | '18446744073709551615' | DD64bTraceId.MAX ",
"long max | '9223372036854775807' | DD64bTraceId.LONG_MAX",
"long max plus one | '9223372036854775808' | DD64bTraceId.LONG_MIN"
})
@ParameterizedTest(name = "convert 64-bit ids from/to String representation [{index}]")
void convert64BitIdsFromToStringRepresentation(String stringId, DD64bTraceId expectedId) {
Expand Down Expand Up @@ -103,25 +103,25 @@ void failParsingIllegal64BitHexadecimalStringRepresentation(String hexId) {
}

@TableTest({
"scenario | highOrderBits | lowOrderBits | hexId ",
"both long min | Long.MIN_VALUE | Long.MIN_VALUE | '80000000000000008000000000000000'",
"high long min low one | Long.MIN_VALUE | 1 | '80000000000000000000000000000001'",
"high long min low long max | Long.MIN_VALUE | Long.MAX_VALUE | '80000000000000007fffffffffffffff'",
"high one low long min | 1 | Long.MIN_VALUE | '00000000000000018000000000000000'",
"high one low one | 1 | 1 | '00000000000000010000000000000001'",
"high one low long max | 1 | Long.MAX_VALUE | '00000000000000017fffffffffffffff'",
"high long max low long min | Long.MAX_VALUE | Long.MIN_VALUE | '7fffffffffffffff8000000000000000'",
"high long max low one | Long.MAX_VALUE | 1 | '7fffffffffffffff0000000000000001'",
"high long max low long max | Long.MAX_VALUE | Long.MAX_VALUE | '7fffffffffffffff7fffffffffffffff'",
"all zeros length one | 0 | 0 | '0' ",
"all zeros length sixteen | 0 | 0 | '0000000000000000' ",
"all zeros length seventeen | 0 | 0 | '00000000000000000' ",
"all zeros length thirty-two | 0 | 0 | '00000000000000000000000000000000'",
"low fifteen | 0 | 15 | 'f' ",
"low minus one | 0 | -1 | 'ffffffffffffffff' ",
"high fifteen low minus one | 15 | -1 | 'fffffffffffffffff' ",
"all f | -1 | -1 | 'ffffffffffffffffffffffffffffffff'",
"hex literal | 1311768467463790320 | 1311768467463790320 | '123456789abcdef0123456789abcdef0'"
"scenario | highOrderBits | lowOrderBits | hexId ",
"both long min | Long.MIN_VALUE | Long.MIN_VALUE | '80000000000000008000000000000000'",
"high long min low one | Long.MIN_VALUE | 1 | '80000000000000000000000000000001'",
"high long min low long max | Long.MIN_VALUE | Long.MAX_VALUE | '80000000000000007fffffffffffffff'",
"high one low long min | 1 | Long.MIN_VALUE | '00000000000000018000000000000000'",
"high one low one | 1 | 1 | '00000000000000010000000000000001'",
"high one low long max | 1 | Long.MAX_VALUE | '00000000000000017fffffffffffffff'",
"high long max low long min | Long.MAX_VALUE | Long.MIN_VALUE | '7fffffffffffffff8000000000000000'",
"high long max low one | Long.MAX_VALUE | 1 | '7fffffffffffffff0000000000000001'",
"high long max low long max | Long.MAX_VALUE | Long.MAX_VALUE | '7fffffffffffffff7fffffffffffffff'",
"all zeros length one | 0 | 0 | '0' ",
"all zeros length sixteen | 0 | 0 | '0000000000000000' ",
"all zeros length seventeen | 0 | 0 | '00000000000000000' ",
"all zeros length thirty-two | 0 | 0 | '00000000000000000000000000000000'",
"low fifteen | 0 | 15 | 'f' ",
"low minus one | 0 | -1 | 'ffffffffffffffff' ",
"high fifteen low minus one | 15 | -1 | 'fffffffffffffffff' ",
"all f | -1 | -1 | 'ffffffffffffffffffffffffffffffff'",
"hex literal | 1311768467463790320 | 1311768467463790320 | '123456789abcdef0123456789abcdef0'"
})
@ParameterizedTest(
name = "convert 128-bit ids from/to hexadecimal String representation [{index}]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
class IdGenerationStrategyTest {

@TableTest({
"scenario | traceId128BitGenerationEnabled | strategyName ",
"strategies-64-bit | false | {RANDOM, SEQUENTIAL, SECURE_RANDOM}",
"strategies-128-bit | true | {RANDOM, SEQUENTIAL, SECURE_RANDOM}"
"scenario | traceId128BitGenerationEnabled | strategyName ",
"strategies-64-bit | false | {RANDOM, SEQUENTIAL, SECURE_RANDOM}",
"strategies-128-bit | true | {RANDOM, SEQUENTIAL, SECURE_RANDOM}"
})
@ParameterizedTest(name = "generate id with {1} and {0} bits")
void generateIdWithStrategyAndBitSize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
class HexStringUtilsTest {

@TableTest({
"scenario | highOrderBits | lowOrderBits | size",
"zero | 0 | 0 | {10, 16, 20, 32, 40}",
"one-two | 1 | 2 | {10, 16, 20, 32, 40}",
"large | 6536977903480360123 | 3270264562721133536 | {10, 16, 20, 32, 40}"
"scenario | highOrderBits | lowOrderBits | size ",
"zero | 0 | 0 | {10, 16, 20, 32, 40}",
"one-two | 1 | 2 | {10, 16, 20, 32, 40}",
"large | 6536977903480360123 | 3270264562721133536 | {10, 16, 20, 32, 40}"
})
@ParameterizedTest(name = "test hexadecimal String representations high={0} low={1} size={2}")
void testHexadecimalStringRepresentations(long highOrderBits, long lowOrderBits, int size) {
Expand Down
1 change: 1 addition & 0 deletions gradle/spotless.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ spotless {
// ignore embedded test projects and everything in build dir, e.g. generated sources
targetExclude('src/test/resources/**', buildDirectoryFiles)
googleJavaFormat('1.34.1')
tableTestFormatter('1.1.1')
}
}

Expand Down
2 changes: 1 addition & 1 deletion test-published-dependencies/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.diffplug.spotless' version '8.2.1'
id 'com.diffplug.spotless' version '8.4.0'
}

def sharedConfigDirectory = "$rootDir/../gradle"
Expand Down
Loading