Browse Source

fix bug: lwm2m tests dif Port Comments 1

pull/10533/head
nick 3 years ago
parent
commit
934287a380
  1. 14
      application/src/test/java/org/thingsboard/server/transport/lwm2m/security/diffPort/AbstractLwM2MIntegrationDiffPortTest.java
  2. 3
      common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/store/TbInMemoryRegistrationStore.java
  3. 3
      common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/store/TbLwM2mRedisRegistrationStore.java

14
application/src/test/java/org/thingsboard/server/transport/lwm2m/security/diffPort/AbstractLwM2MIntegrationDiffPortTest.java

@ -50,14 +50,12 @@ public abstract class AbstractLwM2MIntegrationDiffPortTest extends AbstractSecur
doAnswer((invocation) -> {
Object[] arguments = invocation.getArguments();
log.warn("doAnswer for registrationStoreTest.updateRegistration with args {}", arguments);
// if (arguments.length > 0 && arguments[0] instanceof RegistrationUpdate) {
int portOld = ((RegistrationUpdate) arguments[0]).getPort();
int portValueChange = 5;
arguments[0] = registrationUpdateNewPort((RegistrationUpdate) arguments[0], portValueChange);
int portNew = ((RegistrationUpdate) arguments[0]).getPort();
Assert.assertEquals((portNew - portOld), portValueChange);
// }
log.trace("doAnswer for registrationStoreTest.updateRegistration with args {}", arguments);
int portOld = ((RegistrationUpdate) arguments[0]).getPort();
int portValueChange = 5;
arguments[0] = registrationUpdateNewPort((RegistrationUpdate) arguments[0], portValueChange);
int portNew = ((RegistrationUpdate) arguments[0]).getPort();
Assert.assertEquals((portNew - portOld), portValueChange);
return invocation.callRealMethod();
}).when(registrationStoreTest).updateRegistration(any(RegistrationUpdate.class));

3
common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/store/TbInMemoryRegistrationStore.java

@ -147,8 +147,7 @@ public class TbInMemoryRegistrationStore implements RegistrationStore, Startable
@Override
public UpdatedRegistration updateRegistration(RegistrationUpdate update) {
// test fix bug Diff port
log.trace("updateRegistration inMemory {}", update);
log.trace("updateRegistration [{}]", update);
try {
lock.writeLock().lock();

3
common/transport/lwm2m/src/main/java/org/thingsboard/server/transport/lwm2m/server/store/TbLwM2mRedisRegistrationStore.java

@ -222,8 +222,7 @@ public class TbLwM2mRedisRegistrationStore implements RegistrationStore, Startab
@Override
public UpdatedRegistration updateRegistration(RegistrationUpdate update) {
// test fix bug Diff port
log.trace("updateRegistration Redis {}", update);
log.trace("updateRegistration [{}]", update);
Lock lock = null;
try (var connection = connectionFactory.getConnection()) {

Loading…
Cancel
Save