From 8142e3d73fbda7da403532932c1c11e5e489dfaf Mon Sep 17 00:00:00 2001 From: bmalinowsky Date: Wed, 1 Nov 2023 23:06:28 +0100 Subject: [PATCH] Replace deprecated method --- src/io/calimero/baos/ip/BaosIp.java | 4 ++-- test/io/calimero/Util.java | 4 ++-- test/io/calimero/baos/BaosTest.java | 2 +- test/io/calimero/knxnetip/DiscovererTest.java | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/io/calimero/baos/ip/BaosIp.java b/src/io/calimero/baos/ip/BaosIp.java index 34ee183f..283a48ac 100644 --- a/src/io/calimero/baos/ip/BaosIp.java +++ b/src/io/calimero/baos/ip/BaosIp.java @@ -1,6 +1,6 @@ /* Calimero 2 - A library for KNX network access - Copyright (c) 2019, 2021 B. Malinowsky + Copyright (c) 2019, 2023 B. Malinowsky This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,7 +49,7 @@ public final class BaosIp { public static boolean supportsBaos(final Discoverer.Result result) { - final var mfrDib = result.getResponse().description().stream().filter(ManufacturerDIB.class::isInstance) + final var mfrDib = result.response().description().stream().filter(ManufacturerDIB.class::isInstance) .map(ManufacturerDIB.class::cast).filter(dib -> dib.getStructLength() == 8).findFirst(); if (mfrDib.isEmpty()) return false; diff --git a/test/io/calimero/Util.java b/test/io/calimero/Util.java index f68b8eef..af3f0ee5 100644 --- a/test/io/calimero/Util.java +++ b/test/io/calimero/Util.java @@ -144,7 +144,7 @@ public static IndividualAddress getRouterAddress() d.startSearch(2, true); if (d.getSearchResponses().isEmpty()) return null; - device = d.getSearchResponses().get(0).getResponse().getDevice().getAddress(); + device = d.getSearchResponses().get(0).response().getDevice().getAddress(); } catch (final InterruptedException e) { e.printStackTrace(); @@ -255,7 +255,7 @@ public static synchronized InetSocketAddress getServer() e.printStackTrace(); } for (final Result r : d.getSearchResponses()) { - final SearchResponse res = r.getResponse(); + final SearchResponse res = r.response(); if (testServerId.equals(res.getDevice().getName())) { final InetAddress addr = res.getControlEndpoint().getAddress(); server = new InetSocketAddress(addr, res.getControlEndpoint().getPort()); diff --git a/test/io/calimero/baos/BaosTest.java b/test/io/calimero/baos/BaosTest.java index 7b39f339..118ace73 100644 --- a/test/io/calimero/baos/BaosTest.java +++ b/test/io/calimero/baos/BaosTest.java @@ -76,7 +76,7 @@ class BaosTest { static void init() throws InterruptedException, ExecutionException { final var discoverer = new Discoverer(0, true); list = new ArrayList<>(discoverer.timeout(Duration.ofSeconds(2)).search().get()); - list.removeIf(r -> !r.getResponse().getDevice().getName() + list.removeIf(r -> !r.response().getDevice().getName() .contains("calimero-core knx test-server")); if (list.isEmpty()) fail("no KNX IP server found"); diff --git a/test/io/calimero/knxnetip/DiscovererTest.java b/test/io/calimero/knxnetip/DiscovererTest.java index 25aa42f7..996a46c8 100644 --- a/test/io/calimero/knxnetip/DiscovererTest.java +++ b/test/io/calimero/knxnetip/DiscovererTest.java @@ -36,6 +36,7 @@ package io.calimero.knxnetip; +import static io.calimero.knxnetip.util.Srp.withService; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; @@ -43,7 +44,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import static io.calimero.knxnetip.util.Srp.withService; import java.net.InetSocketAddress; import java.net.SocketException; @@ -65,8 +65,6 @@ import org.junit.jupiter.api.parallel.ExecutionMode; import org.opentest4j.AssertionFailedError; -import tag.KnxnetIP; -import tag.Slow; import io.calimero.KNXException; import io.calimero.KNXIllegalArgumentException; import io.calimero.Util; @@ -75,6 +73,8 @@ import io.calimero.knxnetip.servicetype.DescriptionResponse; import io.calimero.knxnetip.servicetype.SearchResponse; import io.calimero.knxnetip.util.ServiceFamiliesDIB.ServiceFamily; +import tag.KnxnetIP; +import tag.Slow; @KnxnetIP @@ -191,7 +191,7 @@ private void doGetSearchRes(final Discoverer d) throws InterruptedException final List> search = d.getSearchResponses(); assertFalse(search.isEmpty()); for (final Result result : search) { - final SearchResponse response = result.getResponse(); + final SearchResponse response = result.response(); assertNotNull(response); assertNotNull(result.localEndpoint().getAddress()); assertNotEquals(0, result.localEndpoint().getPort()); @@ -237,7 +237,7 @@ private void doStartSearchIF(final Discoverer d, final boolean usesMulticast) final List> search = d.getSearchResponses(); assertFalse(search.isEmpty(), "search results > 0"); for (final Result result : search) { - final SearchResponse response = result.getResponse(); + final SearchResponse response = result.response(); assertNotNull(response); }