lwm2m: fix bug test by ver Object, fix buf test: TbLwM2mStoreFactory.class "NetworkConfig must not be null"
This commit is contained in:
parent
ad46f3bb2b
commit
a74640a1d8
@ -687,7 +687,7 @@ public class TbResourceControllerTest extends AbstractControllerTest {
|
||||
List<TbResource> resources = loadLwm2mResources();
|
||||
|
||||
List<LwM2mObject> objects =
|
||||
doGetTyped("/api/resource/lwm2m?sortProperty=id&sortOrder=ASC&objectIds=3_1.0,5_1.0,19_1.1", new TypeReference<>() {});
|
||||
doGetTyped("/api/resource/lwm2m?sortProperty=id&sortOrder=ASC&objectIds=3_1.2,5_1.2,19_1.1", new TypeReference<>() {});
|
||||
Assert.assertNotNull(objects);
|
||||
Assert.assertEquals(3, objects.size());
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.eclipse.californium.core.network.RandomTokenGenerator;
|
||||
import org.eclipse.leshan.server.registration.RegistrationStore;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.thingsboard.server.cache.TBRedisCacheConfiguration;
|
||||
@ -35,6 +36,7 @@ import java.util.Optional;
|
||||
public class TbLwM2mStoreFactory {
|
||||
|
||||
private final Optional<TBRedisCacheConfiguration> redisConfiguration;
|
||||
@Lazy
|
||||
private final LwM2MTransportServerConfig config;
|
||||
private final LwM2mCredentialsSecurityInfoValidator validator;
|
||||
|
||||
@ -43,7 +45,8 @@ public class TbLwM2mStoreFactory {
|
||||
@Bean
|
||||
private RegistrationStore registrationStore() {
|
||||
return redisConfiguration.isPresent() ?
|
||||
new TbLwM2mRedisRegistrationStore(new RandomTokenGenerator(config.getCoapConfig()), getConnectionFactory(), modelProvider) : new TbInMemoryRegistrationStore(new RandomTokenGenerator(config.getCoapConfig()), config.getCleanPeriodInSec(), modelProvider);
|
||||
new TbLwM2mRedisRegistrationStore(new RandomTokenGenerator(config.getCoapConfig()), getConnectionFactory(), modelProvider) :
|
||||
new TbInMemoryRegistrationStore(new RandomTokenGenerator(config.getCoapConfig()), config.getCleanPeriodInSec(), modelProvider);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user