Skip to content

Commit

Permalink
Fix compile warnings for x.26
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-lawrey committed Sep 20, 2024
1 parent 45a1e96 commit 75c2beb
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.openhft.chronicle.jlbh.JLBHOptions;
import net.openhft.chronicle.jlbh.JLBHTask;
import net.openhft.chronicle.queue.channel.PipeHandler;
import net.openhft.chronicle.wire.channel.ChronicleChannel;
import net.openhft.chronicle.wire.channel.ChronicleContext;
import net.openhft.chronicle.wire.channel.impl.internal.Handler;
import run.chronicle.account.api.AccountManagerIn;
Expand Down Expand Up @@ -57,6 +56,7 @@
90.0: 37.95 35.26 38.34 35.52 35.14 5.72
99.0: 1198.08 250.62 1243.14 469.50 477.70 72.53
*/
@SuppressWarnings("deprecation")
public class AccountManagerBenchmarkMain {
public static final int THROUGHPUT = Integer.getInteger("throughput", OS.isLinux() ? 100_000 : 10_000);
public static final int RUN_TIME = Integer.getInteger("runTime", 30);
Expand Down Expand Up @@ -88,7 +88,7 @@ public static void main(String[] args) throws InterruptedException, MalformedURL
AccountManagerServiceMain service = null;

// Check if the host part of the URL is empty. If it is, that means we are running the service locally.
if (ChronicleContext.urlFor(URL).getHost().isEmpty()) {
if (net.openhft.chronicle.wire.channel.ChronicleContext.urlFor(URL).getHost().isEmpty()) {
service = new AccountManagerServiceMain();
// Submit the service to run in the ExecutorService.
// The 'wrap' method is used to ensure any Throwable are logged instead of added to the discarded Future silently
Expand All @@ -102,8 +102,8 @@ public static void main(String[] args) throws InterruptedException, MalformedURL
// Use a ChronicleContext to connect to the service.
// ChronicleContext is a part of the Chronicle network library
// which provides high performance, low latency networking capabilities.
try (ChronicleContext context = ChronicleContext.newContext(URL)) {
ChronicleChannel channel = context.newChannelSupplier(
try (ChronicleContext context = net.openhft.chronicle.wire.channel.ChronicleContext.newContext(URL)) {
net.openhft.chronicle.wire.channel.ChronicleChannel channel = context.newChannelSupplier(
new PipeHandler().publish("account-in").subscribe("account-out")).get();

// Log the connection details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import net.openhft.chronicle.queue.channel.PipeHandler;
import net.openhft.chronicle.wire.Base85LongConverter;
import net.openhft.chronicle.wire.LongConverter;
import net.openhft.chronicle.wire.channel.ChronicleChannel;
import net.openhft.chronicle.wire.channel.ChronicleContext;
import net.openhft.chronicle.wire.channel.ChronicleGatewayMain;
import run.chronicle.account.api.AccountManagerIn;
Expand All @@ -19,6 +18,7 @@
* This class acts as the main entry point for the AccountManagerClient.
* It creates a client which connects to a Chronicle server and performs various actions.
*/
@SuppressWarnings("deprecation")
public class AccountManagerClientMain {
private static final String URL = System.getProperty("url", "tcp://localhost:" + ChronicleGatewayMain.PORT);

Expand All @@ -39,7 +39,7 @@ public static void main(String[] args) {
// Create a new ChronicleContext using a URL and client name...
// Obtain a ChronicleChannel...
try (ChronicleContext context = ChronicleContext.newContext(URL).name(CLIENT)) {
ChronicleChannel channel = context.newChannelSupplier(new PipeHandler().publish("account-in").subscribe("account-out")).get();
net.openhft.chronicle.wire.channel.ChronicleChannel channel = context.newChannelSupplier(new PipeHandler().publish("account-in").subscribe("account-out")).get();

// Log the hostname and port of the connected channel...
Jvm.startup().on(AccountManagerClientMain.class, "Channel connected to: " + channel.channelCfg().hostPorts());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
import net.openhft.chronicle.queue.channel.PipeHandler;
import net.openhft.chronicle.threads.Pauser;
import net.openhft.chronicle.wire.Base85LongConverter;
import net.openhft.chronicle.wire.channel.ChronicleChannel;
import net.openhft.chronicle.wire.channel.ChronicleContext;
import run.chronicle.account.api.AccountManagerOut;
import run.chronicle.account.impl.AccountManagerImpl;

/**
* The main service class for the Account Manager application.
*/
@SuppressWarnings("deprecation")
public class AccountManagerServiceMain extends SimpleCloseable implements Runnable {
private static final Base85LongConverter BASE85 = Base85LongConverter.INSTANCE;
private static final String SERVICE_URL = System.getProperty("serviceUrl", "internal://");
Expand Down Expand Up @@ -55,7 +55,7 @@ public void run() {
// Context for interaction with the Chronicle system
try (ChronicleContext context = ChronicleContext.newContext(SERVICE_URL)) {
// Channel for sending and receiving messages
ChronicleChannel channel = context.newChannelSupplier(handler).get();
net.openhft.chronicle.wire.channel.ChronicleChannel channel = context.newChannelSupplier(handler).get();

// Method writer for sending events
AccountManagerOut out = channel.methodWriter(AccountManagerOut.class);
Expand Down
18 changes: 8 additions & 10 deletions account/src/test/java/run/chronicle/account/AccountsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
import net.openhft.chronicle.core.time.SetTimeProvider;
import net.openhft.chronicle.core.time.SystemTimeProvider;
import net.openhft.chronicle.wire.converter.Base85;
import net.openhft.chronicle.wire.utils.YamlAgitator;
import net.openhft.chronicle.wire.utils.YamlTester;
import net.openhft.chronicle.wire.utils.YamlTesterParametersBuilder;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -48,6 +45,7 @@
* After each test, the system clock is reset to its default state in the tearDown method.
*/
// This class is used to run tests for the Account system.
@SuppressWarnings("deprecation")
@RunWith(Parameterized.class)
public class AccountsTest {
// Defines the paths to the tests to run.
Expand All @@ -64,10 +62,10 @@ public class AccountsTest {

// The name of the test, and the tester that will run the test.
final String name;
final YamlTester tester;
final net.openhft.chronicle.wire.utils.YamlTester tester;

// Constructor that sets the name and tester.
public AccountsTest(String name, YamlTester tester) {
public AccountsTest(String name, net.openhft.chronicle.wire.utils.YamlTester tester) {
this.name = name;
this.tester = tester;
}
Expand All @@ -78,12 +76,12 @@ public static List<Object[]> parameters() {
// Returns a list of test parameters to run the tests with.
// Each test will be run with an instance of AccountManagerImpl,
// and will be subjected to various agitations to ensure robustness.
return new YamlTesterParametersBuilder<>(out -> new AccountManagerImpl(out).id(VAULT), AccountManagerOut.class, paths)
return new net.openhft.chronicle.wire.utils.YamlTesterParametersBuilder<>(out -> new AccountManagerImpl(out).id(VAULT), AccountManagerOut.class, paths)
.agitators(
YamlAgitator.messageMissing(),
YamlAgitator.duplicateMessage(),
YamlAgitator.overrideFields("currency: , amount: NaN, amount: -1, balance: NaN, balance: -1, target: no-vault".split(", *")),
YamlAgitator.missingFields("name, account, balance, sender, target, sendingTime, from, to, currency, amount, reference".split(", *")))
net.openhft.chronicle.wire.utils.YamlAgitator.messageMissing(),
net.openhft.chronicle.wire.utils.YamlAgitator.duplicateMessage(),
net.openhft.chronicle.wire.utils.YamlAgitator.overrideFields("currency: , amount: NaN, amount: -1, balance: NaN, balance: -1, target: no-vault".split(", *")),
net.openhft.chronicle.wire.utils.YamlAgitator.missingFields("name, account, balance, sender, target, sendingTime, from, to, currency, amount, reference".split(", *")))
.exceptionHandlerFunction(out -> (log, msg, thrown) -> out.jvmError(thrown == null ? msg : (msg + " " + thrown)))
.exceptionHandlerFunctionAndLog(true)
.inputFunction(s -> s.contains("{{")||s.contains("{#") ? new Jinjava().render(s, Collections.emptyMap()) : s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* The main class in the package is:
*
* - ViaThreeFive: A class that takes messages from multiple sources and routes them to multiple sources.
* This class implements the ViaIn<ValueMessage, ValueMessage> and ValueMessage interfaces,
* This class implements the ViaIn&lt;ValueMessage, ValueMessage&gt; and ValueMessage interfaces,
* providing functionality for a named routing path and the handling of ValueMessage objects.
*
* The goal of this package is to provide an efficient and extensible framework for managing the flow of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package run.chronicle.routing.inout;

import net.openhft.chronicle.wire.utils.YamlTester;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

// ViaThreeFiveTest is a test class for testing the ViaThreeFive class.
@SuppressWarnings("deprecation")
public class ViaThreeFiveTest {

// The `via` method is a unit test for the `via` method in the ViaThreeFive class.
@Test
public void via() {
// yt is an instance of YamlTester. The `runTest` method runs a test on the ViaThreeFive class with the input "three-five".
final YamlTester yt = YamlTester.runTest(ViaThreeFive.class, "three-five");
final net.openhft.chronicle.wire.utils.YamlTester yt = net.openhft.chronicle.wire.utils.YamlTester.runTest(ViaThreeFive.class, "three-five");

// Asserts that the expected result is equal to the actual result.
// The `replace` method replaces any occurrences of "---\n---" in the actual result with "---".
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package run.chronicle.routing.out;

import net.openhft.chronicle.wire.utils.YamlTester;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

// SifterImplTest is a test class for testing the SifterImpl class.
@SuppressWarnings("deprecation")
public class SifterImplTest {

// The `value` method is a unit test for the `value` method in the SifterImpl class.
@Test
public void value() {
// yt is an instance of YamlTester. The `runTest` method runs a test on the SifterImpl class with the input "sifter".
final YamlTester yt = YamlTester.runTest(SifterImpl.class, "sifter");
final net.openhft.chronicle.wire.utils.YamlTester yt = net.openhft.chronicle.wire.utils.YamlTester.runTest(SifterImpl.class, "sifter");

// Asserts that the expected result is equal to the actual result.
// The `replace` method replaces any occurrences of "---\n---" in the actual result with "---".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class DirectWithExclamationMain {
/**
* This method creates a new {@link AddsExclamation} object that wraps a {@link SaysOutput} object.
* It will add an exclamation mark to the end of each input message and then print the result to the console.
* This behavior is orchestrated by the {@link SaysInput} class, which reads the input and forwards it to the given {@link Says} implementation.
* This behavior is orchestrated by the {@link SaysInput} class, which reads the input and forwards it to the given {@link SaysInput} implementation.
*
* @param args Command-line arguments, not used in this implementation.
* @throws IOException If an I/O error occurs while reading from the standard input.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* such as user actions, sensor outputs, or messages from other programs or threads.
*
* <p>Classes in this package may define specific events, listeners, and mechanisms to handle events
* within an application. Implementations can vary widely depending on the requirements of the system.</p>
* within an application. Implementations can vary widely depending on the requirements of the system.
*/
package event.driven.program;
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package event.driven.program;

import net.openhft.chronicle.wire.utils.YamlTester;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

@SuppressWarnings("deprecation")
public class AddsExclamationTest {
// Test method for the 'say' functionality in the AddsExclamation class
@Test
public void say() {
// Create a YamlTester object by running a test on AddsExclamation class with the provided data file 'says'
YamlTester yt = YamlTester.runTest(AddsExclamation.class, "says");
net.openhft.chronicle.wire.utils.YamlTester yt = net.openhft.chronicle.wire.utils.YamlTester.runTest(AddsExclamation.class, "says");

// Assert that the expected value matches the actual value returned by the 'say' method
assertEquals(yt.expected(), yt.actual());
Expand Down
2 changes: 1 addition & 1 deletion md-pipeline/src/main/java/org/trading/api/All.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.trading.api;

/**
* Convenience interface for {@code ChronicleReaderMain
* Convenience interface for {@code ChronicleReaderMain} to include all interfaces.
*/
public interface All extends AggregatorIn, AggregatorOut, OMSIn {
}
4 changes: 2 additions & 2 deletions md-pipeline/src/test/java/org/trading/AggregatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

package org.trading;

import net.openhft.chronicle.wire.utils.YamlTester;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

@SuppressWarnings("deprecation")
public class AggregatorTest {
public static void runTest(String path) {
// Runs the test using the YamlTester against the AggregatorImpl class, passing the path to the YAML file
YamlTester yt = YamlTester.runTest(AggregatorImpl.class, path);
net.openhft.chronicle.wire.utils.YamlTester yt = net.openhft.chronicle.wire.utils.YamlTester.runTest(AggregatorImpl.class, path);
// Asserts that the expected state defined in the YAML file matches the actual state obtained from running the test
assertEquals(yt.expected(), yt.actual());
}
Expand Down
4 changes: 2 additions & 2 deletions md-pipeline/src/test/java/org/trading/StrategyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

package org.trading;

import net.openhft.chronicle.wire.utils.YamlTester;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

@SuppressWarnings("deprecation")
public class StrategyTest {
public static void runTest(String path) {
// Runs the test using the YamlTester against the StrategyImpl class, passing the path to the YAML file
YamlTester yt = YamlTester.runTest(StrategyImpl.class, path);
net.openhft.chronicle.wire.utils.YamlTester yt = net.openhft.chronicle.wire.utils.YamlTester.runTest(StrategyImpl.class, path);
// Asserts that the expected state defined in the YAML file matches the actual state obtained from running the test
assertEquals(yt.expected(), yt.actual());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static void main(String[] args) {
try (ChronicleQueue queue = ChronicleQueue.singleBuilder("in").sourceId(1).build()) {
Events build = queue.methodWriterBuilder(Events.class).build();
long start = System.nanoTime();
double interval = 1e9 / RATE;
long interval = (long) (1e9 / RATE);
EventTwo two = new EventTwo();

for (int i = 0; i < EVENTS; i++) {
Expand Down
4 changes: 0 additions & 4 deletions order-processor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<executions>
<execution>
<id>bench</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
Expand All @@ -40,7 +39,6 @@
</execution>
<execution>
<id>adder</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
Expand All @@ -51,7 +49,6 @@
</execution>
<execution>
<id>viewer</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
Expand All @@ -62,7 +59,6 @@
</execution>
<execution>
<id>dump</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
Expand Down
18 changes: 8 additions & 10 deletions order-processor/src/test/java/town/lost/oms/OMSImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

import net.openhft.chronicle.core.time.SetTimeProvider;
import net.openhft.chronicle.core.time.SystemTimeProvider;
import net.openhft.chronicle.wire.utils.YamlAgitator;
import net.openhft.chronicle.wire.utils.YamlTester;
import net.openhft.chronicle.wire.utils.YamlTesterParametersBuilder;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -26,6 +23,7 @@
* The OMSImplTest runs tests for each method in OMSImpl class.
* The test data is read from specified files and the actual output is compared against expected output.
*/
@SuppressWarnings("deprecation")
@RunWith(Parameterized.class)
public class OMSImplTest {
// Defines the paths to the tests to run.
Expand All @@ -38,10 +36,10 @@ public class OMSImplTest {

// The name of the test, and the tester that will run the test.
final String name;
final YamlTester tester;
final net.openhft.chronicle.wire.utils.YamlTester tester;

// Constructor that sets the name and tester.
public OMSImplTest(String name, YamlTester tester) {
public OMSImplTest(String name, net.openhft.chronicle.wire.utils.YamlTester tester) {
this.name = name;
this.tester = tester;
}
Expand All @@ -52,12 +50,12 @@ public static List<Object[]> parameters() {
// Returns a list of test parameters to run the tests with.
// Each test will be run with an instance of AccountManagerImpl,
// and will be subjected to various agitations to ensure robustness.
return new YamlTesterParametersBuilder<>(out -> new OMSImpl(out), OMSOut.class, paths)
return new net.openhft.chronicle.wire.utils.YamlTesterParametersBuilder<>(out -> new OMSImpl(out), OMSOut.class, paths)
.agitators(
YamlAgitator.messageMissing(),
YamlAgitator.duplicateMessage(),
YamlAgitator.overrideFields("sendingTime: '', symbol: '', side: '', orderQty: NaN, orderQty: -1, price: NaN, price: -1, clOrdId: '', ordType: ''".split(", *")),
YamlAgitator.missingFields("sender, target, sendingTime, symbol, transactTime, account, orderQty, price, side, clOrdID, ordType, timeInForce, currency".split(", *")))
net.openhft.chronicle.wire.utils.YamlAgitator.messageMissing(),
net.openhft.chronicle.wire.utils.YamlAgitator.duplicateMessage(),
net.openhft.chronicle.wire.utils.YamlAgitator.overrideFields("sendingTime: '', symbol: '', side: '', orderQty: NaN, orderQty: -1, price: NaN, price: -1, clOrdId: '', ordType: ''".split(", *")),
net.openhft.chronicle.wire.utils.YamlAgitator.missingFields("sender, target, sendingTime, symbol, transactTime, account, orderQty, price, side, clOrdID, ordType, timeInForce, currency".split(", *")))
.exceptionHandlerFunction(out -> (log, msg, thrown) -> out.jvmError(thrown == null ? msg : (msg + " " + thrown)))
.exceptionHandlerFunctionAndLog(true)
.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
* <li>{@link net.openhft.chronicle.queue.simple.translator.InputMain} - The main class that takes user input and writes
* it to the English queue.</li>
* </ul>
* </p>
*
*/
package net.openhft.chronicle.queue.simple.translator;

0 comments on commit 75c2beb

Please sign in to comment.