Skip to content
Open
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
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,11 @@ project(':cruise-control') {
implementation 'io.swagger.parser.v3:swagger-parser-v3:2.1.16'
implementation 'io.github.classgraph:classgraph:4.8.141'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
// Temporary pin for vulnerability
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
// Use Jackson BOM to ensure all Jackson modules are aligned
implementation platform('com.fasterxml.jackson:jackson-bom:2.17.2')
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.core:jackson-core'
implementation 'com.fasterxml.jackson.core:jackson-annotations'
api "io.vertx:vertx-web-openapi:${vertxVersion}"
api "io.vertx:vertx-core:${vertxVersion}"
api "io.vertx:vertx-web:${vertxVersion}"
Expand Down Expand Up @@ -470,8 +473,9 @@ project(':cruise-control-metrics-reporter') {
implementation "org.apache.kafka:kafka-server:$kafkaVersion"
implementation "org.apache.kafka:kafka-clients:$kafkaVersion"
implementation 'com.google.code.findbugs:jsr305:3.0.2'
// Temporary pin for vulnerability
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
// Use Jackson BOM to ensure all Jackson modules are aligned
implementation platform('com.fasterxml.jackson:jackson-bom:2.17.2')
implementation 'com.fasterxml.jackson.core:jackson-databind'

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.bouncycastle:bcpkix-jdk15on:1.70'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright 2025 LinkedIn Corp. Licensed under the BSD 2-Clause License (the "License"). See License in the project root for license information.
*/

package com.linkedin.kafka.cruisecontrol.vertx;

import com.codahale.metrics.MetricRegistry;
import com.linkedin.kafka.cruisecontrol.async.AsyncKafkaCruiseControl;
import io.vertx.core.Vertx;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

/**
* Unit test for {@link MainVerticle}
*/
public class MainVerticleTest {

private Vertx _vertx;
private AsyncKafkaCruiseControl _mockAsyncKafkaCruiseControl;
private MetricRegistry _metricRegistry;

/**
* Setup test dependencies before each test.
*/
@Before
public void setup() {
_vertx = Vertx.vertx();
_mockAsyncKafkaCruiseControl = EasyMock.mock(AsyncKafkaCruiseControl.class);
_metricRegistry = new MetricRegistry();
}

/**
* Teardown test dependencies after each test.
*/
@After
public void teardown() {
if (_vertx != null) {
CountDownLatch latch = new CountDownLatch(1);
_vertx.close(ar -> latch.countDown());
try {
latch.await(10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
}

/**
* Test that MainVerticle can be created with required parameters.
* This verifies that the Jackson dependencies are properly aligned and the class can be instantiated.
*/
@Test
public void testMainVerticleCreation() {
MainVerticle verticle = new MainVerticle(_mockAsyncKafkaCruiseControl, _metricRegistry, 9090, "localhost");

assertNotNull("Verticle should not be null", verticle);
// Note: getEndPoints() is initialized in start() method, not in constructor
}

/**
* Test that Jackson dependencies are properly available for Vertx usage.
* This test ensures that the JsonIncludeProperties annotation is available,
* which was the root cause of issue #2333.
*/
@Test
public void testJacksonDependenciesAvailable() {
try {
Class.forName("com.fasterxml.jackson.annotation.JsonIncludeProperties");
} catch (ClassNotFoundException e) {
fail("Jackson JsonIncludeProperties class should be available: " + e.getMessage());
}
}
}