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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion demo/src/main/java/run/chronicle/wire/demo/Example2.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,4 @@ public static void main(String[] args) {
bytes.releaseLast();
bytes2.releaseLast();
}

}
1 change: 0 additions & 1 deletion demo/src/main/java/run/chronicle/wire/demo/Example4.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,4 @@ public static void main(String[] args) {
wire.bytes().releaseLast();
wire2.bytes().releaseLast();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,4 @@ else if (cmp > 0)
}
return -(low + 1);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,4 @@ else if (cmp > 0)
}
return -(low + 1);
}

}
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.bytes.BytesUtil;
import net.openhft.chronicle.core.Jvm;
import net.openhft.chronicle.core.pool.StringBuilderPool;
import net.openhft.chronicle.core.scoped.ScopedResource;
import net.openhft.chronicle.core.scoped.ScopedResourcePool;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/openhft/chronicle/wire/ValueOut.java
Original file line number Diff line number Diff line change
Expand Up @@ -1784,5 +1784,4 @@ default WireOut writeLong(LongConverter longConverter, long l) {
default void elementSeparator() {
// Do nothing in the default implementation
}

}
3 changes: 0 additions & 3 deletions src/main/java/net/openhft/chronicle/wire/Wire.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
*/
package net.openhft.chronicle.wire;

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.core.annotation.DontChain;
import net.openhft.chronicle.core.annotation.SingleThreaded;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;

