From 5467807157c72f8a821e5dec0f3ae972231868b1 Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Wed, 13 Jul 2022 10:54:10 +0200 Subject: [PATCH 1/6] Use impsort-maven-plugin to imports are well sorted. --- build-config/pom.xml | 16 ++++++++++++++++ pom.xml | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/build-config/pom.xml b/build-config/pom.xml index cbdc4497cf..0e82dd2cc4 100644 --- a/build-config/pom.xml +++ b/build-config/pom.xml @@ -281,6 +281,22 @@ Contributors: + + net.revelc.code + impsort-maven-plugin + + true + * + java.,javax.,org.,com. + + + + + check + + + + net.revelc.code.formatter formatter-maven-plugin diff --git a/pom.xml b/pom.xml index e4ad32860c..33a190e382 100644 --- a/pom.xml +++ b/pom.xml @@ -285,6 +285,11 @@ Contributors: + + net.revelc.code + impsort-maven-plugin + 1.6.2 + net.revelc.code.formatter formatter-maven-plugin From 484c6d7ff0f678d3e9bf1860b573f5a759829d6f Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Wed, 13 Jul 2022 10:54:32 +0200 Subject: [PATCH 2/6] Sort all java imports. --- .../leshan/core/demo/ValidateDemoModelsTest.java | 1 - .../node/codec/senml/LwM2mResolvedSenMLRecord.java | 2 +- .../core/request/AbstractSimpleDownlinkRequest.java | 2 +- .../leshan/core/request/WriteCompositeRequest.java | 2 +- .../org/eclipse/leshan/core/util/X509CertUtil.java | 8 ++++++-- .../core/link/attributes/AttributeSetTest.java | 2 -- .../org/eclipse/leshan/core/tlv/TlvDecoderTest.java | 4 ---- .../org/eclipse/leshan/core/tlv/TlvEncoderTest.java | 7 +------ .../eclipse/leshan/core/util/X509CertUtilTest.java | 13 ++++++++----- .../request/CaliforniumQueueModeRequestSender.java | 2 +- .../leshan/server/queue/PresenceServiceImpl.java | 2 +- .../leshan/server/demo/servlet/log/CoapMessage.java | 2 +- 12 files changed, 21 insertions(+), 26 deletions(-) diff --git a/leshan-core-demo/src/test/java/org/eclipse/leshan/core/demo/ValidateDemoModelsTest.java b/leshan-core-demo/src/test/java/org/eclipse/leshan/core/demo/ValidateDemoModelsTest.java index 7d2e41dcb9..40e2a16de1 100644 --- a/leshan-core-demo/src/test/java/org/eclipse/leshan/core/demo/ValidateDemoModelsTest.java +++ b/leshan-core-demo/src/test/java/org/eclipse/leshan/core/demo/ValidateDemoModelsTest.java @@ -17,7 +17,6 @@ import java.io.IOException; -import org.eclipse.leshan.core.demo.LwM2mDemoConstant; import org.eclipse.leshan.core.model.InvalidDDFFileException; import org.eclipse.leshan.core.model.InvalidModelException; import org.eclipse.leshan.core.model.ObjectLoader; diff --git a/leshan-core/src/main/java/org/eclipse/leshan/core/node/codec/senml/LwM2mResolvedSenMLRecord.java b/leshan-core/src/main/java/org/eclipse/leshan/core/node/codec/senml/LwM2mResolvedSenMLRecord.java index 154e9e5ca3..8ceddead42 100644 --- a/leshan-core/src/main/java/org/eclipse/leshan/core/node/codec/senml/LwM2mResolvedSenMLRecord.java +++ b/leshan-core/src/main/java/org/eclipse/leshan/core/node/codec/senml/LwM2mResolvedSenMLRecord.java @@ -15,8 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.core.node.codec.senml; -import org.eclipse.leshan.core.node.LwM2mPath; import org.eclipse.leshan.core.node.InvalidLwM2mPathException; +import org.eclipse.leshan.core.node.LwM2mPath; import org.eclipse.leshan.senml.ResolvedSenMLRecord; import org.eclipse.leshan.senml.SenMLRecord; diff --git a/leshan-core/src/main/java/org/eclipse/leshan/core/request/AbstractSimpleDownlinkRequest.java b/leshan-core/src/main/java/org/eclipse/leshan/core/request/AbstractSimpleDownlinkRequest.java index c3fb4b4a19..6f7c6143dd 100644 --- a/leshan-core/src/main/java/org/eclipse/leshan/core/request/AbstractSimpleDownlinkRequest.java +++ b/leshan-core/src/main/java/org/eclipse/leshan/core/request/AbstractSimpleDownlinkRequest.java @@ -15,8 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.core.request; -import org.eclipse.leshan.core.node.LwM2mPath; import org.eclipse.leshan.core.node.InvalidLwM2mPathException; +import org.eclipse.leshan.core.node.LwM2mPath; import org.eclipse.leshan.core.request.exception.InvalidRequestException; import org.eclipse.leshan.core.response.LwM2mResponse; diff --git a/leshan-core/src/main/java/org/eclipse/leshan/core/request/WriteCompositeRequest.java b/leshan-core/src/main/java/org/eclipse/leshan/core/request/WriteCompositeRequest.java index d87a317641..6d565313c4 100644 --- a/leshan-core/src/main/java/org/eclipse/leshan/core/request/WriteCompositeRequest.java +++ b/leshan-core/src/main/java/org/eclipse/leshan/core/request/WriteCompositeRequest.java @@ -22,9 +22,9 @@ import java.util.Map; import java.util.Map.Entry; +import org.eclipse.leshan.core.node.InvalidLwM2mPathException; import org.eclipse.leshan.core.node.LwM2mNode; import org.eclipse.leshan.core.node.LwM2mPath; -import org.eclipse.leshan.core.node.InvalidLwM2mPathException; import org.eclipse.leshan.core.node.LwM2mResourceInstance; import org.eclipse.leshan.core.node.LwM2mSingleResource; import org.eclipse.leshan.core.node.ObjectLink; diff --git a/leshan-core/src/main/java/org/eclipse/leshan/core/util/X509CertUtil.java b/leshan-core/src/main/java/org/eclipse/leshan/core/util/X509CertUtil.java index 0ccc297f7d..7ca2d5684b 100644 --- a/leshan-core/src/main/java/org/eclipse/leshan/core/util/X509CertUtil.java +++ b/leshan-core/src/main/java/org/eclipse/leshan/core/util/X509CertUtil.java @@ -1,11 +1,15 @@ package org.eclipse.leshan.core.util; -import javax.security.auth.x500.X500Principal; import java.net.InetAddress; import java.security.Principal; import java.security.cert.CertificateParsingException; import java.security.cert.X509Certificate; -import java.util.*; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.security.auth.x500.X500Principal; /** * X.509 Certificate Utilities for accessing certificate details. diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/link/attributes/AttributeSetTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/link/attributes/AttributeSetTest.java index 7f32efb275..3f69cfffa8 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/link/attributes/AttributeSetTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/link/attributes/AttributeSetTest.java @@ -22,8 +22,6 @@ import java.util.Map; import org.eclipse.leshan.core.LwM2m.Version; -import org.eclipse.leshan.core.link.attributes.Attribute; -import org.eclipse.leshan.core.link.attributes.InvalidAttributeException; import org.eclipse.leshan.core.link.lwm2m.attributes.AssignationLevel; import org.eclipse.leshan.core.link.lwm2m.attributes.DefaultLwM2mAttributeParser; import org.eclipse.leshan.core.link.lwm2m.attributes.LwM2mAttributeParser; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvDecoderTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvDecoderTest.java index 99b8181ea3..fd90bea986 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvDecoderTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvDecoderTest.java @@ -21,10 +21,6 @@ import java.util.Arrays; import org.eclipse.leshan.core.node.ObjectLink; -import org.eclipse.leshan.core.tlv.Tlv; -import org.eclipse.leshan.core.tlv.TlvDecoder; -import org.eclipse.leshan.core.tlv.TlvEncoder; -import org.eclipse.leshan.core.tlv.TlvException; import org.eclipse.leshan.core.util.Hex; import org.junit.Test; import org.slf4j.Logger; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvEncoderTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvEncoderTest.java index da37e8da39..33caf81f33 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvEncoderTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvEncoderTest.java @@ -15,16 +15,11 @@ *******************************************************************************/ package org.eclipse.leshan.core.tlv; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; import java.nio.ByteBuffer; import java.util.Date; -import org.eclipse.leshan.core.tlv.Tlv; -import org.eclipse.leshan.core.tlv.TlvDecoder; -import org.eclipse.leshan.core.tlv.TlvEncoder; -import org.eclipse.leshan.core.tlv.TlvException; import org.eclipse.leshan.core.tlv.Tlv.TlvType; import org.junit.Test; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/util/X509CertUtilTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/util/X509CertUtilTest.java index 727c949f6b..49d16fdc07 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/util/X509CertUtilTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/util/X509CertUtilTest.java @@ -1,19 +1,22 @@ package org.eclipse.leshan.core.util; -import org.junit.Assert; -import org.junit.Test; - -import javax.security.auth.x500.X500Principal; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; -import java.security.*; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; +import javax.security.auth.x500.X500Principal; + +import org.junit.Assert; +import org.junit.Test; + public class X509CertUtilTest { private final KeyStore keyStore; diff --git a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/request/CaliforniumQueueModeRequestSender.java b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/request/CaliforniumQueueModeRequestSender.java index 7e6978f330..aab5cf9ff9 100644 --- a/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/request/CaliforniumQueueModeRequestSender.java +++ b/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/request/CaliforniumQueueModeRequestSender.java @@ -17,11 +17,11 @@ import org.eclipse.californium.core.coap.Request; import org.eclipse.californium.core.coap.Response; +import org.eclipse.leshan.core.Destroyable; import org.eclipse.leshan.core.californium.CoapResponseCallback; import org.eclipse.leshan.core.request.exception.ClientSleepingException; import org.eclipse.leshan.core.request.exception.TimeoutException; import org.eclipse.leshan.core.response.ErrorCallback; -import org.eclipse.leshan.core.Destroyable; import org.eclipse.leshan.server.queue.PresenceServiceImpl; import org.eclipse.leshan.server.queue.QueueModeLwM2mRequestSender; import org.eclipse.leshan.server.registration.Registration; diff --git a/leshan-server-core/src/main/java/org/eclipse/leshan/server/queue/PresenceServiceImpl.java b/leshan-server-core/src/main/java/org/eclipse/leshan/server/queue/PresenceServiceImpl.java index 41cddfa05e..019e4b9914 100644 --- a/leshan-server-core/src/main/java/org/eclipse/leshan/server/queue/PresenceServiceImpl.java +++ b/leshan-server-core/src/main/java/org/eclipse/leshan/server/queue/PresenceServiceImpl.java @@ -26,8 +26,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import org.eclipse.leshan.core.util.NamedThreadFactory; import org.eclipse.leshan.core.Destroyable; +import org.eclipse.leshan.core.util.NamedThreadFactory; import org.eclipse.leshan.server.registration.Registration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessage.java b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessage.java index fa7f89b16a..d69791a6bf 100644 --- a/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessage.java +++ b/leshan-server-demo/src/main/java/org/eclipse/leshan/server/demo/servlet/log/CoapMessage.java @@ -24,13 +24,13 @@ import org.apache.commons.lang.StringUtils; import org.eclipse.californium.core.coap.CoAP.Type; -import org.eclipse.leshan.core.util.Hex; import org.eclipse.californium.core.coap.EmptyMessage; import org.eclipse.californium.core.coap.Option; import org.eclipse.californium.core.coap.OptionNumberRegistry; import org.eclipse.californium.core.coap.OptionSet; import org.eclipse.californium.core.coap.Request; import org.eclipse.californium.core.coap.Response; +import org.eclipse.leshan.core.util.Hex; public class CoapMessage { From 283d292e396b7cc8ba8b3d4b552b143f36f7f200 Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Wed, 13 Jul 2022 11:13:47 +0200 Subject: [PATCH 3/6] Do not allow wildcard(*) import with checkstyle. (Update eclipse config too) --- eclipse/checkstyle.xml | 2 ++ eclipse/settings/org.eclipse.jdt.ui.prefs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eclipse/checkstyle.xml b/eclipse/checkstyle.xml index a81b1d5cdb..4bfc267b4c 100644 --- a/eclipse/checkstyle.xml +++ b/eclipse/checkstyle.xml @@ -11,7 +11,9 @@ + + diff --git a/eclipse/settings/org.eclipse.jdt.ui.prefs b/eclipse/settings/org.eclipse.jdt.ui.prefs index 84baace017..64c2ea7f1e 100644 --- a/eclipse/settings/org.eclipse.jdt.ui.prefs +++ b/eclipse/settings/org.eclipse.jdt.ui.prefs @@ -7,7 +7,7 @@ org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;org;com; org.eclipse.jdt.ui.javadoc=false org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=2 +org.eclipse.jdt.ui.staticondemandthreshold=99 org.eclipse.jdt.ui.text.custom_code_templates= sp_cleanup.add_default_serial_version_id=true sp_cleanup.add_generated_serial_version_id=false From 5c50fcf311ffdaf55bef21592b6ec88e3f619677 Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Wed, 13 Jul 2022 11:14:04 +0200 Subject: [PATCH 4/6] Remove wildcard(*) import in all code. --- .../eclipse/leshan/client/object/Oscore.java | 7 +++++- .../leshan/client/object/Security.java | 11 ++++++++- .../client/servers/ServersInfoExtractor.java | 24 ++++++++++++++++++- .../util/BaseInstanceEnablerFactoryTest.java | 3 ++- .../client/util/LinkFormatHelperTest.java | 3 ++- .../leshan/client/demo/LeshanClientDemo.java | 17 +++++++++++-- .../org/eclipse/leshan/core/VersionTest.java | 3 ++- .../leshan/core/datatype/NumberUtilTest.java | 4 +++- .../core/link/attributes/AttributeTest.java | 4 +++- .../core/model/LwM2mModelRespositotyTest.java | 3 ++- .../leshan/core/node/LwM2MResourceTest.java | 3 ++- .../core/node/TimestampedLwM2mNodesTest.java | 6 ++++- .../core/node/codec/LwM2mNodeDecoderTest.java | 8 ++++++- .../core/request/ContentFormatTest.java | 9 ++++++- .../argument/ArgumentaSerializingTest.java | 3 ++- .../argument/ArgumentsParsingTest.java | 5 +++- .../core/request/argument/ArgumentsTest.java | 4 +++- .../core/response/ObserveResponseTest.java | 7 ++++-- .../leshan/core/tlv/TlvDecoderTest.java | 4 +++- .../leshan/core/tlv/TlvEncoderTest.java | 3 ++- .../integration/tests/BootstrapTest.java | 8 +++++-- .../leshan/integration/tests/DeleteTest.java | 3 ++- .../integration/tests/DiscoverTest.java | 6 +++-- .../leshan/integration/tests/ExecuteTest.java | 3 ++- .../integration/tests/QueueModeTest.java | 3 ++- .../integration/tests/RegistrationTest.java | 11 +++++++-- .../integration/tests/SecurityTest.java | 16 +++++++++++-- .../tests/create/CreateFailedTest.java | 3 ++- .../integration/tests/create/CreateTest.java | 4 +++- .../tests/observe/ObserveCompositeTest.java | 5 +++- .../tests/observe/ObserveTest.java | 5 +++- .../tests/observe/ObserveTimeStampTest.java | 4 +++- .../tests/read/ReadFailedTest.java | 6 +++-- .../tests/read/ReadMultiValueTest.java | 3 ++- .../tests/read/ReadOpaqueValueTest.java | 3 ++- .../tests/read/ReadSingleValueTest.java | 3 ++- .../integration/tests/send/SendTest.java | 4 +++- .../tests/send/SendTimestampedTest.java | 4 +++- .../redis/RedisRegistrationStoreTest.java | 4 +++- .../tests/util/IntegrationTestHelper.java | 6 ++++- .../util/QueueModeIntegrationTestHelper.java | 6 ++++- .../util/SecureIntegrationTestHelper.java | 3 ++- .../integration/tests/util/TestUtil.java | 4 +++- .../tests/write/WriteCompositeTest.java | 4 +++- .../tests/write/WriteFailedTest.java | 3 ++- .../tests/write/WriteMultiValueTest.java | 4 +++- .../tests/write/WriteOpaqueValueTest.java | 4 +++- .../tests/write/WriteSingleValueTest.java | 4 +++- .../californium/LeshanServerBuilderTest.java | 3 ++- .../LeshanBootstrapServerBuilderTest.java | 3 ++- .../observation/ObservationServiceTest.java | 3 ++- .../observation/ObserveUtilTest.java | 4 +++- .../InMemoryRegistrationStoreTest.java | 4 +++- .../request/CoapRequestBuilderTest.java | 3 ++- .../request/LwM2mResponseBuilderTest.java | 3 ++- .../bootstrap/DefaultBootstrapHandler.java | 7 +++++- .../bootstrap/BootstrapHandlerTest.java | 5 +++- .../server/queue/PresenceServiceTest.java | 4 +++- .../server/registration/RegistrationTest.java | 4 +++- 59 files changed, 244 insertions(+), 66 deletions(-) diff --git a/leshan-client-core/src/main/java/org/eclipse/leshan/client/object/Oscore.java b/leshan-client-core/src/main/java/org/eclipse/leshan/client/object/Oscore.java index 3928ef6c90..e2116a760e 100644 --- a/leshan-client-core/src/main/java/org/eclipse/leshan/client/object/Oscore.java +++ b/leshan-client-core/src/main/java/org/eclipse/leshan/client/object/Oscore.java @@ -17,7 +17,12 @@ *******************************************************************************/ package org.eclipse.leshan.client.object; -import static org.eclipse.leshan.core.LwM2mId.*; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_AEAD_ALGORITHM; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_HMAC_ALGORITHM; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_MASTER_SALT; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_MASTER_SECRET; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_RECIPIENT_ID; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_SENDER_ID; import java.util.Arrays; import java.util.List; diff --git a/leshan-client-core/src/main/java/org/eclipse/leshan/client/object/Security.java b/leshan-client-core/src/main/java/org/eclipse/leshan/client/object/Security.java index 772044ff76..2321903a8c 100644 --- a/leshan-client-core/src/main/java/org/eclipse/leshan/client/object/Security.java +++ b/leshan-client-core/src/main/java/org/eclipse/leshan/client/object/Security.java @@ -16,7 +16,16 @@ *******************************************************************************/ package org.eclipse.leshan.client.object; -import static org.eclipse.leshan.core.LwM2mId.*; +import static org.eclipse.leshan.core.LwM2mId.OSCORE; +import static org.eclipse.leshan.core.LwM2mId.SEC_BOOTSTRAP; +import static org.eclipse.leshan.core.LwM2mId.SEC_CERTIFICATE_USAGE; +import static org.eclipse.leshan.core.LwM2mId.SEC_OSCORE_SECURITY_MODE; +import static org.eclipse.leshan.core.LwM2mId.SEC_PUBKEY_IDENTITY; +import static org.eclipse.leshan.core.LwM2mId.SEC_SECRET_KEY; +import static org.eclipse.leshan.core.LwM2mId.SEC_SECURITY_MODE; +import static org.eclipse.leshan.core.LwM2mId.SEC_SERVER_ID; +import static org.eclipse.leshan.core.LwM2mId.SEC_SERVER_PUBKEY; +import static org.eclipse.leshan.core.LwM2mId.SEC_SERVER_URI; import java.util.Arrays; import java.util.List; diff --git a/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/ServersInfoExtractor.java b/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/ServersInfoExtractor.java index 90a76dfa68..ba5d493f60 100644 --- a/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/ServersInfoExtractor.java +++ b/leshan-client-core/src/main/java/org/eclipse/leshan/client/servers/ServersInfoExtractor.java @@ -18,7 +18,29 @@ package org.eclipse.leshan.client.servers; import static org.eclipse.leshan.client.servers.ServerIdentity.SYSTEM; -import static org.eclipse.leshan.core.LwM2mId.*; +import static org.eclipse.leshan.core.LwM2mId.DEVICE; +import static org.eclipse.leshan.core.LwM2mId.DVC_SUPPORTED_BINDING; +import static org.eclipse.leshan.core.LwM2mId.OSCORE; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_AEAD_ALGORITHM; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_HMAC_ALGORITHM; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_MASTER_SALT; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_MASTER_SECRET; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_RECIPIENT_ID; +import static org.eclipse.leshan.core.LwM2mId.OSCORE_SENDER_ID; +import static org.eclipse.leshan.core.LwM2mId.SECURITY; +import static org.eclipse.leshan.core.LwM2mId.SEC_BOOTSTRAP; +import static org.eclipse.leshan.core.LwM2mId.SEC_CERTIFICATE_USAGE; +import static org.eclipse.leshan.core.LwM2mId.SEC_OSCORE_SECURITY_MODE; +import static org.eclipse.leshan.core.LwM2mId.SEC_PUBKEY_IDENTITY; +import static org.eclipse.leshan.core.LwM2mId.SEC_SECRET_KEY; +import static org.eclipse.leshan.core.LwM2mId.SEC_SECURITY_MODE; +import static org.eclipse.leshan.core.LwM2mId.SEC_SERVER_ID; +import static org.eclipse.leshan.core.LwM2mId.SEC_SERVER_PUBKEY; +import static org.eclipse.leshan.core.LwM2mId.SEC_SERVER_URI; +import static org.eclipse.leshan.core.LwM2mId.SERVER; +import static org.eclipse.leshan.core.LwM2mId.SRV_BINDING; +import static org.eclipse.leshan.core.LwM2mId.SRV_LIFETIME; +import static org.eclipse.leshan.core.LwM2mId.SRV_SERVER_ID; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/leshan-client-core/src/test/java/org/eclipse/leshan/client/util/BaseInstanceEnablerFactoryTest.java b/leshan-client-core/src/test/java/org/eclipse/leshan/client/util/BaseInstanceEnablerFactoryTest.java index 35223bf534..71e073d209 100644 --- a/leshan-client-core/src/test/java/org/eclipse/leshan/client/util/BaseInstanceEnablerFactoryTest.java +++ b/leshan-client-core/src/test/java/org/eclipse/leshan/client/util/BaseInstanceEnablerFactoryTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.client.util; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import java.util.Arrays; import java.util.Collections; diff --git a/leshan-client-core/src/test/java/org/eclipse/leshan/client/util/LinkFormatHelperTest.java b/leshan-client-core/src/test/java/org/eclipse/leshan/client/util/LinkFormatHelperTest.java index 0da7eef36a..022ad57ce7 100644 --- a/leshan-client-core/src/test/java/org/eclipse/leshan/client/util/LinkFormatHelperTest.java +++ b/leshan-client-core/src/test/java/org/eclipse/leshan/client/util/LinkFormatHelperTest.java @@ -16,7 +16,8 @@ *******************************************************************************/ package org.eclipse.leshan.client.util; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.Arrays; diff --git a/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/LeshanClientDemo.java b/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/LeshanClientDemo.java index 3222057401..c495c169e7 100644 --- a/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/LeshanClientDemo.java +++ b/leshan-client-demo/src/main/java/org/eclipse/leshan/client/demo/LeshanClientDemo.java @@ -15,8 +15,21 @@ *******************************************************************************/ package org.eclipse.leshan.client.demo; -import static org.eclipse.leshan.client.object.Security.*; -import static org.eclipse.leshan.core.LwM2mId.*; +import static org.eclipse.leshan.client.object.Security.noSec; +import static org.eclipse.leshan.client.object.Security.noSecBootstap; +import static org.eclipse.leshan.client.object.Security.oscoreOnly; +import static org.eclipse.leshan.client.object.Security.oscoreOnlyBootstrap; +import static org.eclipse.leshan.client.object.Security.psk; +import static org.eclipse.leshan.client.object.Security.pskBootstrap; +import static org.eclipse.leshan.client.object.Security.rpk; +import static org.eclipse.leshan.client.object.Security.rpkBootstrap; +import static org.eclipse.leshan.client.object.Security.x509; +import static org.eclipse.leshan.client.object.Security.x509Bootstrap; +import static org.eclipse.leshan.core.LwM2mId.DEVICE; +import static org.eclipse.leshan.core.LwM2mId.LOCATION; +import static org.eclipse.leshan.core.LwM2mId.OSCORE; +import static org.eclipse.leshan.core.LwM2mId.SECURITY; +import static org.eclipse.leshan.core.LwM2mId.SERVER; import java.io.File; import java.io.PrintWriter; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/VersionTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/VersionTest.java index db2176f800..7d4552a3d6 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/VersionTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/VersionTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.core; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.eclipse.leshan.core.LwM2m.LwM2mVersion; import org.eclipse.leshan.core.LwM2m.Version; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/datatype/NumberUtilTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/datatype/NumberUtilTest.java index fd6f3cc5dc..b4ab6e7668 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/datatype/NumberUtilTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/datatype/NumberUtilTest.java @@ -15,7 +15,9 @@ *******************************************************************************/ package org.eclipse.leshan.core.datatype; -import static org.eclipse.leshan.core.util.datatype.NumberUtil.*; +import static org.eclipse.leshan.core.util.datatype.NumberUtil.longToInt; +import static org.eclipse.leshan.core.util.datatype.NumberUtil.numberToLong; +import static org.eclipse.leshan.core.util.datatype.NumberUtil.numberToULong; import static org.junit.Assert.assertEquals; import java.math.BigDecimal; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/link/attributes/AttributeTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/link/attributes/AttributeTest.java index 77bbfdc8e3..a699d4f82b 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/link/attributes/AttributeTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/link/attributes/AttributeTest.java @@ -1,6 +1,8 @@ package org.eclipse.leshan.core.link.attributes; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import org.eclipse.leshan.core.LwM2m.Version; import org.eclipse.leshan.core.link.lwm2m.attributes.AssignationLevel; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/model/LwM2mModelRespositotyTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/model/LwM2mModelRespositotyTest.java index fcfcb80a79..338c820d7a 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/model/LwM2mModelRespositotyTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/model/LwM2mModelRespositotyTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.core.model; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import java.io.IOException; import java.util.ArrayList; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/node/LwM2MResourceTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/node/LwM2MResourceTest.java index b5d7ea62f6..630b46b138 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/node/LwM2MResourceTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/node/LwM2MResourceTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.core.node; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import java.util.HashMap; import java.util.Map; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/node/TimestampedLwM2mNodesTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/node/TimestampedLwM2mNodesTest.java index eb40ebec45..9eac503e59 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/node/TimestampedLwM2mNodesTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/node/TimestampedLwM2mNodesTest.java @@ -15,7 +15,11 @@ *******************************************************************************/ package org.eclipse.leshan.core.node; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.HashSet; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/node/codec/LwM2mNodeDecoderTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/node/codec/LwM2mNodeDecoderTest.java index f680eaa143..3120f48c51 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/node/codec/LwM2mNodeDecoderTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/node/codec/LwM2mNodeDecoderTest.java @@ -16,7 +16,13 @@ *******************************************************************************/ package org.eclipse.leshan.core.node.codec; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.nio.charset.StandardCharsets; import java.util.ArrayList; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/request/ContentFormatTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/request/ContentFormatTest.java index 2af334441a..b3cc2a88bf 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/request/ContentFormatTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/request/ContentFormatTest.java @@ -15,7 +15,14 @@ *******************************************************************************/ package org.eclipse.leshan.core.request; -import static org.eclipse.leshan.core.request.ContentFormat.*; +import static org.eclipse.leshan.core.request.ContentFormat.CBOR; +import static org.eclipse.leshan.core.request.ContentFormat.JSON; +import static org.eclipse.leshan.core.request.ContentFormat.LINK; +import static org.eclipse.leshan.core.request.ContentFormat.OPAQUE; +import static org.eclipse.leshan.core.request.ContentFormat.SENML_CBOR; +import static org.eclipse.leshan.core.request.ContentFormat.SENML_JSON; +import static org.eclipse.leshan.core.request.ContentFormat.TEXT; +import static org.eclipse.leshan.core.request.ContentFormat.TLV; import static org.junit.Assert.assertEquals; import java.util.Arrays; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentaSerializingTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentaSerializingTest.java index b9bc2e7703..3ed9b8f484 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentaSerializingTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentaSerializingTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.core.request.argument; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import org.junit.Test; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentsParsingTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentsParsingTest.java index 84aa833e8b..f0001e5530 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentsParsingTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentsParsingTest.java @@ -15,7 +15,10 @@ *******************************************************************************/ package org.eclipse.leshan.core.request.argument; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import org.junit.Test; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentsTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentsTest.java index 49bba45279..eb02fd6523 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentsTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/request/argument/ArgumentsTest.java @@ -15,7 +15,9 @@ *******************************************************************************/ package org.eclipse.leshan.core.request.argument; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import java.util.Collection; import java.util.Iterator; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/response/ObserveResponseTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/response/ObserveResponseTest.java index 012060f272..20a8aae9ef 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/response/ObserveResponseTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/response/ObserveResponseTest.java @@ -15,9 +15,12 @@ *******************************************************************************/ package org.eclipse.leshan.core.response; -import static org.eclipse.leshan.core.ResponseCode.*; +import static org.eclipse.leshan.core.ResponseCode.CHANGED; +import static org.eclipse.leshan.core.ResponseCode.CONTENT; import static org.eclipse.leshan.core.node.LwM2mSingleResource.newResource; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvDecoderTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvDecoderTest.java index fd90bea986..57a673d358 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvDecoderTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvDecoderTest.java @@ -15,7 +15,9 @@ *******************************************************************************/ package org.eclipse.leshan.core.tlv; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.nio.ByteBuffer; import java.util.Arrays; diff --git a/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvEncoderTest.java b/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvEncoderTest.java index 33caf81f33..47688aabf6 100644 --- a/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvEncoderTest.java +++ b/leshan-core/src/test/java/org/eclipse/leshan/core/tlv/TlvEncoderTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.core.tlv; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import java.nio.ByteBuffer; import java.util.Date; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/BootstrapTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/BootstrapTest.java index c82eaa9bbf..b447ef9de3 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/BootstrapTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/BootstrapTest.java @@ -17,10 +17,14 @@ package org.eclipse.leshan.integration.tests; import static org.eclipse.leshan.integration.tests.util.IntegrationTestHelper.linkSerializer; -import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.*; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.GOOD_PSK_ID; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.GOOD_PSK_KEY; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.getServerOscoreSetting; import static org.hamcrest.CoreMatchers.hasItems; import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.HashMap; import java.util.Map; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DeleteTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DeleteTest.java index 3b6c3adb8e..6e94b96c51 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DeleteTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DeleteTest.java @@ -22,7 +22,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.eclipse.californium.core.coap.Request; import org.eclipse.californium.core.coap.Response; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DiscoverTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DiscoverTest.java index 117df29514..3eed6c876c 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DiscoverTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/DiscoverTest.java @@ -17,12 +17,14 @@ package org.eclipse.leshan.integration.tests; -import static org.eclipse.leshan.core.ResponseCode.*; +import static org.eclipse.leshan.core.ResponseCode.CONTENT; +import static org.eclipse.leshan.core.ResponseCode.NOT_FOUND; import static org.eclipse.leshan.integration.tests.util.IntegrationTestHelper.linkSerializer; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.eclipse.californium.core.coap.Response; import org.eclipse.leshan.core.link.Link; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ExecuteTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ExecuteTest.java index 3df070d131..3061366211 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ExecuteTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/ExecuteTest.java @@ -22,7 +22,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.eclipse.californium.core.coap.Response; import org.eclipse.leshan.core.ResponseCode; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/QueueModeTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/QueueModeTest.java index 8192c96d41..47b47b61ae 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/QueueModeTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/QueueModeTest.java @@ -18,7 +18,8 @@ package org.eclipse.leshan.integration.tests; import static org.eclipse.leshan.integration.tests.util.IntegrationTestHelper.linkParser; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import org.eclipse.leshan.core.link.LinkParseException; import org.eclipse.leshan.core.request.ReadRequest; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/RegistrationTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/RegistrationTest.java index e1bff53794..4ff089bb73 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/RegistrationTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/RegistrationTest.java @@ -18,11 +18,18 @@ package org.eclipse.leshan.integration.tests; -import static org.eclipse.leshan.integration.tests.util.IntegrationTestHelper.*; +import static org.eclipse.leshan.integration.tests.util.IntegrationTestHelper.LIFETIME; +import static org.eclipse.leshan.integration.tests.util.IntegrationTestHelper.linkParser; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.IOException; import java.net.InetSocketAddress; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/SecurityTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/SecurityTest.java index aad8b21083..491ee07269 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/SecurityTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/SecurityTest.java @@ -16,8 +16,20 @@ package org.eclipse.leshan.integration.tests; import static org.eclipse.leshan.integration.tests.util.IntegrationTestHelper.LIFETIME; -import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.*; -import static org.junit.Assert.*; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.BAD_ENDPOINT; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.BAD_PSK_ID; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.BAD_PSK_KEY; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.GOOD_ENDPOINT; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.GOOD_PSK_ID; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.GOOD_PSK_KEY; +import static org.eclipse.leshan.integration.tests.util.SecureIntegrationTestHelper.getServerOscoreSetting; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.IOException; import java.security.PrivateKey; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/create/CreateFailedTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/create/CreateFailedTest.java index 4bf7b50e3f..c39f045dac 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/create/CreateFailedTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/create/CreateFailedTest.java @@ -18,7 +18,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.eclipse.californium.core.coap.Response; import org.eclipse.leshan.core.ResponseCode; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/create/CreateTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/create/CreateTest.java index 8cee03ef36..426624ca71 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/create/CreateTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/create/CreateTest.java @@ -21,7 +21,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveCompositeTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveCompositeTest.java index f51c2f7dde..985e5ae4db 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveCompositeTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveCompositeTest.java @@ -18,7 +18,10 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.HashMap; import java.util.Map; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveTest.java index 201f9afb8f..8da1e1d467 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveTest.java @@ -22,7 +22,10 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.Set; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveTimeStampTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveTimeStampTest.java index 242f45c32c..99c7ae961d 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveTimeStampTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/observe/ObserveTimeStampTest.java @@ -19,7 +19,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Arrays; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadFailedTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadFailedTest.java index 6ac7245cc2..ddc4860086 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadFailedTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadFailedTest.java @@ -15,11 +15,13 @@ *******************************************************************************/ package org.eclipse.leshan.integration.tests.read; -import static org.eclipse.leshan.core.ResponseCode.*; +import static org.eclipse.leshan.core.ResponseCode.METHOD_NOT_ALLOWED; +import static org.eclipse.leshan.core.ResponseCode.NOT_FOUND; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.eclipse.californium.core.coap.Response; import org.eclipse.leshan.core.request.ReadRequest; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadMultiValueTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadMultiValueTest.java index fa18edd84a..6eb78d1eab 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadMultiValueTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadMultiValueTest.java @@ -19,7 +19,8 @@ import static org.eclipse.leshan.core.ResponseCode.CONTENT; import static org.eclipse.leshan.integration.tests.util.TestUtil.assertContentFormat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadOpaqueValueTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadOpaqueValueTest.java index 3d3fc0bba4..dbc295ceae 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadOpaqueValueTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadOpaqueValueTest.java @@ -17,7 +17,8 @@ import static org.eclipse.leshan.core.ResponseCode.CONTENT; import static org.eclipse.leshan.integration.tests.util.TestUtil.assertContentFormat; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadSingleValueTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadSingleValueTest.java index b5b89a2343..65c243cfb3 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadSingleValueTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/read/ReadSingleValueTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.integration.tests.read; -import static org.eclipse.leshan.core.ResponseCode.*; +import static org.eclipse.leshan.core.ResponseCode.BAD_REQUEST; +import static org.eclipse.leshan.core.ResponseCode.CONTENT; import static org.eclipse.leshan.integration.tests.util.TestUtil.assertContentFormat; import static org.junit.Assert.assertEquals; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/send/SendTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/send/SendTest.java index ee06330808..ade68d36a4 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/send/SendTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/send/SendTest.java @@ -15,7 +15,9 @@ *******************************************************************************/ package org.eclipse.leshan.integration.tests.send; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/send/SendTimestampedTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/send/SendTimestampedTest.java index 2f85063144..d0e7015c48 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/send/SendTimestampedTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/send/SendTimestampedTest.java @@ -15,7 +15,9 @@ *******************************************************************************/ package org.eclipse.leshan.integration.tests.send; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.Map; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/server/redis/RedisRegistrationStoreTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/server/redis/RedisRegistrationStoreTest.java index 67130cb605..adead6f085 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/server/redis/RedisRegistrationStoreTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/server/redis/RedisRegistrationStoreTest.java @@ -16,7 +16,9 @@ *******************************************************************************/ package org.eclipse.leshan.integration.tests.server.redis; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.net.InetAddress; import java.net.InetSocketAddress; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/IntegrationTestHelper.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/IntegrationTestHelper.java index e1c077585c..aafa1d64e6 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/IntegrationTestHelper.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/IntegrationTestHelper.java @@ -18,7 +18,11 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.net.InetAddress; import java.net.InetSocketAddress; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/QueueModeIntegrationTestHelper.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/QueueModeIntegrationTestHelper.java index d836fd23bb..0a98d33f00 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/QueueModeIntegrationTestHelper.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/QueueModeIntegrationTestHelper.java @@ -16,7 +16,11 @@ package org.eclipse.leshan.integration.tests.util; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.util.List; import java.util.concurrent.TimeUnit; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/SecureIntegrationTestHelper.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/SecureIntegrationTestHelper.java index 9dd9d00d18..858f7499cb 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/SecureIntegrationTestHelper.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/SecureIntegrationTestHelper.java @@ -17,7 +17,8 @@ package org.eclipse.leshan.integration.tests.util; import static org.eclipse.leshan.client.object.Security.oscoreOnly; -import static org.eclipse.leshan.core.LwM2mId.*; +import static org.eclipse.leshan.core.LwM2mId.OSCORE; +import static org.eclipse.leshan.core.LwM2mId.SECURITY; import java.io.FileInputStream; import java.io.IOException; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/TestUtil.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/TestUtil.java index d631d902aa..72a1636eb5 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/TestUtil.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/util/TestUtil.java @@ -18,7 +18,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import org.eclipse.californium.core.coap.Response; import org.eclipse.leshan.core.request.ContentFormat; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteCompositeTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteCompositeTest.java index 547c6ebb34..18955a0d1e 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteCompositeTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteCompositeTest.java @@ -18,7 +18,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteFailedTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteFailedTest.java index de4df8d574..4c2de0b3f2 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteFailedTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteFailedTest.java @@ -18,7 +18,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.eclipse.californium.core.coap.Response; import org.eclipse.leshan.core.ResponseCode; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteMultiValueTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteMultiValueTest.java index 6f9493e78c..58690f3420 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteMultiValueTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteMultiValueTest.java @@ -20,7 +20,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteOpaqueValueTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteOpaqueValueTest.java index a7e2dbd3db..2906d37a6b 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteOpaqueValueTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteOpaqueValueTest.java @@ -18,7 +18,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteSingleValueTest.java b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteSingleValueTest.java index 1d5bb2cb08..098dd3573e 100644 --- a/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteSingleValueTest.java +++ b/leshan-integration-tests/src/test/java/org/eclipse/leshan/integration/tests/write/WriteSingleValueTest.java @@ -19,7 +19,9 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.Arrays; import java.util.Collection; diff --git a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/LeshanServerBuilderTest.java b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/LeshanServerBuilderTest.java index 5362fc9161..9496b70973 100644 --- a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/LeshanServerBuilderTest.java +++ b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/LeshanServerBuilderTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.server.californium; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import java.math.BigInteger; import java.security.AlgorithmParameters; diff --git a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/bootstrap/LeshanBootstrapServerBuilderTest.java b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/bootstrap/LeshanBootstrapServerBuilderTest.java index 27541fec8d..25acc4d609 100644 --- a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/bootstrap/LeshanBootstrapServerBuilderTest.java +++ b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/bootstrap/LeshanBootstrapServerBuilderTest.java @@ -15,7 +15,8 @@ *******************************************************************************/ package org.eclipse.leshan.server.californium.bootstrap; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import java.math.BigInteger; import java.security.AlgorithmParameters; diff --git a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/observation/ObservationServiceTest.java b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/observation/ObservationServiceTest.java index 30a95faffa..0e1a44b7dc 100644 --- a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/observation/ObservationServiceTest.java +++ b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/observation/ObservationServiceTest.java @@ -16,7 +16,8 @@ *******************************************************************************/ package org.eclipse.leshan.server.californium.observation; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.net.InetAddress; import java.net.UnknownHostException; diff --git a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/observation/ObserveUtilTest.java b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/observation/ObserveUtilTest.java index 17d1a275ec..ea08b8881d 100644 --- a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/observation/ObserveUtilTest.java +++ b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/observation/ObserveUtilTest.java @@ -16,7 +16,9 @@ *******************************************************************************/ package org.eclipse.leshan.server.californium.observation; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; import java.util.Arrays; import java.util.HashMap; diff --git a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/registration/InMemoryRegistrationStoreTest.java b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/registration/InMemoryRegistrationStoreTest.java index 3b0a05d250..403b9f8f4e 100644 --- a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/registration/InMemoryRegistrationStoreTest.java +++ b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/registration/InMemoryRegistrationStoreTest.java @@ -17,7 +17,9 @@ *******************************************************************************/ package org.eclipse.leshan.server.californium.registration; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.net.InetAddress; import java.net.UnknownHostException; diff --git a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/request/CoapRequestBuilderTest.java b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/request/CoapRequestBuilderTest.java index 23219037ea..c84b57b653 100644 --- a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/request/CoapRequestBuilderTest.java +++ b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/request/CoapRequestBuilderTest.java @@ -16,7 +16,8 @@ *******************************************************************************/ package org.eclipse.leshan.server.californium.request; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.net.Inet4Address; import java.net.UnknownHostException; diff --git a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/request/LwM2mResponseBuilderTest.java b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/request/LwM2mResponseBuilderTest.java index 0369b8c95c..9db1f6162d 100644 --- a/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/request/LwM2mResponseBuilderTest.java +++ b/leshan-server-cf/src/test/java/org/eclipse/leshan/server/californium/request/LwM2mResponseBuilderTest.java @@ -16,7 +16,8 @@ *******************************************************************************/ package org.eclipse.leshan.server.californium.request; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.Arrays; import java.util.List; diff --git a/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/DefaultBootstrapHandler.java b/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/DefaultBootstrapHandler.java index 7ae5580b79..6c150a1413 100644 --- a/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/DefaultBootstrapHandler.java +++ b/leshan-server-core/src/main/java/org/eclipse/leshan/server/bootstrap/DefaultBootstrapHandler.java @@ -15,7 +15,12 @@ *******************************************************************************/ package org.eclipse.leshan.server.bootstrap; -import static org.eclipse.leshan.server.bootstrap.BootstrapFailureCause.*; +import static org.eclipse.leshan.server.bootstrap.BootstrapFailureCause.CANCELLED; +import static org.eclipse.leshan.server.bootstrap.BootstrapFailureCause.FINISH_FAILED; +import static org.eclipse.leshan.server.bootstrap.BootstrapFailureCause.INTERNAL_SERVER_ERROR; +import static org.eclipse.leshan.server.bootstrap.BootstrapFailureCause.NO_BOOTSTRAP_CONFIG; +import static org.eclipse.leshan.server.bootstrap.BootstrapFailureCause.REQUEST_FAILED; +import static org.eclipse.leshan.server.bootstrap.BootstrapFailureCause.UNAUTHORIZED; import java.util.concurrent.ConcurrentHashMap; diff --git a/leshan-server-core/src/test/java/org/eclipse/leshan/server/bootstrap/BootstrapHandlerTest.java b/leshan-server-core/src/test/java/org/eclipse/leshan/server/bootstrap/BootstrapHandlerTest.java index 712077f83f..6fa50baa9d 100644 --- a/leshan-server-core/src/test/java/org/eclipse/leshan/server/bootstrap/BootstrapHandlerTest.java +++ b/leshan-server-core/src/test/java/org/eclipse/leshan/server/bootstrap/BootstrapHandlerTest.java @@ -15,7 +15,10 @@ *******************************************************************************/ package org.eclipse.leshan.server.bootstrap; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import java.net.InetSocketAddress; import java.util.ArrayList; diff --git a/leshan-server-core/src/test/java/org/eclipse/leshan/server/queue/PresenceServiceTest.java b/leshan-server-core/src/test/java/org/eclipse/leshan/server/queue/PresenceServiceTest.java index 25a122e03c..8b775c3d81 100644 --- a/leshan-server-core/src/test/java/org/eclipse/leshan/server/queue/PresenceServiceTest.java +++ b/leshan-server-core/src/test/java/org/eclipse/leshan/server/queue/PresenceServiceTest.java @@ -15,7 +15,9 @@ *******************************************************************************/ package org.eclipse.leshan.server.queue; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.net.Inet4Address; import java.net.UnknownHostException; diff --git a/leshan-server-core/src/test/java/org/eclipse/leshan/server/registration/RegistrationTest.java b/leshan-server-core/src/test/java/org/eclipse/leshan/server/registration/RegistrationTest.java index e0ec1eeb20..ac424215e1 100644 --- a/leshan-server-core/src/test/java/org/eclipse/leshan/server/registration/RegistrationTest.java +++ b/leshan-server-core/src/test/java/org/eclipse/leshan/server/registration/RegistrationTest.java @@ -16,7 +16,9 @@ *******************************************************************************/ package org.eclipse.leshan.server.registration; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.net.InetSocketAddress; import java.util.Arrays; From 6695a33f3aac1d5a776729148a79f0e926a92acd Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Wed, 13 Jul 2022 11:36:10 +0200 Subject: [PATCH 5/6] Add github actions to check Java Import are sorted. --- .github/actions/sortimport/action.yml | 40 +++++++++++++++++++++++++++ .github/workflows/main.yml | 6 ++++ pom.xml | 1 + 3 files changed, 47 insertions(+) create mode 100644 .github/actions/sortimport/action.yml diff --git a/.github/actions/sortimport/action.yml b/.github/actions/sortimport/action.yml new file mode 100644 index 0000000000..117a8d8e4f --- /dev/null +++ b/.github/actions/sortimport/action.yml @@ -0,0 +1,40 @@ +name: "Check Java Import" +description: "Check Java Import are well sorted with Maven" + +runs: + using: "composite" + steps: + + - name: Check Java Import + id: sort_import + shell: bash + run: mvn -B impsort:check + + - name: Add comment + if: failure() + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: Java Import check Failed + message: | + :x: **Java Import are not sorted !** [(more details)](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) + + Ensure your code build locally using: + ``` + mvn clean install + ``` + Or just validate java import with : + ``` + mvn impsort:sort + ``` + You can sort Java import with : + ``` + mvn impsort: + ``` + See also [How configure your IDE](https://github.com/eclipse/leshan/wiki/Code-&-design-guidelines#configure-your-ide). + + - name: Delete comment + if: success() + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: Code Formatter Validation Failed + delete: true \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8298908f85..210a686d6f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,11 +40,17 @@ jobs: id: build uses: ./.github/actions/build + - name: Java Import Check + if: always() + id: sortimport + uses: ./.github/actions/sortimport + - name: Code Style Check if: always() id: checkstyle uses: ./.github/actions/checkstyle + - name: Check Android API Compliance if: ${{ always() && steps.build.conclusion == 'success' }} uses: ./.github/actions/android-check diff --git a/pom.xml b/pom.xml index 33a190e382..0cbd08b4c5 100644 --- a/pom.xml +++ b/pom.xml @@ -133,6 +133,7 @@ Contributors: true true true + true From be9c335ec03cfb47b323bac9d4dbe5c830f5e1b0 Mon Sep 17 00:00:00 2001 From: Simon Bernard Date: Wed, 13 Jul 2022 15:49:02 +0200 Subject: [PATCH 6/6] Bad import order to check impsort-maven-plugin --- .../leshan/core/credentials/CredentialsReader.java | 2 +- .../leshan/core/json/jackson/JsonArrayEntrySerDes.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/leshan-core/src/main/java/org/eclipse/leshan/core/credentials/CredentialsReader.java b/leshan-core/src/main/java/org/eclipse/leshan/core/credentials/CredentialsReader.java index 1c95e51306..c1720e1cbb 100644 --- a/leshan-core/src/main/java/org/eclipse/leshan/core/credentials/CredentialsReader.java +++ b/leshan-core/src/main/java/org/eclipse/leshan/core/credentials/CredentialsReader.java @@ -19,7 +19,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.RandomAccessFile; +import java.io.*; import java.security.GeneralSecurityException; /** diff --git a/leshan-core/src/main/java/org/eclipse/leshan/core/json/jackson/JsonArrayEntrySerDes.java b/leshan-core/src/main/java/org/eclipse/leshan/core/json/jackson/JsonArrayEntrySerDes.java index e1650c936e..12df354037 100644 --- a/leshan-core/src/main/java/org/eclipse/leshan/core/json/jackson/JsonArrayEntrySerDes.java +++ b/leshan-core/src/main/java/org/eclipse/leshan/core/json/jackson/JsonArrayEntrySerDes.java @@ -18,16 +18,16 @@ import java.math.BigDecimal; import java.math.BigInteger; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.ObjectNode; + import org.eclipse.leshan.core.json.JsonArrayEntry; import org.eclipse.leshan.core.model.ResourceModel.Type; import org.eclipse.leshan.core.util.datatype.ULong; import org.eclipse.leshan.core.util.json.JacksonJsonSerDes; import org.eclipse.leshan.core.util.json.JsonException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.JsonNodeFactory; -import com.fasterxml.jackson.databind.node.ObjectNode; - public class JsonArrayEntrySerDes extends JacksonJsonSerDes { @Override