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
1 change: 0 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ testing {
val integTest by registering(JvmTestSuite::class) {
dependencies {
implementation(gradleTestKit())
implementation("org.assertj:assertj-core:3.25.3")
}
// Makes the gradle plugin publish its declared plugins to this source set
gradlePlugin.testSourceSet(sources)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package datadog.gradle.plugin.version

import org.assertj.core.api.Assertions.assertThat
import org.gradle.testkit.runner.GradleRunner
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.CleanupMode
import org.junit.jupiter.api.io.TempDir
import java.io.File
import java.io.IOException
Expand Down Expand Up @@ -289,7 +287,7 @@ class TracerVersionIntegrationTest {
// .withDebug(true)
.build()

assertThat(buildResult.output).isEqualToIgnoringNewLines(expectedVersion)
assertEquals(expectedVersion, buildResult.output.lines().first())
}

private fun exec(workingDirectory: File, vararg args: String) {
Expand Down
1 change: 0 additions & 1 deletion communication/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies {

testImplementation(project(":utils:test-utils"))
testImplementation(libs.bundles.junit5)
testImplementation(libs.truth)
testImplementation(libs.bytebuddy)
testImplementation("org.msgpack:msgpack-core:0.8.20")
testImplementation("org.msgpack:jackson-dataformat-msgpack:0.8.20")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
package datadog.communication.http

import com.google.common.truth.Truth
import okhttp3.Request
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test

import static org.junit.jupiter.api.Assertions.assertFalse
import static org.junit.jupiter.api.Assertions.assertThrows
import static org.junit.jupiter.api.Assertions.assertTrue

class SafeRequestBuilderTest {
Request.Builder testBuilder = new Request.Builder()

@Test
void "test adding bad header"() {
def name = 'bad'
def password = 'very-secret-password'
IllegalArgumentException ex = Assertions.assertThrows(IllegalArgumentException, {
IllegalArgumentException ex = assertThrows(IllegalArgumentException, {
testBuilder.url("http:localhost").addHeader(name, "$password\n")
})
Truth.assertThat(ex).hasMessageThat().contains(name)
Truth.assertThat(ex).hasMessageThat().doesNotContain(password)
assertTrue(ex.getMessage().contains(name))
assertFalse(ex.getMessage().contains(password))
}

@Test
void "test adding bad header2"(){
def name = '\u0019'
def password = 'very-secret-password'
IllegalArgumentException ex = Assertions.assertThrows(IllegalArgumentException, {
IllegalArgumentException ex = assertThrows(IllegalArgumentException, {
testBuilder.url("http:localhost").addHeader(name, "\u0080$password")
})
Truth.assertThat(ex).hasMessageThat().contains(name)
Truth.assertThat(ex).hasMessageThat().doesNotContain(password)
assertTrue(ex.getMessage().contains(name))
assertFalse(ex.getMessage().contains(password))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies {

testImplementation libs.bundles.junit5
testImplementation libs.bundles.mockito
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.1'
testImplementation files(project(':dd-java-agent:agent-profiling:profiling-controller-jfr').sourceSets.test.output)
testImplementation project(':dd-java-agent:agent-profiling')
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.datadog.profiling.controller.openjdk;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assumptions.assumeFalse;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -76,7 +75,7 @@ public void testGetName() {

@Test
public void testToString() {
assertThat(recordingData.toString(), containsString(TEST_NAME));
assertTrue(recordingData.toString().contains(TEST_NAME));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ dependencies {

testImplementation libs.bundles.junit5
testImplementation libs.bundles.mockito
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.1'
testImplementation files(project(':dd-java-agent:agent-profiling:profiling-controller-jfr').sourceSets.test.output)
testImplementation project(':dd-java-agent:agent-profiling')
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package com.datadog.profiling.controller.oracle;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.datadog.profiling.controller.jfr.JfpUtils;
import java.io.IOException;
Expand Down
1 change: 0 additions & 1 deletion dd-java-agent/appsec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies {
testImplementation libs.bytebuddy
testImplementation project(':remote-config:remote-config-core')
testImplementation project(':utils:test-utils')
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '2.2'
testImplementation group: 'com.flipkart.zjsonpatch', name: 'zjsonpatch', version: '0.4.11'
testImplementation libs.logback.classic
testImplementation libs.jackson.databind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import java.util.concurrent.atomic.AtomicLong

import static datadog.trace.api.config.AppSecConfig.APPSEC_OBFUSCATION_PARAMETER_KEY_REGEXP
import static datadog.trace.api.config.AppSecConfig.APPSEC_OBFUSCATION_PARAMETER_VALUE_REGEXP
import static org.hamcrest.Matchers.hasSize

class WAFModuleSpecification extends DDSpecification {
@Shared
Expand Down Expand Up @@ -508,7 +507,7 @@ class WAFModuleSpecification extends DDSpecification {
then:
1 * ctx.getOrCreateWafContext(_, true, false)
2 * tracer.activeSpan()
1 * ctx.reportEvents(hasSize(1))
1 * ctx.reportEvents({ it.size() == 1 })
2 * ctx.getWafMetrics()
1 * ctx.isWafContextClosed() >> false
1 * ctx.closeWafContext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ dependencies {
testImplementation group: 'org.springframework.kafka', name: 'spring-kafka-test', version: '1.3.3.RELEASE'
testImplementation group: 'io.projectreactor.kafka', name: 'reactor-kafka', version: '1.0.0.RELEASE'
testImplementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '2.9.+'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.19.0'
testRuntimeOnly group: 'org.assertj', name: 'assertj-core', version: '2.9.+'
testRuntimeOnly project(':dd-java-agent:instrumentation:spring:spring-scheduling-3.1')
testRuntimeOnly project(':dd-java-agent:instrumentation:reactor-core-3.1')
testRuntimeOnly project(':dd-java-agent:instrumentation:reactive-streams')
Expand All @@ -52,7 +52,6 @@ dependencies {
// latest depending to kafka client 2.x -> to be fixed when this instrumentation will test 3.x as well
latestDepTestImplementation group: 'org.springframework.kafka', name: 'spring-kafka', version: '2.+'
latestDepTestImplementation group: 'org.springframework.kafka', name: 'spring-kafka-test', version: '2.+'
latestDepTestImplementation group: 'org.assertj', name: 'assertj-core', version: '3.19.+'
latestDepTestImplementation libs.guava

// Add kafka version 3.x for IAST
Expand All @@ -65,12 +64,6 @@ dependencies {
iastLatestDepTest3RuntimeOnly project(':dd-java-agent:instrumentation:jackson-core:jackson-core-2.12')
iastLatestDepTest3Implementation(group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.4')
iastLatestDepTest3Implementation project(':dd-java-agent:agent-iast:iast-test-fixtures')

}

configurations.testRuntimeClasspath {
// spock-core depends on assertj version that is not compatible with kafka-clients
resolutionStrategy.force 'org.assertj:assertj-core:2.9.1'
}

iastLatestDepTest3.configure {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,13 @@ dependencies {
testImplementation 'org.apache.kafka:kafka_2.13:3.8.0:test'

testImplementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '2.9.+'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.19.0'
testRuntimeOnly project(':dd-java-agent:instrumentation:spring:spring-scheduling-3.1')

latestDepTestImplementation group: 'org.springframework.kafka', name: 'spring-kafka', version: '3.+'
latestDepTestImplementation group: 'org.springframework.kafka', name: 'spring-kafka-test', version: '3.+'
//latestDepTestImplementation group: 'org.assertj', name: 'assertj-core', version: '3.19.+'
latestDepTestImplementation group: 'io.dropwizard.metrics', name: 'metrics-core', version: '+'

latestDepTestImplementation libs.guava

}

configurations.testRuntimeClasspath {
// spock-core depends on assertj version that is not compatible with kafka-clients
resolutionStrategy.force 'org.assertj:assertj-core:2.9.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies {
testRuntimeOnly project(':dd-java-agent:instrumentation:jackson-core')
testRuntimeOnly project(':dd-java-agent:instrumentation:jackson-core:jackson-core-2.8')
testImplementation libs.jackson.databind
testImplementation group: 'org.assertj', name: 'assertj-core', version: '2.9.+'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.19.0'
testImplementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3'
testImplementation 'org.apache.kafka:connect-api:2.7.0' // Fixed version
Expand All @@ -34,8 +33,3 @@ dependencies {
testRuntimeOnly project(':dd-java-agent:instrumentation:kafka:kafka-streams-0.11')
testRuntimeOnly project(':dd-java-agent:instrumentation:kafka:kafka-streams-1.0')
}

configurations.testRuntimeClasspath {
// spock-core depends on assertj version that is not compatible with kafka-clients
resolutionStrategy.force 'org.assertj:assertj-core:2.9.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies {
testImplementation group: 'org.springframework.kafka', name: 'spring-kafka', version: '1.3.3.RELEASE'
testImplementation group: 'org.springframework.kafka', name: 'spring-kafka-test', version: '1.3.3.RELEASE'
testImplementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.2.3'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '2.9.+'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.19.0'

// Include latest version of kafka itself along with latest version of client libs.
Expand All @@ -33,10 +32,4 @@ dependencies {
// spring-kafka 2.8.x pulls in kafka-clients/streams 3.x which behaves differently
latestDepTestImplementation group: 'org.springframework.kafka', name: 'spring-kafka', version: '2.7+'
latestDepTestImplementation group: 'org.springframework.kafka', name: 'spring-kafka-test', version: '2.7+'
latestDepTestImplementation group: 'org.assertj', name: 'assertj-core', version: '3.+'
}

configurations.testRuntimeClasspath {
// spock-core depends on assertj version that is not compatible with kafka-clients
resolutionStrategy.force 'org.assertj:assertj-core:2.9.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MavenInstrumentationTest extends CiVisibilityInstrumentationTest {
Path projectFolder

@Override
void setup() {
def setup() {
System.setProperty("maven.multiModuleProjectDirectory", projectFolder.toAbsolutePath().toString())
givenMavenProjectFiles((String) specificationContext.currentIteration.dataVariables.testcaseName)
givenMavenDependenciesAreLoaded()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package datadog.trace.instrumentation.maven3;

import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
import java.io.PrintStream;
Expand Down
Loading