/**
* Defines the standard interface for sequentially writing to and reading from a Bytes stream.
* Implementations of this interface should ensure single-threaded access and avoid method chaining.
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/openhft/chronicle/wire/WireType.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.net.URL;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.openhft.chronicle.bytes.UpdateInterceptor;
import net.openhft.chronicle.core.Jvm;
import net.openhft.chronicle.wire.utils.SourceCodeFormatter;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.io.StringWriter;
import java.lang.reflect.Method;
Expand All @@ -15,8 +15,8 @@
import java.util.concurrent.Callable;
import java.util.function.Consumer;

import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeFalse;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.*;

// Generator for simple classes based on SimpleMetaData
class SimpleClassGenerator extends AbstractClassGenerator<SimpleMetaData> {
Expand Down Expand Up @@ -73,11 +73,11 @@ class SimpleMetaData extends AbstractClassGenerator.MetaData<SimpleMetaData> {
}

// Tests for the AbstractClassGenerator's functionality
public class AbstractClassGeneratorTest extends WireTestCommon {
class AbstractClassGeneratorTest extends WireTestCommon {

// Test case to validate the SimpleClassGenerator's functionality
@Test
public void simpleGenerator() throws Exception {
void simpleGenerator() throws Exception {
assumeFalse(Jvm.maxDirectMemory() == 0);

doTest("Hello World");
Expand All @@ -102,7 +102,7 @@ private void doTest(String message) throws Exception {
// Test Cases
// Test case to validate the interceptor's functionality in the UIClassGenerator
@Test
public void useInterceptor() throws Exception {
void useInterceptor() throws Exception {
assumeFalse(Jvm.maxDirectMemory() == 0);

// StringWriter to capture the interceptor's output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.*;

/**
* A test class for validating the behavior of AbstractCommonMarshallable.
Expand Down
36 changes: 16 additions & 20 deletions src/test/java/net/openhft/chronicle/wire/AbstractFieldTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,21 @@

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.core.Jvm;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.Arrays;
import java.util.Collection;

import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeFalse;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.*;

@RunWith(value = Parameterized.class)
public class AbstractFieldTest extends WireTestCommon {
class AbstractFieldTest extends WireTestCommon {

// The specific WireType configuration to be used for each test.
private final WireType wireType;

// Constructor that sets the wireType for this test iteration.
public AbstractFieldTest(WireType wireType) {
this.wireType = wireType;
}
private WireType wireType;

// Provide a collection of WireTypes for parameterized testing.
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> wireTypes() {
return Arrays.asList(
new Object[]{WireType.BINARY},
Expand All @@ -40,29 +32,33 @@ public static Collection<Object[]> wireTypes() {
}

// Test serialization and deserialization of the abstract field in MSDMHolder class.
@Test
public void abstractField() {
@ParameterizedTest
@MethodSource("wireTypes")
void abstractField(WireType wireType) {
this.wireType = wireType;
assumeFalse(Jvm.maxDirectMemory() == 0);

MSDMHolder holder = new MSDMHolder();
holder.marshallable = new MySelfDescribingMarshallable("Hello World");

final Wire wire = wireType.apply(Bytes.allocateElasticOnHeap());
Wire wire = wireType.apply(Bytes.allocateElasticOnHeap());
wire.getValueOut().object(MSDMHolder.class, holder);

MSDMHolder result = wire.getValueIn().object(MSDMHolder.class);
assertEquals(holder, result);
}

// Test serialization and deserialization of the abstract field in MSDMHolder2 class.
@Test
public void abstractField2() {
@ParameterizedTest
@MethodSource("wireTypes")
void abstractField2(WireType wireType) {
this.wireType = wireType;
assumeFalse(Jvm.maxDirectMemory() == 0);

MSDMHolder2 holder = new MSDMHolder2();
holder.marshallable = new MySelfDescribingMarshallable("Hello World");

final Wire wire = wireType.apply(Bytes.allocateElasticOnHeap());
Wire wire = wireType.apply(Bytes.allocateElasticOnHeap());
wire.getValueOut().object(MSDMHolder2.class, holder);

MSDMHolder2 result = wire.getValueIn().object(MSDMHolder2.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

import net.openhft.chronicle.bytes.Bytes;
import net.openhft.chronicle.core.Jvm;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.nio.ByteBuffer;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assume.assumeFalse;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.*;

public class AbstractMarshallableCfgTest extends WireTestCommon{
class AbstractMarshallableCfgTest extends WireTestCommon {
static class MyAMC extends AbstractMarshallableCfg {
NestedAMC nestedAMC = new NestedAMC(); // Configuration nested inside MyAMC
NestedSDM nestedSDM = new NestedSDM(); // Self-describing data nested inside MyAMC
Expand All @@ -34,16 +33,15 @@ static class NestedSDM extends SelfDescribingMarshallable {
// Test Cases
// Test the string representation of the MyAMC configuration
@Test
public void asString() {
void asString() {
assumeFalse(Jvm.maxDirectMemory() == 0);

MyAMC myAMC = new MyAMC();

// Verify default string representation
assertEquals("" +
"!net.openhft.chronicle.wire.AbstractMarshallableCfgTest$MyAMC {\n" +
"}\n",
myAMC.toString());
"!net.openhft.chronicle.wire.AbstractMarshallableCfgTest$MyAMC {\n" +
"}\n", myAMC.toString());

// Modify values for nested configurations
myAMC.nestedAMC.number = 0;
Expand All @@ -52,22 +50,21 @@ public void asString() {

// Verify modified string representation
assertEquals("" +
"!net.openhft.chronicle.wire.AbstractMarshallableCfgTest$MyAMC {\n" +
" nestedAMC: {\n" +
" number: 0,\n" +
" flag: true\n" +
" },\n" +
" nestedSDM: {\n" +
" bytes: Hi,\n" +
" amt: 1.0\n" +
" }\n" +
"}\n",
myAMC.toString());
"!net.openhft.chronicle.wire.AbstractMarshallableCfgTest$MyAMC {\n" +
" nestedAMC: {\n" +
" number: 0,\n" +
" flag: true\n" +
" },\n" +
" nestedSDM: {\n" +
" bytes: Hi,\n" +
" amt: 1.0\n" +
" }\n" +
"}\n", myAMC.toString());
}

// Test the deep copy functionality
@Test
public void deepCopy() {
void deepCopy() {
assumeFalse(Jvm.maxDirectMemory() == 0);

MyAMC myAMC = new MyAMC();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import java.util.function.Function;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.*;

class AbstractUntypedFieldTest extends WireTestCommon {

Expand All @@ -37,7 +36,7 @@ void beforeEach() {
@MethodSource("provideWire")
void typedFieldsShouldBeNonNull(Function<Bytes<byte[]>, Wire> wireConstruction) {
final Bytes<byte[]> bytes = Bytes.from("" +
"!net.openhft.chronicle.wire.AbstractUntypedFieldShouldBeNull$Holder {\n" +
"!net.openhft.chronicle.wire.AbstractUntypedFieldTest$Holder {\n" +
" a: !AImpl {\n" +
" }\n" +
"}");
Expand All @@ -55,11 +54,12 @@ void typedFieldsShouldBeNonNull(Function<Bytes<byte[]>, Wire> wireConstruction)
@ParameterizedTest
@MethodSource("provideWire")
void untypedFieldsShouldBeNull(Function<Bytes<byte[]>, Wire> wireConstruction) {
final Bytes<byte[]> bytes = Bytes.from("!net.openhft.chronicle.wire.AbstractUntypedFieldShouldBeNull$Holder {\n" +
final Bytes<byte[]> bytes = Bytes.from("!net.openhft.chronicle.wire.AbstractUntypedFieldTest$Holder {\n" +
" a: {\n" +
" }\n" +
"}");
final Wire textWire = wireConstruction.apply(bytes);
expectException("Ignoring exception and setting field 'a' to null");

final Holder holder = textWire.getValueIn().object(Holder.class);

Expand All @@ -71,16 +71,17 @@ void untypedFieldsShouldBeNull(Function<Bytes<byte[]>, Wire> wireConstruction) {
@ParameterizedTest
@MethodSource("provideWire")
void missingAliasesShouldLogWarnings(Function<Bytes<byte[]>, Wire> wireConstruction) {
final Bytes<byte[]> bytes = Bytes.from("!net.openhft.chronicle.wire.AbstractUntypedFieldShouldBeNull$Holder {\n" +
final Bytes<byte[]> bytes = Bytes.from("!net.openhft.chronicle.wire.AbstractUntypedFieldTest$Holder {\n" +
" a: !MissingAlias {\n" +
" }\n" +
"}");
final Wire textWire = wireConstruction.apply(bytes);

// Expect certain exception messages to be logged
expectException("Ignoring exception and setting field 'a' to null");
expectException("Cannot find a class for MissingAlias are you missing an alias?");
final ValueIn valueIn = textWire.getValueIn();
if (textWire instanceof YamlWire)
expectException("MissingAlias");

// Assertion to check if the field with missing alias is null
assertNull(valueIn.object(Holder.class).a);
Expand Down
Loading