From da1a68ea199c0f72996b528e9edc47aa11e525bb Mon Sep 17 00:00:00 2001 From: Julien Viet Date: Mon, 21 Oct 2024 14:37:36 +0200 Subject: [PATCH] Add an integration test for vertx.reuseNettyAllocators --- pom.xml | 17 ++++++++++- .../impl/VertxByteBufAllocatorTest.java | 2 -- .../io/vertx/it/ReuseNettyAllocatorsTest.java | 29 +++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 src/test/java/io/vertx/it/ReuseNettyAllocatorsTest.java diff --git a/pom.xml b/pom.xml index 43f8d4809ea..1502aaa1657 100644 --- a/pom.xml +++ b/pom.xml @@ -755,6 +755,21 @@ + + reuse-netty-allocators + + integration-test + verify + + + + io/vertx/it/ReuseNettyAllocatorsTest.java + + + true + + + @@ -986,4 +1001,4 @@ - \ No newline at end of file + diff --git a/src/test/java/io/vertx/core/buffer/impl/VertxByteBufAllocatorTest.java b/src/test/java/io/vertx/core/buffer/impl/VertxByteBufAllocatorTest.java index c23c1a28433..2cac6571115 100644 --- a/src/test/java/io/vertx/core/buffer/impl/VertxByteBufAllocatorTest.java +++ b/src/test/java/io/vertx/core/buffer/impl/VertxByteBufAllocatorTest.java @@ -19,7 +19,6 @@ public class VertxByteBufAllocatorTest { - @Test public void defaultShouldNotReuseExistingNettyPooledAllocators() { Assert.assertNull(System.getProperty("vertx.reuseNettyAllocators")); @@ -27,5 +26,4 @@ public void defaultShouldNotReuseExistingNettyPooledAllocators() { Assert.assertNotSame(ByteBufAllocator.DEFAULT, VertxByteBufAllocator.POOLED_ALLOCATOR); Assert.assertSame(ByteBufAllocator.DEFAULT, PooledByteBufAllocator.DEFAULT); } - } diff --git a/src/test/java/io/vertx/it/ReuseNettyAllocatorsTest.java b/src/test/java/io/vertx/it/ReuseNettyAllocatorsTest.java new file mode 100644 index 00000000000..a7d14dddb44 --- /dev/null +++ b/src/test/java/io/vertx/it/ReuseNettyAllocatorsTest.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2011-2024 Contributors to the Eclipse Foundation + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + */ + +package io.vertx.it; + +import io.netty.buffer.ByteBufAllocator; +import io.netty.buffer.PooledByteBufAllocator; +import io.vertx.core.buffer.impl.VertxByteBufAllocator; +import org.junit.Assert; +import org.junit.Test; + +public class ReuseNettyAllocatorsTest { + + @Test + public void testVertxAllocatorsReuseNettyAllocators() { + Assert.assertEquals("true", System.getProperty("vertx.reuseNettyAllocators")); + Assert.assertSame(PooledByteBufAllocator.DEFAULT, VertxByteBufAllocator.POOLED_ALLOCATOR); + Assert.assertSame(ByteBufAllocator.DEFAULT, VertxByteBufAllocator.POOLED_ALLOCATOR); + Assert.assertSame(ByteBufAllocator.DEFAULT, PooledByteBufAllocator.DEFAULT); + } +}