Skip to content

Commit da1a68e

Browse files
committed
Add an integration test for vertx.reuseNettyAllocators
1 parent e1a4e05 commit da1a68e

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

pom.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,21 @@
755755
</additionalClasspathElements>
756756
</configuration>
757757
</execution>
758+
<execution>
759+
<id>reuse-netty-allocators</id>
760+
<goals>
761+
<goal>integration-test</goal>
762+
<goal>verify</goal>
763+
</goals>
764+
<configuration>
765+
<includes>
766+
<include>io/vertx/it/ReuseNettyAllocatorsTest.java</include>
767+
</includes>
768+
<systemProperties>
769+
<vertx.reuseNettyAllocators>true</vertx.reuseNettyAllocators>
770+
</systemProperties>
771+
</configuration>
772+
</execution>
758773
</executions>
759774
</plugin>
760775

@@ -986,4 +1001,4 @@
9861001

9871002
</profiles>
9881003

989-
</project>
1004+
</project>

src/test/java/io/vertx/core/buffer/impl/VertxByteBufAllocatorTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919

2020
public class VertxByteBufAllocatorTest {
2121

22-
2322
@Test
2423
public void defaultShouldNotReuseExistingNettyPooledAllocators() {
2524
Assert.assertNull(System.getProperty("vertx.reuseNettyAllocators"));
2625
Assert.assertNotSame(PooledByteBufAllocator.DEFAULT, VertxByteBufAllocator.POOLED_ALLOCATOR);
2726
Assert.assertNotSame(ByteBufAllocator.DEFAULT, VertxByteBufAllocator.POOLED_ALLOCATOR);
2827
Assert.assertSame(ByteBufAllocator.DEFAULT, PooledByteBufAllocator.DEFAULT);
2928
}
30-
3129
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2011-2024 Contributors to the Eclipse Foundation
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License 2.0 which is available at
6+
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
7+
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
8+
*
9+
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
10+
*/
11+
12+
package io.vertx.it;
13+
14+
import io.netty.buffer.ByteBufAllocator;
15+
import io.netty.buffer.PooledByteBufAllocator;
16+
import io.vertx.core.buffer.impl.VertxByteBufAllocator;
17+
import org.junit.Assert;
18+
import org.junit.Test;
19+
20+
public class ReuseNettyAllocatorsTest {
21+
22+
@Test
23+
public void testVertxAllocatorsReuseNettyAllocators() {
24+
Assert.assertEquals("true", System.getProperty("vertx.reuseNettyAllocators"));
25+
Assert.assertSame(PooledByteBufAllocator.DEFAULT, VertxByteBufAllocator.POOLED_ALLOCATOR);
26+
Assert.assertSame(ByteBufAllocator.DEFAULT, VertxByteBufAllocator.POOLED_ALLOCATOR);
27+
Assert.assertSame(ByteBufAllocator.DEFAULT, PooledByteBufAllocator.DEFAULT);
28+
}
29+
}

0 commit comments

Comments
 (0)