Commit b173e0799c75e0d47d21962ad3a8f09776b3cba8

Authored by Igor Kulikov
1 parent 049627db

Update OS package plugin version. Code cleanup.

Showing 48 changed files with 51 additions and 1422 deletions
@@ -231,10 +231,6 @@ public class ActorSystemContext { @@ -231,10 +231,6 @@ public class ActorSystemContext {
231 231
232 @Autowired 232 @Autowired
233 @Getter 233 @Getter
234 - private JsExecutorService jsExecutor;  
235 -  
236 - @Autowired  
237 - @Getter  
238 private MailExecutorService mailExecutor; 234 private MailExecutorService mailExecutor;
239 235
240 @Autowired 236 @Autowired
@@ -369,11 +369,6 @@ class DefaultTbContext implements TbContext { @@ -369,11 +369,6 @@ class DefaultTbContext implements TbContext {
369 } 369 }
370 370
371 @Override 371 @Override
372 - public ListeningExecutor getJsExecutor() {  
373 - return mainCtx.getJsExecutor();  
374 - }  
375 -  
376 - @Override  
377 public ListeningExecutor getMailExecutor() { 372 public ListeningExecutor getMailExecutor() {
378 return mainCtx.getMailExecutor(); 373 return mainCtx.getMailExecutor();
379 } 374 }
@@ -105,7 +105,7 @@ public class AdminSettingsEdgeEventFetcher implements EdgeEventFetcher { @@ -105,7 +105,7 @@ public class AdminSettingsEdgeEventFetcher implements EdgeEventFetcher {
105 Template template = freemarkerConfig.getTemplate(templatesName); 105 Template template = freemarkerConfig.getTemplate(templatesName);
106 if (template != null) { 106 if (template != null) {
107 String name = validateName(template.getName()); 107 String name = validateName(template.getName());
108 - Map<String, String> mailTemplate = getMailTemplateFromFile(template.getRootTreeNode().toString()); 108 + Map<String, String> mailTemplate = getMailTemplateFromFile(template.toString());
109 if (mailTemplate != null) { 109 if (mailTemplate != null) {
110 mailTemplates.put(name, mailTemplate); 110 mailTemplates.put(name, mailTemplate);
111 } else { 111 } else {
@@ -38,8 +38,6 @@ import org.thingsboard.server.common.data.id.TenantId; @@ -38,8 +38,6 @@ import org.thingsboard.server.common.data.id.TenantId;
38 import org.thingsboard.server.common.data.kv.BaseReadTsKvQuery; 38 import org.thingsboard.server.common.data.kv.BaseReadTsKvQuery;
39 import org.thingsboard.server.common.data.kv.ReadTsKvQuery; 39 import org.thingsboard.server.common.data.kv.ReadTsKvQuery;
40 import org.thingsboard.server.common.data.kv.TsKvEntry; 40 import org.thingsboard.server.common.data.kv.TsKvEntry;
41 -import org.thingsboard.server.common.data.oauth2.OAuth2Info;  
42 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientsParams;  
43 import org.thingsboard.server.common.data.page.PageData; 41 import org.thingsboard.server.common.data.page.PageData;
44 import org.thingsboard.server.common.data.page.PageLink; 42 import org.thingsboard.server.common.data.page.PageLink;
45 import org.thingsboard.server.common.data.page.TimePageLink; 43 import org.thingsboard.server.common.data.page.TimePageLink;
@@ -55,7 +53,6 @@ import org.thingsboard.server.dao.entity.EntityService; @@ -55,7 +53,6 @@ import org.thingsboard.server.dao.entity.EntityService;
55 import org.thingsboard.server.dao.entityview.EntityViewService; 53 import org.thingsboard.server.dao.entityview.EntityViewService;
56 import org.thingsboard.server.dao.model.sql.DeviceProfileEntity; 54 import org.thingsboard.server.dao.model.sql.DeviceProfileEntity;
57 import org.thingsboard.server.dao.oauth2.OAuth2Service; 55 import org.thingsboard.server.dao.oauth2.OAuth2Service;
58 -import org.thingsboard.server.dao.oauth2.OAuth2Utils;  
59 import org.thingsboard.server.dao.rule.RuleChainService; 56 import org.thingsboard.server.dao.rule.RuleChainService;
60 import org.thingsboard.server.dao.sql.device.DeviceProfileRepository; 57 import org.thingsboard.server.dao.sql.device.DeviceProfileRepository;
61 import org.thingsboard.server.dao.tenant.TenantService; 58 import org.thingsboard.server.dao.tenant.TenantService;
@@ -448,18 +445,7 @@ public class DefaultDataUpdateService implements DataUpdateService { @@ -448,18 +445,7 @@ public class DefaultDataUpdateService implements DataUpdateService {
448 } 445 }
449 446
450 private void updateOAuth2Params() { 447 private void updateOAuth2Params() {
451 - try {  
452 - OAuth2ClientsParams oauth2ClientsParams = oAuth2Service.findOAuth2Params();  
453 - if (!oauth2ClientsParams.getDomainsParams().isEmpty()) {  
454 - log.info("Updating OAuth2 parameters ...");  
455 - OAuth2Info oAuth2Info = OAuth2Utils.clientParamsToOAuth2Info(oauth2ClientsParams);  
456 - oAuth2Service.saveOAuth2Info(oAuth2Info);  
457 - oAuth2Service.saveOAuth2Params(new OAuth2ClientsParams(false, Collections.emptyList()));  
458 - log.info("Successfully updated OAuth2 parameters!");  
459 - }  
460 - } catch (Exception e) {  
461 - log.error("Failed to update OAuth2 parameters", e);  
462 - } 448 + log.warn("CAUTION: Update of Oauth2 parameters from 3.2.2 to 3.3.0 available only in ThingsBoard versions 3.3.0/3.3.1");
463 } 449 }
464 450
465 } 451 }
@@ -72,7 +72,7 @@ public class BatchTbRuleEngineSubmitStrategy extends AbstractTbRuleEngineSubmitS @@ -72,7 +72,7 @@ public class BatchTbRuleEngineSubmitStrategy extends AbstractTbRuleEngineSubmitS
72 synchronized (pendingPack) { 72 synchronized (pendingPack) {
73 pendingPack.clear(); 73 pendingPack.clear();
74 for (int i = startIdx; i < endIdx; i++) { 74 for (int i = startIdx; i < endIdx; i++) {
75 - IdMsgPair pair = orderedMsgList.get(i); 75 + IdMsgPair<TransportProtos.ToRuleEngineMsg> pair = orderedMsgList.get(i);
76 pendingPack.put(pair.uuid, pair.msg); 76 pendingPack.put(pair.uuid, pair.msg);
77 } 77 }
78 tmpPack = new LinkedHashMap<>(pendingPack); 78 tmpPack = new LinkedHashMap<>(pendingPack);
@@ -49,7 +49,7 @@ public abstract class SequentialByEntityIdTbRuleEngineSubmitStrategy extends Abs @@ -49,7 +49,7 @@ public abstract class SequentialByEntityIdTbRuleEngineSubmitStrategy extends Abs
49 public void submitAttempt(BiConsumer<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> msgConsumer) { 49 public void submitAttempt(BiConsumer<UUID, TbProtoQueueMsg<TransportProtos.ToRuleEngineMsg>> msgConsumer) {
50 this.msgConsumer = msgConsumer; 50 this.msgConsumer = msgConsumer;
51 entityIdToListMap.forEach((entityId, queue) -> { 51 entityIdToListMap.forEach((entityId, queue) -> {
52 - IdMsgPair msg = queue.peek(); 52 + IdMsgPair<TransportProtos.ToRuleEngineMsg> msg = queue.peek();
53 if (msg != null) { 53 if (msg != null) {
54 msgConsumer.accept(msg.uuid, msg.msg); 54 msgConsumer.accept(msg.uuid, msg.msg);
55 } 55 }
@@ -68,9 +68,9 @@ public abstract class SequentialByEntityIdTbRuleEngineSubmitStrategy extends Abs @@ -68,9 +68,9 @@ public abstract class SequentialByEntityIdTbRuleEngineSubmitStrategy extends Abs
68 if (entityId != null) { 68 if (entityId != null) {
69 Queue<IdMsgPair<TransportProtos.ToRuleEngineMsg>> queue = entityIdToListMap.get(entityId); 69 Queue<IdMsgPair<TransportProtos.ToRuleEngineMsg>> queue = entityIdToListMap.get(entityId);
70 if (queue != null) { 70 if (queue != null) {
71 - IdMsgPair next = null; 71 + IdMsgPair<TransportProtos.ToRuleEngineMsg> next = null;
72 synchronized (queue) { 72 synchronized (queue) {
73 - IdMsgPair expected = queue.peek(); 73 + IdMsgPair<TransportProtos.ToRuleEngineMsg> expected = queue.peek();
74 if (expected != null && expected.uuid.equals(id)) { 74 if (expected != null && expected.uuid.equals(id)) {
75 queue.poll(); 75 queue.poll();
76 next = queue.peek(); 76 next = queue.peek();
@@ -59,7 +59,7 @@ public class SequentialTbRuleEngineSubmitStrategy extends AbstractTbRuleEngineSu @@ -59,7 +59,7 @@ public class SequentialTbRuleEngineSubmitStrategy extends AbstractTbRuleEngineSu
59 int listSize = orderedMsgList.size(); 59 int listSize = orderedMsgList.size();
60 int idx = msgIdx.get(); 60 int idx = msgIdx.get();
61 if (idx < listSize) { 61 if (idx < listSize) {
62 - IdMsgPair pair = orderedMsgList.get(idx); 62 + IdMsgPair<TransportProtos.ToRuleEngineMsg> pair = orderedMsgList.get(idx);
63 expectedMsgId = pair.uuid; 63 expectedMsgId = pair.uuid;
64 if (log.isDebugEnabled()) { 64 if (log.isDebugEnabled()) {
65 log.debug("[{}] submitting [{}] message to rule engine", queueName, pair.msg); 65 log.debug("[{}] submitting [{}] message to rule engine", queueName, pair.msg);
@@ -17,7 +17,6 @@ package org.thingsboard.server.service.security.auth.oauth2; @@ -17,7 +17,6 @@ package org.thingsboard.server.service.security.auth.oauth2;
17 17
18 import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken; 18 import org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken;
19 import org.thingsboard.server.common.data.oauth2.OAuth2Registration; 19 import org.thingsboard.server.common.data.oauth2.OAuth2Registration;
20 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
21 import org.thingsboard.server.service.security.model.SecurityUser; 20 import org.thingsboard.server.service.security.model.SecurityUser;
22 21
23 import javax.servlet.http.HttpServletRequest; 22 import javax.servlet.http.HttpServletRequest;
@@ -117,6 +117,7 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest { @@ -117,6 +117,7 @@ public class BaseTbResourceServiceTest extends AbstractControllerTest {
117 .andExpect(status().isOk()); 117 .andExpect(status().isOk());
118 } 118 }
119 119
  120 + @SuppressWarnings("deprecation")
120 @Rule 121 @Rule
121 public ExpectedException thrown = ExpectedException.none(); 122 public ExpectedException thrown = ExpectedException.none();
122 123
@@ -114,8 +114,8 @@ public abstract class AbstractCoapAttributesIntegrationTest extends AbstractCoap @@ -114,8 +114,8 @@ public abstract class AbstractCoapAttributesIntegrationTest extends AbstractCoap
114 assertEquals(CoAP.ResponseCode.CREATED, coapResponse.getCode()); 114 assertEquals(CoAP.ResponseCode.CREATED, coapResponse.getCode());
115 } 115 }
116 116
117 - @SuppressWarnings("unchecked")  
118 - protected void assertAttributesValues(List<Map<String, Object>> deviceValues, Set<String> keySet) throws JsonProcessingException { 117 + @SuppressWarnings({"unchecked", "rawtypes"})
  118 + protected void assertAttributesValues(List<Map<String, Object>> deviceValues, Set<String> keySet) {
119 for (Map<String, Object> map : deviceValues) { 119 for (Map<String, Object> map : deviceValues) {
120 String key = (String) map.get("key"); 120 String key = (String) map.get("key");
121 Object value = map.get("value"); 121 Object value = map.get("value");
@@ -145,6 +145,7 @@ public abstract class AbstractCoapAttributesIntegrationTest extends AbstractCoap @@ -145,6 +145,7 @@ public abstract class AbstractCoapAttributesIntegrationTest extends AbstractCoap
145 } 145 }
146 } 146 }
147 147
  148 + @SuppressWarnings({"unchecked", "rawtypes"})
148 private void assertAttributesProtoValues(List<Map<String, Object>> values, Set<String> keySet) { 149 private void assertAttributesProtoValues(List<Map<String, Object>> values, Set<String> keySet) {
149 for (Map<String, Object> map : values) { 150 for (Map<String, Object> map : values) {
150 String key = (String) map.get("key"); 151 String key = (String) map.get("key");
@@ -29,6 +29,7 @@ import static java.util.Collections.emptyList; @@ -29,6 +29,7 @@ import static java.util.Collections.emptyList;
29 import static org.assertj.core.api.Assertions.assertThat; 29 import static org.assertj.core.api.Assertions.assertThat;
30 import static org.mockito.ArgumentMatchers.any; 30 import static org.mockito.ArgumentMatchers.any;
31 import static org.mockito.ArgumentMatchers.anyLong; 31 import static org.mockito.ArgumentMatchers.anyLong;
  32 +import static org.mockito.ArgumentMatchers.anyMap;
32 import static org.mockito.ArgumentMatchers.anyString; 33 import static org.mockito.ArgumentMatchers.anyString;
33 import static org.mockito.BDDMockito.willReturn; 34 import static org.mockito.BDDMockito.willReturn;
34 import static org.mockito.Mockito.mock; 35 import static org.mockito.Mockito.mock;
@@ -71,7 +72,7 @@ class LwM2mTransportServerHelperTest { @@ -71,7 +72,7 @@ class LwM2mTransportServerHelperTest {
71 assertThat(helper.getTs(emptyList(), keyTsLatestMap)).isEqualTo(now); 72 assertThat(helper.getTs(emptyList(), keyTsLatestMap)).isEqualTo(now);
72 assertThat(helper.getTs(kvList, null)).isEqualTo(now); 73 assertThat(helper.getTs(kvList, null)).isEqualTo(now);
73 74
74 - verify(helper, never()).getTsByKey(anyString(), any(ConcurrentMap.class), anyLong()); 75 + verify(helper, never()).getTsByKey(anyString(), anyMap(), anyLong());
75 verify(helper, times(5)).getCurrentTimeMillis(); 76 verify(helper, times(5)).getCurrentTimeMillis();
76 } 77 }
77 78
@@ -80,7 +81,7 @@ class LwM2mTransportServerHelperTest { @@ -80,7 +81,7 @@ class LwM2mTransportServerHelperTest {
80 assertThat(helper.getTs(kvList, keyTsLatestMap)).isEqualTo(now); 81 assertThat(helper.getTs(kvList, keyTsLatestMap)).isEqualTo(now);
81 82
82 verify(helper, times(1)).getTsByKey(kvList.get(0).getKey(), keyTsLatestMap, now); 83 verify(helper, times(1)).getTsByKey(kvList.get(0).getKey(), keyTsLatestMap, now);
83 - verify(helper, times(1)).getTsByKey(anyString(), any(ConcurrentMap.class), anyLong()); 84 + verify(helper, times(1)).getTsByKey(anyString(), anyMap(), anyLong());
84 } 85 }
85 86
86 @Test 87 @Test
@@ -126,4 +127,4 @@ class LwM2mTransportServerHelperTest { @@ -126,4 +127,4 @@ class LwM2mTransportServerHelperTest {
126 assertThat(helper.compareAndSwapOrIncrementTsAtomically(keyTsLatestMap.get(KEY_SW_STATE), now)).isEqualTo(nextHourTs + 1); 127 assertThat(helper.compareAndSwapOrIncrementTsAtomically(keyTsLatestMap.get(KEY_SW_STATE), now)).isEqualTo(nextHourTs + 1);
127 } 128 }
128 129
129 -}  
  130 +}
@@ -183,6 +183,7 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt @@ -183,6 +183,7 @@ public abstract class AbstractMqttAttributesIntegrationTest extends AbstractMqtt
183 } 183 }
184 } 184 }
185 185
  186 + @SuppressWarnings({"unchecked", "rawtypes"})
186 private void assertAttributesProtoValues(List<Map<String, Object>> values, Set<String> keySet) { 187 private void assertAttributesProtoValues(List<Map<String, Object>> values, Set<String> keySet) {
187 for (Map<String, Object> map : values) { 188 for (Map<String, Object> map : values) {
188 String key = (String) map.get("key"); 189 String key = (String) map.get("key");
@@ -19,8 +19,6 @@ import org.thingsboard.server.common.data.oauth2.OAuth2ClientInfo; @@ -19,8 +19,6 @@ import org.thingsboard.server.common.data.oauth2.OAuth2ClientInfo;
19 import org.thingsboard.server.common.data.oauth2.OAuth2Info; 19 import org.thingsboard.server.common.data.oauth2.OAuth2Info;
20 import org.thingsboard.server.common.data.oauth2.OAuth2Registration; 20 import org.thingsboard.server.common.data.oauth2.OAuth2Registration;
21 import org.thingsboard.server.common.data.oauth2.PlatformType; 21 import org.thingsboard.server.common.data.oauth2.PlatformType;
22 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
23 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientsParams;  
24 22
25 import java.util.List; 23 import java.util.List;
26 import java.util.UUID; 24 import java.util.UUID;
@@ -28,12 +26,6 @@ import java.util.UUID; @@ -28,12 +26,6 @@ import java.util.UUID;
28 public interface OAuth2Service { 26 public interface OAuth2Service {
29 List<OAuth2ClientInfo> getOAuth2Clients(String domainScheme, String domainName, String pkgName, PlatformType platformType); 27 List<OAuth2ClientInfo> getOAuth2Clients(String domainScheme, String domainName, String pkgName, PlatformType platformType);
30 28
31 - @Deprecated  
32 - void saveOAuth2Params(OAuth2ClientsParams oauth2Params);  
33 -  
34 - @Deprecated  
35 - OAuth2ClientsParams findOAuth2Params();  
36 -  
37 void saveOAuth2Info(OAuth2Info oauth2Info); 29 void saveOAuth2Info(OAuth2Info oauth2Info);
38 30
39 OAuth2Info findOAuth2Info(); 31 OAuth2Info findOAuth2Info();
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.id.deprecated;  
17 -  
18 -import com.fasterxml.jackson.annotation.JsonCreator;  
19 -import com.fasterxml.jackson.annotation.JsonProperty;  
20 -import org.thingsboard.server.common.data.id.UUIDBased;  
21 -  
22 -import java.util.UUID;  
23 -  
24 -@Deprecated  
25 -public class OAuth2ClientRegistrationId extends UUIDBased {  
26 -  
27 - @JsonCreator  
28 - public OAuth2ClientRegistrationId(@JsonProperty("id") UUID id) {  
29 - super(id);  
30 - }  
31 -  
32 - public static OAuth2ClientRegistrationId fromString(String clientRegistrationId) {  
33 - return new OAuth2ClientRegistrationId(UUID.fromString(clientRegistrationId));  
34 - }  
35 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.id.deprecated;  
17 -  
18 -import com.fasterxml.jackson.annotation.JsonCreator;  
19 -import com.fasterxml.jackson.annotation.JsonProperty;  
20 -import org.thingsboard.server.common.data.id.UUIDBased;  
21 -  
22 -import java.util.UUID;  
23 -  
24 -@Deprecated  
25 -public class OAuth2ClientRegistrationInfoId extends UUIDBased {  
26 -  
27 - @JsonCreator  
28 - public OAuth2ClientRegistrationInfoId(@JsonProperty("id") UUID id) {  
29 - super(id);  
30 - }  
31 -  
32 - public static OAuth2ClientRegistrationInfoId fromString(String clientRegistrationInfoId) {  
33 - return new OAuth2ClientRegistrationInfoId(UUID.fromString(clientRegistrationInfoId));  
34 - }  
35 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.oauth2.deprecated;  
17 -  
18 -import com.fasterxml.jackson.databind.JsonNode;  
19 -import lombok.*;  
20 -import org.thingsboard.server.common.data.oauth2.OAuth2MapperConfig;  
21 -  
22 -import java.util.List;  
23 -  
24 -@Deprecated  
25 -@EqualsAndHashCode  
26 -@Data  
27 -@ToString(exclude = {"clientSecret"})  
28 -@NoArgsConstructor  
29 -@AllArgsConstructor  
30 -@Builder  
31 -public class ClientRegistrationDto {  
32 - private OAuth2MapperConfig mapperConfig;  
33 - private String clientId;  
34 - private String clientSecret;  
35 - private String authorizationUri;  
36 - private String accessTokenUri;  
37 - private List<String> scope;  
38 - private String userInfoUri;  
39 - private String userNameAttributeName;  
40 - private String jwkSetUri;  
41 - private String clientAuthenticationMethod;  
42 - private String loginButtonLabel;  
43 - private String loginButtonIcon;  
44 - private JsonNode additionalInfo;  
45 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.oauth2.deprecated;  
17 -  
18 -import lombok.*;  
19 -import org.thingsboard.server.common.data.oauth2.SchemeType;  
20 -  
21 -@Deprecated  
22 -@EqualsAndHashCode  
23 -@Data  
24 -@ToString  
25 -@NoArgsConstructor  
26 -@AllArgsConstructor  
27 -@Builder  
28 -public class DomainInfo {  
29 - private SchemeType scheme;  
30 - private String name;  
31 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.oauth2.deprecated;  
17 -  
18 -import lombok.Data;  
19 -import lombok.EqualsAndHashCode;  
20 -import org.thingsboard.server.common.data.oauth2.SchemeType;  
21 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
22 -  
23 -@Deprecated  
24 -@EqualsAndHashCode(callSuper = true)  
25 -@Data  
26 -public class ExtendedOAuth2ClientRegistrationInfo extends OAuth2ClientRegistrationInfo {  
27 -  
28 - private String domainName;  
29 - private SchemeType domainScheme;  
30 -  
31 - public ExtendedOAuth2ClientRegistrationInfo() {  
32 - super();  
33 - }  
34 -  
35 - public ExtendedOAuth2ClientRegistrationInfo(OAuth2ClientRegistrationInfo oAuth2ClientRegistrationInfo,  
36 - SchemeType domainScheme,  
37 - String domainName) {  
38 - super(oAuth2ClientRegistrationInfo);  
39 - this.domainScheme = domainScheme;  
40 - this.domainName = domainName;  
41 - }  
42 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.oauth2.deprecated;  
17 -  
18 -import lombok.Data;  
19 -import lombok.EqualsAndHashCode;  
20 -import lombok.NoArgsConstructor;  
21 -import lombok.ToString;  
22 -import org.thingsboard.server.common.data.BaseData;  
23 -import org.thingsboard.server.common.data.id.deprecated.OAuth2ClientRegistrationId;  
24 -import org.thingsboard.server.common.data.id.deprecated.OAuth2ClientRegistrationInfoId;  
25 -import org.thingsboard.server.common.data.oauth2.SchemeType;  
26 -  
27 -@Deprecated  
28 -@EqualsAndHashCode(callSuper = true)  
29 -@Data  
30 -@ToString  
31 -@NoArgsConstructor  
32 -public class OAuth2ClientRegistration extends BaseData<OAuth2ClientRegistrationId> {  
33 -  
34 - private OAuth2ClientRegistrationInfoId clientRegistrationId;  
35 - private String domainName;  
36 - private SchemeType domainScheme;  
37 -  
38 - public OAuth2ClientRegistration(OAuth2ClientRegistration clientRegistration) {  
39 - super(clientRegistration);  
40 - this.clientRegistrationId = clientRegistration.clientRegistrationId;  
41 - this.domainName = clientRegistration.domainName;  
42 - this.domainScheme = clientRegistration.domainScheme;  
43 - }  
44 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.oauth2.deprecated;  
17 -  
18 -import com.fasterxml.jackson.annotation.JsonProperty;  
19 -import lombok.Data;  
20 -import lombok.EqualsAndHashCode;  
21 -import lombok.NoArgsConstructor;  
22 -import lombok.ToString;  
23 -import org.thingsboard.server.common.data.HasName;  
24 -import org.thingsboard.server.common.data.SearchTextBasedWithAdditionalInfo;  
25 -import org.thingsboard.server.common.data.id.deprecated.OAuth2ClientRegistrationInfoId;  
26 -import org.thingsboard.server.common.data.oauth2.OAuth2MapperConfig;  
27 -  
28 -import java.util.List;  
29 -  
30 -@Deprecated  
31 -@EqualsAndHashCode(callSuper = true)  
32 -@Data  
33 -@ToString(exclude = {"clientSecret"})  
34 -@NoArgsConstructor  
35 -public class OAuth2ClientRegistrationInfo extends SearchTextBasedWithAdditionalInfo<OAuth2ClientRegistrationInfoId> implements HasName {  
36 -  
37 - private boolean enabled;  
38 - private OAuth2MapperConfig mapperConfig;  
39 - private String clientId;  
40 - private String clientSecret;  
41 - private String authorizationUri;  
42 - private String accessTokenUri;  
43 - private List<String> scope;  
44 - private String userInfoUri;  
45 - private String userNameAttributeName;  
46 - private String jwkSetUri;  
47 - private String clientAuthenticationMethod;  
48 - private String loginButtonLabel;  
49 - private String loginButtonIcon;  
50 -  
51 - public OAuth2ClientRegistrationInfo(OAuth2ClientRegistrationInfo clientRegistration) {  
52 - super(clientRegistration);  
53 - this.enabled = clientRegistration.enabled;  
54 - this.mapperConfig = clientRegistration.mapperConfig;  
55 - this.clientId = clientRegistration.clientId;  
56 - this.clientSecret = clientRegistration.clientSecret;  
57 - this.authorizationUri = clientRegistration.authorizationUri;  
58 - this.accessTokenUri = clientRegistration.accessTokenUri;  
59 - this.scope = clientRegistration.scope;  
60 - this.userInfoUri = clientRegistration.userInfoUri;  
61 - this.userNameAttributeName = clientRegistration.userNameAttributeName;  
62 - this.jwkSetUri = clientRegistration.jwkSetUri;  
63 - this.clientAuthenticationMethod = clientRegistration.clientAuthenticationMethod;  
64 - this.loginButtonLabel = clientRegistration.loginButtonLabel;  
65 - this.loginButtonIcon = clientRegistration.loginButtonIcon;  
66 - }  
67 -  
68 - @Override  
69 - @JsonProperty(access = JsonProperty.Access.READ_ONLY)  
70 - public String getName() {  
71 - return loginButtonLabel;  
72 - }  
73 -  
74 - @Override  
75 - public String getSearchText() {  
76 - return getName();  
77 - }  
78 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.oauth2.deprecated;  
17 -  
18 -import lombok.*;  
19 -  
20 -import java.util.List;  
21 -  
22 -@Deprecated  
23 -@EqualsAndHashCode  
24 -@Data  
25 -@ToString  
26 -@Builder(toBuilder = true)  
27 -@NoArgsConstructor  
28 -@AllArgsConstructor  
29 -public class OAuth2ClientsDomainParams {  
30 - private List<DomainInfo> domainInfos;  
31 - private List<ClientRegistrationDto> clientRegistrations;  
32 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.common.data.oauth2.deprecated;  
17 -  
18 -import lombok.*;  
19 -  
20 -import java.util.List;  
21 -  
22 -@Deprecated  
23 -@EqualsAndHashCode  
24 -@Data  
25 -@ToString  
26 -@Builder(toBuilder = true)  
27 -@NoArgsConstructor  
28 -@AllArgsConstructor  
29 -public class OAuth2ClientsParams {  
30 - private boolean enabled;  
31 - private List<OAuth2ClientsDomainParams> domainsParams;  
32 -}  
@@ -75,12 +75,12 @@ public class DefaultTbQueueRequestTemplateTest { @@ -75,12 +75,12 @@ public class DefaultTbQueueRequestTemplateTest {
75 long maxPendingRequests = 32; 75 long maxPendingRequests = 32;
76 long pollInterval = 5; 76 long pollInterval = 5;
77 77
78 - DefaultTbQueueRequestTemplate inst; 78 + DefaultTbQueueRequestTemplate<TbQueueMsg, TbQueueMsg> inst;
79 79
80 @Before 80 @Before
81 public void setUp() throws Exception { 81 public void setUp() throws Exception {
82 willReturn(topic).given(responseTemplate).getTopic(); 82 willReturn(topic).given(responseTemplate).getTopic();
83 - inst = spy(new DefaultTbQueueRequestTemplate( 83 + inst = spy(new DefaultTbQueueRequestTemplate<>(
84 queueAdmin, requestTemplate, responseTemplate, 84 queueAdmin, requestTemplate, responseTemplate,
85 maxRequestTimeout, maxPendingRequests, pollInterval, executorMock)); 85 maxRequestTimeout, maxPendingRequests, pollInterval, executorMock));
86 86
@@ -170,6 +170,7 @@ public class DefaultTbQueueRequestTemplateTest { @@ -170,6 +170,7 @@ public class DefaultTbQueueRequestTemplateTest {
170 verify(inst, times((int) inst.maxPendingRequests)).sendToRequestTemplate(any(), any(), any(), any()); 170 verify(inst, times((int) inst.maxPendingRequests)).sendToRequestTemplate(any(), any(), any(), any());
171 } 171 }
172 172
  173 + @SuppressWarnings("unchecked")
173 @Test 174 @Test
174 public void givenNothing_whenSendAndFetchAndProcessResponsesWithTimeout_thenFail() { 175 public void givenNothing_whenSendAndFetchAndProcessResponsesWithTimeout_thenFail() {
175 //given 176 //given
@@ -208,4 +209,4 @@ public class DefaultTbQueueRequestTemplateTest { @@ -208,4 +209,4 @@ public class DefaultTbQueueRequestTemplateTest {
208 TbQueueMsg getRequestMsgMock() { 209 TbQueueMsg getRequestMsgMock() {
209 return mock(TbQueueMsg.class, RETURNS_DEEP_STUBS); 210 return mock(TbQueueMsg.class, RETURNS_DEEP_STUBS);
210 } 211 }
211 -}  
  212 +}
@@ -81,6 +81,7 @@ public class TbLwM2MDtlsCertificateVerifier implements NewAdvancedCertificateVer @@ -81,6 +81,7 @@ public class TbLwM2MDtlsCertificateVerifier implements NewAdvancedCertificateVer
81 return Arrays.asList(CertificateType.X_509, CertificateType.RAW_PUBLIC_KEY); 81 return Arrays.asList(CertificateType.X_509, CertificateType.RAW_PUBLIC_KEY);
82 } 82 }
83 83
  84 + @SuppressWarnings("deprecation")
84 @PostConstruct 85 @PostConstruct
85 public void init() { 86 public void init() {
86 try { 87 try {
@@ -38,7 +38,7 @@ import java.io.ByteArrayInputStream; @@ -38,7 +38,7 @@ import java.io.ByteArrayInputStream;
38 import java.io.IOException; 38 import java.io.IOException;
39 import java.util.ArrayList; 39 import java.util.ArrayList;
40 import java.util.List; 40 import java.util.List;
41 -import java.util.concurrent.ConcurrentMap; 41 +import java.util.Map;
42 import java.util.concurrent.atomic.AtomicLong; 42 import java.util.concurrent.atomic.AtomicLong;
43 43
44 import static org.thingsboard.server.gen.transport.TransportProtos.KeyValueType.BOOLEAN_V; 44 import static org.thingsboard.server.gen.transport.TransportProtos.KeyValueType.BOOLEAN_V;
@@ -62,7 +62,7 @@ public class LwM2mTransportServerHelper { @@ -62,7 +62,7 @@ public class LwM2mTransportServerHelper {
62 sendParametersOnThingsboardTelemetry(kvList, sessionInfo, null); 62 sendParametersOnThingsboardTelemetry(kvList, sessionInfo, null);
63 } 63 }
64 64
65 - public void sendParametersOnThingsboardTelemetry(List<TransportProtos.KeyValueProto> kvList, SessionInfoProto sessionInfo, @Nullable ConcurrentMap<String, AtomicLong> keyTsLatestMap) { 65 + public void sendParametersOnThingsboardTelemetry(List<TransportProtos.KeyValueProto> kvList, SessionInfoProto sessionInfo, @Nullable Map<String, AtomicLong> keyTsLatestMap) {
66 TransportProtos.TsKvListProto tsKvList = toTsKvList(kvList, keyTsLatestMap); 66 TransportProtos.TsKvListProto tsKvList = toTsKvList(kvList, keyTsLatestMap);
67 67
68 PostTelemetryMsg postTelemetryMsg = PostTelemetryMsg.newBuilder() 68 PostTelemetryMsg postTelemetryMsg = PostTelemetryMsg.newBuilder()
@@ -72,14 +72,14 @@ public class LwM2mTransportServerHelper { @@ -72,14 +72,14 @@ public class LwM2mTransportServerHelper {
72 context.getTransportService().process(sessionInfo, postTelemetryMsg, TransportServiceCallback.EMPTY); 72 context.getTransportService().process(sessionInfo, postTelemetryMsg, TransportServiceCallback.EMPTY);
73 } 73 }
74 74
75 - TransportProtos.TsKvListProto toTsKvList(List<TransportProtos.KeyValueProto> kvList, ConcurrentMap<String, AtomicLong> keyTsLatestMap) { 75 + TransportProtos.TsKvListProto toTsKvList(List<TransportProtos.KeyValueProto> kvList, Map<String, AtomicLong> keyTsLatestMap) {
76 return TransportProtos.TsKvListProto.newBuilder() 76 return TransportProtos.TsKvListProto.newBuilder()
77 .setTs(getTs(kvList, keyTsLatestMap)) 77 .setTs(getTs(kvList, keyTsLatestMap))
78 .addAllKv(kvList) 78 .addAllKv(kvList)
79 .build(); 79 .build();
80 } 80 }
81 81
82 - long getTs(List<TransportProtos.KeyValueProto> kvList, ConcurrentMap<String, AtomicLong> keyTsLatestMap) { 82 + long getTs(List<TransportProtos.KeyValueProto> kvList, Map<String, AtomicLong> keyTsLatestMap) {
83 if (keyTsLatestMap == null || kvList == null || kvList.isEmpty()) { 83 if (keyTsLatestMap == null || kvList == null || kvList.isEmpty()) {
84 return getCurrentTimeMillis(); 84 return getCurrentTimeMillis();
85 } 85 }
@@ -87,7 +87,7 @@ public class LwM2mTransportServerHelper { @@ -87,7 +87,7 @@ public class LwM2mTransportServerHelper {
87 return getTsByKey(kvList.get(0).getKey(), keyTsLatestMap, getCurrentTimeMillis()); 87 return getTsByKey(kvList.get(0).getKey(), keyTsLatestMap, getCurrentTimeMillis());
88 } 88 }
89 89
90 - long getTsByKey(@Nonnull String key, @Nonnull ConcurrentMap<String, AtomicLong> keyTsLatestMap, final long tsNow) { 90 + long getTsByKey(@Nonnull String key, @Nonnull Map<String, AtomicLong> keyTsLatestMap, final long tsNow) {
91 AtomicLong tsLatestAtomic = keyTsLatestMap.putIfAbsent(key, new AtomicLong(tsNow)); 91 AtomicLong tsLatestAtomic = keyTsLatestMap.putIfAbsent(key, new AtomicLong(tsNow));
92 if (tsLatestAtomic == null) { 92 if (tsLatestAtomic == null) {
93 return tsNow; // it is a first known timestamp for this key. return as the latest 93 return tsNow; // it is a first known timestamp for this key. return as the latest
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 */ 15 */
16 package org.thingsboard.server.transport.lwm2m.server; 16 package org.thingsboard.server.transport.lwm2m.server;
17 17
  18 +import com.fasterxml.jackson.core.type.TypeReference;
18 import com.fasterxml.jackson.databind.ObjectMapper; 19 import com.fasterxml.jackson.databind.ObjectMapper;
19 import lombok.extern.slf4j.Slf4j; 20 import lombok.extern.slf4j.Slf4j;
20 import org.apache.commons.lang3.StringUtils; 21 import org.apache.commons.lang3.StringUtils;
@@ -31,6 +32,7 @@ import org.eclipse.leshan.core.request.SimpleDownlinkRequest; @@ -31,6 +32,7 @@ import org.eclipse.leshan.core.request.SimpleDownlinkRequest;
31 import org.eclipse.leshan.core.request.WriteAttributesRequest; 32 import org.eclipse.leshan.core.request.WriteAttributesRequest;
32 import org.eclipse.leshan.core.util.Hex; 33 import org.eclipse.leshan.core.util.Hex;
33 import org.eclipse.leshan.server.registration.Registration; 34 import org.eclipse.leshan.server.registration.Registration;
  35 +import org.thingsboard.common.util.JacksonUtil;
34 import org.thingsboard.server.common.data.DeviceProfile; 36 import org.thingsboard.server.common.data.DeviceProfile;
35 import org.thingsboard.server.common.data.DeviceTransportType; 37 import org.thingsboard.server.common.data.DeviceTransportType;
36 import org.thingsboard.server.common.data.device.data.lwm2m.BootstrapConfiguration; 38 import org.thingsboard.server.common.data.device.data.lwm2m.BootstrapConfiguration;
@@ -286,8 +288,7 @@ public class LwM2mTransportUtil { @@ -286,8 +288,7 @@ public class LwM2mTransportUtil {
286 288
287 private static Attribute[] createWriteAttributes(Object params, DefaultLwM2MUplinkMsgHandler serviceImpl, String target) { 289 private static Attribute[] createWriteAttributes(Object params, DefaultLwM2MUplinkMsgHandler serviceImpl, String target) {
288 List<Attribute> attributeLists = new ArrayList<>(); 290 List<Attribute> attributeLists = new ArrayList<>();
289 - ObjectMapper oMapper = new ObjectMapper();  
290 - Map<String, Object> map = oMapper.convertValue(params, ConcurrentHashMap.class); 291 + Map<String, Object> map = JacksonUtil.convertValue(params, new TypeReference<>() {});
291 map.forEach((k, v) -> { 292 map.forEach((k, v) -> {
292 if (StringUtils.trimToNull(v.toString()) != null) { 293 if (StringUtils.trimToNull(v.toString()) != null) {
293 Object attrValue = convertWriteAttributes(k, v, serviceImpl, target); 294 Object attrValue = convertWriteAttributes(k, v, serviceImpl, target);
@@ -374,6 +375,7 @@ public class LwM2mTransportUtil { @@ -374,6 +375,7 @@ public class LwM2mTransportUtil {
374 return lwm2mResourceValue; 375 return lwm2mResourceValue;
375 } 376 }
376 377
  378 + @SuppressWarnings("unchecked")
377 public static Optional<String> contentToString(Object content) { 379 public static Optional<String> contentToString(Object content) {
378 try { 380 try {
379 String value = null; 381 String value = null;
@@ -25,11 +25,11 @@ public interface HasVersionedIds { @@ -25,11 +25,11 @@ public interface HasVersionedIds {
25 String[] getVersionedIds(); 25 String[] getVersionedIds();
26 26
27 default String[] getObjectIds() { 27 default String[] getObjectIds() {
28 - Set objectIds = ConcurrentHashMap.newKeySet(); 28 + Set<String> objectIds = ConcurrentHashMap.newKeySet();
29 for (String versionedId : getVersionedIds()) { 29 for (String versionedId : getVersionedIds()) {
30 objectIds.add(LwM2mTransportUtil.fromVersionedIdToObjectId(versionedId)); 30 objectIds.add(LwM2mTransportUtil.fromVersionedIdToObjectId(versionedId));
31 } 31 }
32 - return (String[]) objectIds.toArray(String[]::new); 32 + return objectIds.toArray(String[]::new);
33 } 33 }
34 34
35 } 35 }
@@ -18,6 +18,8 @@ package org.thingsboard.server.transport.lwm2m.server.rpc; @@ -18,6 +18,8 @@ package org.thingsboard.server.transport.lwm2m.server.rpc;
18 import lombok.RequiredArgsConstructor; 18 import lombok.RequiredArgsConstructor;
19 import lombok.extern.slf4j.Slf4j; 19 import lombok.extern.slf4j.Slf4j;
20 import org.eclipse.leshan.core.ResponseCode; 20 import org.eclipse.leshan.core.ResponseCode;
  21 +import org.eclipse.leshan.core.request.ReadCompositeRequest;
  22 +import org.eclipse.leshan.core.response.ReadCompositeResponse;
21 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
22 import org.thingsboard.common.util.JacksonUtil; 24 import org.thingsboard.common.util.JacksonUtil;
23 import org.thingsboard.server.common.data.StringUtils; 25 import org.thingsboard.server.common.data.StringUtils;
@@ -176,7 +178,7 @@ public class DefaultLwM2MRpcRequestHandler implements LwM2MRpcRequestHandler { @@ -176,7 +178,7 @@ public class DefaultLwM2MRpcRequestHandler implements LwM2MRpcRequestHandler {
176 String[] versionedIds = getIdsFromParameters(client, requestMsg); 178 String[] versionedIds = getIdsFromParameters(client, requestMsg);
177 TbLwM2MReadCompositeRequest request = TbLwM2MReadCompositeRequest.builder().versionedIds(versionedIds).timeout(clientContext.getRequestTimeout(client)).build(); 179 TbLwM2MReadCompositeRequest request = TbLwM2MReadCompositeRequest.builder().versionedIds(versionedIds).timeout(clientContext.getRequestTimeout(client)).build();
178 var mainCallback = new TbLwM2MReadCompositeCallback(uplinkHandler, logService, client, versionedIds); 180 var mainCallback = new TbLwM2MReadCompositeCallback(uplinkHandler, logService, client, versionedIds);
179 - var rpcCallback = new RpcReadResponseCompositeCallback(transportService, client, requestMsg, mainCallback); 181 + var rpcCallback = new RpcReadResponseCompositeCallback<>(transportService, client, requestMsg, mainCallback);
180 downlinkHandler.sendReadCompositeRequest(client, request, rpcCallback); 182 downlinkHandler.sendReadCompositeRequest(client, request, rpcCallback);
181 } 183 }
182 184
@@ -292,14 +294,14 @@ public class DefaultLwM2MRpcRequestHandler implements LwM2MRpcRequestHandler { @@ -292,14 +294,14 @@ public class DefaultLwM2MRpcRequestHandler implements LwM2MRpcRequestHandler {
292 private String[] getIdsFromParameters(LwM2mClient client, TransportProtos.ToDeviceRpcRequestMsg rpcRequst) { 294 private String[] getIdsFromParameters(LwM2mClient client, TransportProtos.ToDeviceRpcRequestMsg rpcRequst) {
293 RpcReadCompositeRequest requestParams = JacksonUtil.fromString(rpcRequst.getParams(), RpcReadCompositeRequest.class); 295 RpcReadCompositeRequest requestParams = JacksonUtil.fromString(rpcRequst.getParams(), RpcReadCompositeRequest.class);
294 if (requestParams.getKeys() != null && requestParams.getKeys().length > 0) { 296 if (requestParams.getKeys() != null && requestParams.getKeys().length > 0) {
295 - Set targetIds = ConcurrentHashMap.newKeySet(); 297 + Set<String> targetIds = ConcurrentHashMap.newKeySet();
296 for (String key : requestParams.getKeys()) { 298 for (String key : requestParams.getKeys()) {
297 String targetId = clientContext.getObjectIdByKeyNameFromProfile(client, key); 299 String targetId = clientContext.getObjectIdByKeyNameFromProfile(client, key);
298 if (targetId != null) { 300 if (targetId != null) {
299 targetIds.add(targetId); 301 targetIds.add(targetId);
300 } 302 }
301 } 303 }
302 - return (String[]) targetIds.toArray(String[]::new); 304 + return targetIds.toArray(String[]::new);
303 } else if (requestParams.getIds() != null && requestParams.getIds().length > 0) { 305 } else if (requestParams.getIds() != null && requestParams.getIds().length > 0) {
304 return requestParams.getIds(); 306 return requestParams.getIds();
305 } else { 307 } else {
@@ -57,6 +57,7 @@ import java.util.Scanner; @@ -57,6 +57,7 @@ import java.util.Scanner;
57 import java.util.function.Consumer; 57 import java.util.function.Consumer;
58 import java.util.stream.Collectors; 58 import java.util.stream.Collectors;
59 59
  60 +@SuppressWarnings("deprecation")
60 public class SnmpDeviceSimulatorV2 extends BaseAgent { 61 public class SnmpDeviceSimulatorV2 extends BaseAgent {
61 62
62 public static class RequestProcessor extends CommandProcessor { 63 public static class RequestProcessor extends CommandProcessor {
@@ -167,6 +168,7 @@ public class SnmpDeviceSimulatorV2 extends BaseAgent { @@ -167,6 +168,7 @@ public class SnmpDeviceSimulatorV2 extends BaseAgent {
167 protected void addUsmUser(USM usm) { 168 protected void addUsmUser(USM usm) {
168 } 169 }
169 170
  171 + @SuppressWarnings({"unchecked"})
170 protected void initTransportMappings() { 172 protected void initTransportMappings() {
171 transportMappings = new TransportMapping[]{TransportMappings.getInstance().createTransportMapping(address)}; 173 transportMappings = new TransportMapping[]{TransportMappings.getInstance().createTransportMapping(address)};
172 } 174 }
@@ -86,6 +86,7 @@ import java.util.Map; @@ -86,6 +86,7 @@ import java.util.Map;
86 * And don't remove snmp users 86 * And don't remove snmp users
87 * 87 *
88 */ 88 */
  89 +@SuppressWarnings("deprecation")
89 public class SnmpDeviceSimulatorV3 extends BaseAgent { 90 public class SnmpDeviceSimulatorV3 extends BaseAgent {
90 protected String address; 91 protected String address;
91 private Snmp4jHeartbeatMib heartbeatMIB; 92 private Snmp4jHeartbeatMib heartbeatMIB;
@@ -458,6 +459,7 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent { @@ -458,6 +459,7 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent {
458 this.usm = usm; 459 this.usm = usm;
459 } 460 }
460 461
  462 + @SuppressWarnings({"unchecked", "rawtypes"})
461 private static DefaultMOTable createStaticIfXTable() { 463 private static DefaultMOTable createStaticIfXTable() {
462 MOTableSubIndex[] subIndexes = 464 MOTableSubIndex[] subIndexes =
463 new MOTableSubIndex[] { new MOTableSubIndex(SMIConstants.SYNTAX_INTEGER) }; 465 new MOTableSubIndex[] { new MOTableSubIndex(SMIConstants.SYNTAX_INTEGER) };
@@ -573,6 +575,7 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent { @@ -573,6 +575,7 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent {
573 return ifXTable; 575 return ifXTable;
574 } 576 }
575 577
  578 + @SuppressWarnings({"unchecked", "rawtypes"})
576 private static DefaultMOTable createStaticIfTable() { 579 private static DefaultMOTable createStaticIfTable() {
577 MOTableSubIndex[] subIndexes = 580 MOTableSubIndex[] subIndexes =
578 new MOTableSubIndex[] { new MOTableSubIndex(SMIConstants.SYNTAX_INTEGER) }; 581 new MOTableSubIndex[] { new MOTableSubIndex(SMIConstants.SYNTAX_INTEGER) };
@@ -632,54 +635,7 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent { @@ -632,54 +635,7 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent {
632 ifTable.setVolatile(true); 635 ifTable.setVolatile(true);
633 return ifTable; 636 return ifTable;
634 } 637 }
635 -  
636 - private static DefaultMOTable createStaticSnmp4sTable() {  
637 - MOTableSubIndex[] subIndexes =  
638 - new MOTableSubIndex[] { new MOTableSubIndex(SMIConstants.SYNTAX_INTEGER) };  
639 - MOTableIndex indexDef = new MOTableIndex(subIndexes, false);  
640 - MOColumn[] columns = new MOColumn[8];  
641 - int c = 0;  
642 - columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_NULL, MOAccessImpl.ACCESS_READ_ONLY); // testNull  
643 - columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_INTEGER, MOAccessImpl.ACCESS_READ_ONLY); // testBoolean  
644 - columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_INTEGER, MOAccessImpl.ACCESS_READ_ONLY); // ifType  
645 - columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_INTEGER, MOAccessImpl.ACCESS_READ_ONLY); // ifMtu  
646 - columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_GAUGE32, MOAccessImpl.ACCESS_READ_ONLY); // ifSpeed  
647 - columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_OCTET_STRING, MOAccessImpl.ACCESS_READ_ONLY); //ifPhysAddress  
648 - columns[c++] = new MOMutableColumn(c, SMIConstants.SYNTAX_INTEGER, MOAccessImpl.ACCESS_READ_WRITE,  
649 - null);  
650 - // ifAdminStatus  
651 - columns[c++] = new MOColumn(c, SMIConstants.SYNTAX_INTEGER, MOAccessImpl.ACCESS_READ_ONLY);  
652 - // ifOperStatus  
653 -  
654 - DefaultMOTable ifTable =  
655 - new DefaultMOTable(new OID("1.3.6.1.4.1.50000.1.1"), indexDef, columns);  
656 - MOMutableTableModel model = (MOMutableTableModel) ifTable.getModel();  
657 - Variable[] rowValues1 = new Variable[] {  
658 - new Integer32(1),  
659 - new OctetString("eth0"),  
660 - new Integer32(6),  
661 - new Integer32(1500),  
662 - new Gauge32(100000000),  
663 - new OctetString("00:00:00:00:01"),  
664 - new Integer32(1),  
665 - new Integer32(1)  
666 - };  
667 - Variable[] rowValues2 = new Variable[] {  
668 - new Integer32(2),  
669 - new OctetString("loopback"),  
670 - new Integer32(24),  
671 - new Integer32(1500),  
672 - new Gauge32(10000000),  
673 - new OctetString("00:00:00:00:02"),  
674 - new Integer32(1),  
675 - new Integer32(1)  
676 - };  
677 - model.addRow(new DefaultMOMutableRow2PC(new OID("1"), rowValues1));  
678 - model.addRow(new DefaultMOMutableRow2PC(new OID("2"), rowValues2));  
679 - ifTable.setVolatile(true);  
680 - return ifTable;  
681 - }  
682 - 638 + @SuppressWarnings({"unchecked", "rawtypes"})
683 protected void initTransportMappings() throws IOException { 639 protected void initTransportMappings() throws IOException {
684 transportMappings = new TransportMapping[2]; 640 transportMappings = new TransportMapping[2];
685 Address addr = GenericAddress.parse(address); 641 Address addr = GenericAddress.parse(address);
@@ -715,10 +671,10 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent { @@ -715,10 +671,10 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent {
715 new Integer32(StorageType.nonVolatile), // storage type 671 new Integer32(StorageType.nonVolatile), // storage type
716 new Integer32(RowStatus.active) // row status 672 new Integer32(RowStatus.active) // row status
717 }; 673 };
718 - MOTableRow row = 674 + SnmpCommunityMIB.SnmpCommunityEntryRow row =
719 communityMIB.getSnmpCommunityEntry().createRow( 675 communityMIB.getSnmpCommunityEntry().createRow(
720 new OctetString("public2public").toSubIndex(true), com2sec); 676 new OctetString("public2public").toSubIndex(true), com2sec);
721 - communityMIB.getSnmpCommunityEntry().addRow((SnmpCommunityMIB.SnmpCommunityEntryRow) row); 677 + communityMIB.getSnmpCommunityEntry().addRow(row);
722 // snmpCommunityMIB.setSourceAddressFiltering(true); 678 // snmpCommunityMIB.setSourceAddressFiltering(true);
723 } 679 }
724 680
@@ -742,4 +698,4 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent { @@ -742,4 +698,4 @@ public class SnmpDeviceSimulatorV3 extends BaseAgent {
742 this.initSnmpSession(); 698 this.initSnmpSession();
743 } 699 }
744 700
745 -}  
  701 +}
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.model.sql.deprecated;  
17 -  
18 -import com.fasterxml.jackson.databind.JsonNode;  
19 -import lombok.Data;  
20 -import lombok.EqualsAndHashCode;  
21 -import org.hibernate.annotations.Type;  
22 -import org.hibernate.annotations.TypeDef;  
23 -import org.thingsboard.server.common.data.id.deprecated.OAuth2ClientRegistrationInfoId;  
24 -import org.thingsboard.server.common.data.oauth2.*;  
25 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
26 -import org.thingsboard.server.dao.model.BaseSqlEntity;  
27 -import org.thingsboard.server.dao.model.ModelConstants;  
28 -import org.thingsboard.server.dao.model.sql.deprecated.OAuth2ClientRegistrationInfoEntity;  
29 -import org.thingsboard.server.dao.util.mapping.JsonStringType;  
30 -  
31 -import javax.persistence.*;  
32 -import java.util.Arrays;  
33 -  
34 -@Deprecated  
35 -@Data  
36 -@EqualsAndHashCode(callSuper = true)  
37 -@TypeDef(name = "json", typeClass = JsonStringType.class)  
38 -@MappedSuperclass  
39 -public abstract class AbstractOAuth2ClientRegistrationInfoEntity<T extends OAuth2ClientRegistrationInfo> extends BaseSqlEntity<T> {  
40 -  
41 - @Column(name = ModelConstants.OAUTH2_ENABLED_PROPERTY)  
42 - private Boolean enabled;  
43 - @Column(name = ModelConstants.OAUTH2_CLIENT_ID_PROPERTY)  
44 - private String clientId;  
45 - @Column(name = ModelConstants.OAUTH2_CLIENT_SECRET_PROPERTY)  
46 - private String clientSecret;  
47 - @Column(name = ModelConstants.OAUTH2_AUTHORIZATION_URI_PROPERTY)  
48 - private String authorizationUri;  
49 - @Column(name = ModelConstants.OAUTH2_TOKEN_URI_PROPERTY)  
50 - private String tokenUri;  
51 - @Column(name = ModelConstants.OAUTH2_SCOPE_PROPERTY)  
52 - private String scope;  
53 - @Column(name = ModelConstants.OAUTH2_USER_INFO_URI_PROPERTY)  
54 - private String userInfoUri;  
55 - @Column(name = ModelConstants.OAUTH2_USER_NAME_ATTRIBUTE_NAME_PROPERTY)  
56 - private String userNameAttributeName;  
57 - @Column(name = ModelConstants.OAUTH2_JWK_SET_URI_PROPERTY)  
58 - private String jwkSetUri;  
59 - @Column(name = ModelConstants.OAUTH2_CLIENT_AUTHENTICATION_METHOD_PROPERTY)  
60 - private String clientAuthenticationMethod;  
61 - @Column(name = ModelConstants.OAUTH2_LOGIN_BUTTON_LABEL_PROPERTY)  
62 - private String loginButtonLabel;  
63 - @Column(name = ModelConstants.OAUTH2_LOGIN_BUTTON_ICON_PROPERTY)  
64 - private String loginButtonIcon;  
65 - @Column(name = ModelConstants.OAUTH2_ALLOW_USER_CREATION_PROPERTY)  
66 - private Boolean allowUserCreation;  
67 - @Column(name = ModelConstants.OAUTH2_ACTIVATE_USER_PROPERTY)  
68 - private Boolean activateUser;  
69 - @Enumerated(EnumType.STRING)  
70 - @Column(name = ModelConstants.OAUTH2_MAPPER_TYPE_PROPERTY)  
71 - private MapperType type;  
72 - @Column(name = ModelConstants.OAUTH2_EMAIL_ATTRIBUTE_KEY_PROPERTY)  
73 - private String emailAttributeKey;  
74 - @Column(name = ModelConstants.OAUTH2_FIRST_NAME_ATTRIBUTE_KEY_PROPERTY)  
75 - private String firstNameAttributeKey;  
76 - @Column(name = ModelConstants.OAUTH2_LAST_NAME_ATTRIBUTE_KEY_PROPERTY)  
77 - private String lastNameAttributeKey;  
78 - @Enumerated(EnumType.STRING)  
79 - @Column(name = ModelConstants.OAUTH2_TENANT_NAME_STRATEGY_PROPERTY)  
80 - private TenantNameStrategyType tenantNameStrategy;  
81 - @Column(name = ModelConstants.OAUTH2_TENANT_NAME_PATTERN_PROPERTY)  
82 - private String tenantNamePattern;  
83 - @Column(name = ModelConstants.OAUTH2_CUSTOMER_NAME_PATTERN_PROPERTY)  
84 - private String customerNamePattern;  
85 - @Column(name = ModelConstants.OAUTH2_DEFAULT_DASHBOARD_NAME_PROPERTY)  
86 - private String defaultDashboardName;  
87 - @Column(name = ModelConstants.OAUTH2_ALWAYS_FULL_SCREEN_PROPERTY)  
88 - private Boolean alwaysFullScreen;  
89 - @Column(name = ModelConstants.OAUTH2_MAPPER_URL_PROPERTY)  
90 - private String url;  
91 - @Column(name = ModelConstants.OAUTH2_MAPPER_USERNAME_PROPERTY)  
92 - private String username;  
93 - @Column(name = ModelConstants.OAUTH2_MAPPER_PASSWORD_PROPERTY)  
94 - private String password;  
95 - @Column(name = ModelConstants.OAUTH2_MAPPER_SEND_TOKEN_PROPERTY)  
96 - private Boolean sendToken;  
97 -  
98 - @Type(type = "json")  
99 - @Column(name = ModelConstants.OAUTH2_ADDITIONAL_INFO_PROPERTY)  
100 - private JsonNode additionalInfo;  
101 -  
102 - public AbstractOAuth2ClientRegistrationInfoEntity() {  
103 - super();  
104 - }  
105 -  
106 - public AbstractOAuth2ClientRegistrationInfoEntity(OAuth2ClientRegistrationInfo clientRegistrationInfo) {  
107 - if (clientRegistrationInfo.getId() != null) {  
108 - this.setUuid(clientRegistrationInfo.getId().getId());  
109 - }  
110 - this.createdTime = clientRegistrationInfo.getCreatedTime();  
111 - this.enabled = clientRegistrationInfo.isEnabled();  
112 - this.clientId = clientRegistrationInfo.getClientId();  
113 - this.clientSecret = clientRegistrationInfo.getClientSecret();  
114 - this.authorizationUri = clientRegistrationInfo.getAuthorizationUri();  
115 - this.tokenUri = clientRegistrationInfo.getAccessTokenUri();  
116 - this.scope = clientRegistrationInfo.getScope().stream().reduce((result, element) -> result + "," + element).orElse("");  
117 - this.userInfoUri = clientRegistrationInfo.getUserInfoUri();  
118 - this.userNameAttributeName = clientRegistrationInfo.getUserNameAttributeName();  
119 - this.jwkSetUri = clientRegistrationInfo.getJwkSetUri();  
120 - this.clientAuthenticationMethod = clientRegistrationInfo.getClientAuthenticationMethod();  
121 - this.loginButtonLabel = clientRegistrationInfo.getLoginButtonLabel();  
122 - this.loginButtonIcon = clientRegistrationInfo.getLoginButtonIcon();  
123 - this.additionalInfo = clientRegistrationInfo.getAdditionalInfo();  
124 - OAuth2MapperConfig mapperConfig = clientRegistrationInfo.getMapperConfig();  
125 - if (mapperConfig != null) {  
126 - this.allowUserCreation = mapperConfig.isAllowUserCreation();  
127 - this.activateUser = mapperConfig.isActivateUser();  
128 - this.type = mapperConfig.getType();  
129 - OAuth2BasicMapperConfig basicConfig = mapperConfig.getBasic();  
130 - if (basicConfig != null) {  
131 - this.emailAttributeKey = basicConfig.getEmailAttributeKey();  
132 - this.firstNameAttributeKey = basicConfig.getFirstNameAttributeKey();  
133 - this.lastNameAttributeKey = basicConfig.getLastNameAttributeKey();  
134 - this.tenantNameStrategy = basicConfig.getTenantNameStrategy();  
135 - this.tenantNamePattern = basicConfig.getTenantNamePattern();  
136 - this.customerNamePattern = basicConfig.getCustomerNamePattern();  
137 - this.defaultDashboardName = basicConfig.getDefaultDashboardName();  
138 - this.alwaysFullScreen = basicConfig.isAlwaysFullScreen();  
139 - }  
140 - OAuth2CustomMapperConfig customConfig = mapperConfig.getCustom();  
141 - if (customConfig != null) {  
142 - this.url = customConfig.getUrl();  
143 - this.username = customConfig.getUsername();  
144 - this.password = customConfig.getPassword();  
145 - this.sendToken = customConfig.isSendToken();  
146 - }  
147 - }  
148 - }  
149 -  
150 - public AbstractOAuth2ClientRegistrationInfoEntity(OAuth2ClientRegistrationInfoEntity oAuth2ClientRegistrationInfoEntity) {  
151 - this.setId(oAuth2ClientRegistrationInfoEntity.getId());  
152 - this.setCreatedTime(oAuth2ClientRegistrationInfoEntity.getCreatedTime());  
153 - this.enabled = oAuth2ClientRegistrationInfoEntity.getEnabled();  
154 - this.clientId = oAuth2ClientRegistrationInfoEntity.getClientId();  
155 - this.clientSecret = oAuth2ClientRegistrationInfoEntity.getClientSecret();  
156 - this.authorizationUri = oAuth2ClientRegistrationInfoEntity.getAuthorizationUri();  
157 - this.tokenUri = oAuth2ClientRegistrationInfoEntity.getTokenUri();  
158 - this.scope = oAuth2ClientRegistrationInfoEntity.getScope();  
159 - this.userInfoUri = oAuth2ClientRegistrationInfoEntity.getUserInfoUri();  
160 - this.userNameAttributeName = oAuth2ClientRegistrationInfoEntity.getUserNameAttributeName();  
161 - this.jwkSetUri = oAuth2ClientRegistrationInfoEntity.getJwkSetUri();  
162 - this.clientAuthenticationMethod = oAuth2ClientRegistrationInfoEntity.getClientAuthenticationMethod();  
163 - this.loginButtonLabel = oAuth2ClientRegistrationInfoEntity.getLoginButtonLabel();  
164 - this.loginButtonIcon = oAuth2ClientRegistrationInfoEntity.getLoginButtonIcon();  
165 - this.additionalInfo = oAuth2ClientRegistrationInfoEntity.getAdditionalInfo();  
166 - this.allowUserCreation = oAuth2ClientRegistrationInfoEntity.getAllowUserCreation();  
167 - this.activateUser = oAuth2ClientRegistrationInfoEntity.getActivateUser();  
168 - this.type = oAuth2ClientRegistrationInfoEntity.getType();  
169 - this.emailAttributeKey = oAuth2ClientRegistrationInfoEntity.getEmailAttributeKey();  
170 - this.firstNameAttributeKey = oAuth2ClientRegistrationInfoEntity.getFirstNameAttributeKey();  
171 - this.lastNameAttributeKey = oAuth2ClientRegistrationInfoEntity.getLastNameAttributeKey();  
172 - this.tenantNameStrategy = oAuth2ClientRegistrationInfoEntity.getTenantNameStrategy();  
173 - this.tenantNamePattern = oAuth2ClientRegistrationInfoEntity.getTenantNamePattern();  
174 - this.customerNamePattern = oAuth2ClientRegistrationInfoEntity.getCustomerNamePattern();  
175 - this.defaultDashboardName = oAuth2ClientRegistrationInfoEntity.getDefaultDashboardName();  
176 - this.alwaysFullScreen = oAuth2ClientRegistrationInfoEntity.getAlwaysFullScreen();  
177 - this.url = oAuth2ClientRegistrationInfoEntity.getUrl();  
178 - this.username = oAuth2ClientRegistrationInfoEntity.getUsername();  
179 - this.password = oAuth2ClientRegistrationInfoEntity.getPassword();  
180 - this.sendToken = oAuth2ClientRegistrationInfoEntity.getSendToken();  
181 - }  
182 -  
183 -  
184 - protected OAuth2ClientRegistrationInfo toOAuth2ClientRegistrationInfo() {  
185 - OAuth2ClientRegistrationInfo clientRegistrationInfo = new OAuth2ClientRegistrationInfo();  
186 - clientRegistrationInfo.setId(new OAuth2ClientRegistrationInfoId(id));  
187 - clientRegistrationInfo.setEnabled(enabled);  
188 - clientRegistrationInfo.setCreatedTime(createdTime);  
189 - clientRegistrationInfo.setAdditionalInfo(additionalInfo);  
190 - clientRegistrationInfo.setMapperConfig(  
191 - OAuth2MapperConfig.builder()  
192 - .allowUserCreation(allowUserCreation)  
193 - .activateUser(activateUser)  
194 - .type(type)  
195 - .basic(  
196 - (type == MapperType.BASIC || type == MapperType.GITHUB) ?  
197 - OAuth2BasicMapperConfig.builder()  
198 - .emailAttributeKey(emailAttributeKey)  
199 - .firstNameAttributeKey(firstNameAttributeKey)  
200 - .lastNameAttributeKey(lastNameAttributeKey)  
201 - .tenantNameStrategy(tenantNameStrategy)  
202 - .tenantNamePattern(tenantNamePattern)  
203 - .customerNamePattern(customerNamePattern)  
204 - .defaultDashboardName(defaultDashboardName)  
205 - .alwaysFullScreen(alwaysFullScreen)  
206 - .build()  
207 - : null  
208 - )  
209 - .custom(  
210 - type == MapperType.CUSTOM ?  
211 - OAuth2CustomMapperConfig.builder()  
212 - .url(url)  
213 - .username(username)  
214 - .password(password)  
215 - .sendToken(sendToken)  
216 - .build()  
217 - : null  
218 - )  
219 - .build()  
220 - );  
221 - clientRegistrationInfo.setClientId(clientId);  
222 - clientRegistrationInfo.setClientSecret(clientSecret);  
223 - clientRegistrationInfo.setAuthorizationUri(authorizationUri);  
224 - clientRegistrationInfo.setAccessTokenUri(tokenUri);  
225 - clientRegistrationInfo.setScope(Arrays.asList(scope.split(",")));  
226 - clientRegistrationInfo.setUserInfoUri(userInfoUri);  
227 - clientRegistrationInfo.setUserNameAttributeName(userNameAttributeName);  
228 - clientRegistrationInfo.setJwkSetUri(jwkSetUri);  
229 - clientRegistrationInfo.setClientAuthenticationMethod(clientAuthenticationMethod);  
230 - clientRegistrationInfo.setLoginButtonLabel(loginButtonLabel);  
231 - clientRegistrationInfo.setLoginButtonIcon(loginButtonIcon);  
232 - return clientRegistrationInfo;  
233 - }  
234 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.model.sql.deprecated;  
17 -  
18 -import lombok.Data;  
19 -import lombok.EqualsAndHashCode;  
20 -import org.thingsboard.server.common.data.oauth2.deprecated.ExtendedOAuth2ClientRegistrationInfo;  
21 -import org.thingsboard.server.common.data.oauth2.SchemeType;  
22 -  
23 -@Deprecated  
24 -@Data  
25 -@EqualsAndHashCode(callSuper = true)  
26 -public class ExtendedOAuth2ClientRegistrationInfoEntity extends AbstractOAuth2ClientRegistrationInfoEntity<ExtendedOAuth2ClientRegistrationInfo> {  
27 -  
28 - private String domainName;  
29 - private SchemeType domainScheme;  
30 -  
31 - public ExtendedOAuth2ClientRegistrationInfoEntity() {  
32 - super();  
33 - }  
34 -  
35 - public ExtendedOAuth2ClientRegistrationInfoEntity(OAuth2ClientRegistrationInfoEntity oAuth2ClientRegistrationInfoEntity,  
36 - String domainName,  
37 - SchemeType domainScheme) {  
38 - super(oAuth2ClientRegistrationInfoEntity);  
39 - this.domainName = domainName;  
40 - this.domainScheme = domainScheme;  
41 - }  
42 -  
43 - @Override  
44 - public ExtendedOAuth2ClientRegistrationInfo toData() {  
45 - return new ExtendedOAuth2ClientRegistrationInfo(super.toOAuth2ClientRegistrationInfo(),  
46 - domainScheme,  
47 - domainName);  
48 - }  
49 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.model.sql.deprecated;  
17 -  
18 -import lombok.Data;  
19 -import lombok.EqualsAndHashCode;  
20 -import org.hibernate.annotations.TypeDef;  
21 -import org.thingsboard.server.common.data.id.deprecated.OAuth2ClientRegistrationId;  
22 -import org.thingsboard.server.common.data.id.deprecated.OAuth2ClientRegistrationInfoId;  
23 -import org.thingsboard.server.common.data.oauth2.*;  
24 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistration;  
25 -import org.thingsboard.server.dao.model.BaseSqlEntity;  
26 -import org.thingsboard.server.dao.model.ModelConstants;  
27 -import org.thingsboard.server.dao.util.mapping.JsonStringType;  
28 -  
29 -import javax.persistence.*;  
30 -import java.util.UUID;  
31 -  
32 -@Deprecated  
33 -@Data  
34 -@EqualsAndHashCode(callSuper = true)  
35 -@Entity  
36 -@TypeDef(name = "json", typeClass = JsonStringType.class)  
37 -@Table(name = ModelConstants.OAUTH2_CLIENT_REGISTRATION_COLUMN_FAMILY_NAME)  
38 -public class OAuth2ClientRegistrationEntity extends BaseSqlEntity<OAuth2ClientRegistration> {  
39 -  
40 - @Column(name = ModelConstants.OAUTH2_CLIENT_REGISTRATION_INFO_ID_PROPERTY, columnDefinition = "uuid")  
41 - private UUID clientRegistrationInfoId;  
42 -  
43 - @Column(name = ModelConstants.OAUTH2_DOMAIN_NAME_PROPERTY)  
44 - private String domainName;  
45 -  
46 - @Enumerated(EnumType.STRING)  
47 - @Column(name = ModelConstants.OAUTH2_DOMAIN_SCHEME_PROPERTY)  
48 - private SchemeType domainScheme;  
49 -  
50 - public OAuth2ClientRegistrationEntity() {  
51 - super();  
52 - }  
53 -  
54 - public OAuth2ClientRegistrationEntity(OAuth2ClientRegistration clientRegistration) {  
55 - if (clientRegistration.getId() != null) {  
56 - this.setUuid(clientRegistration.getId().getId());  
57 - }  
58 - if (clientRegistration.getClientRegistrationId() != null){  
59 - this.clientRegistrationInfoId = clientRegistration.getClientRegistrationId().getId();  
60 - }  
61 - this.createdTime = clientRegistration.getCreatedTime();  
62 - this.domainName = clientRegistration.getDomainName();  
63 - this.domainScheme = clientRegistration.getDomainScheme();  
64 - }  
65 -  
66 - @Override  
67 - public OAuth2ClientRegistration toData() {  
68 - OAuth2ClientRegistration clientRegistration = new OAuth2ClientRegistration();  
69 - clientRegistration.setId(new OAuth2ClientRegistrationId(id));  
70 - clientRegistration.setClientRegistrationId(new OAuth2ClientRegistrationInfoId(clientRegistrationInfoId));  
71 - clientRegistration.setCreatedTime(createdTime);  
72 - clientRegistration.setDomainName(domainName);  
73 - clientRegistration.setDomainScheme(domainScheme);  
74 - return clientRegistration;  
75 - }  
76 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.model.sql.deprecated;  
17 -  
18 -import lombok.Data;  
19 -import lombok.EqualsAndHashCode;  
20 -import org.hibernate.annotations.TypeDef;  
21 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
22 -import org.thingsboard.server.dao.model.ModelConstants;  
23 -import org.thingsboard.server.dao.util.mapping.JsonStringType;  
24 -  
25 -import javax.persistence.Entity;  
26 -import javax.persistence.Table;  
27 -  
28 -@Deprecated  
29 -@Data  
30 -@EqualsAndHashCode(callSuper = true)  
31 -@Entity  
32 -@TypeDef(name = "json", typeClass = JsonStringType.class)  
33 -@Table(name = ModelConstants.OAUTH2_CLIENT_REGISTRATION_INFO_COLUMN_FAMILY_NAME)  
34 -public class OAuth2ClientRegistrationInfoEntity extends AbstractOAuth2ClientRegistrationInfoEntity<OAuth2ClientRegistrationInfo> {  
35 -  
36 - public OAuth2ClientRegistrationInfoEntity() {  
37 - super();  
38 - }  
39 -  
40 - public OAuth2ClientRegistrationInfoEntity(OAuth2ClientRegistrationInfo clientRegistration) {  
41 - super(clientRegistration);  
42 - }  
43 -  
44 - public OAuth2ClientRegistrationInfoEntity(OAuth2ClientRegistrationInfoEntity oAuth2ClientRegistrationInfoEntity) {  
45 - super(oAuth2ClientRegistrationInfoEntity);  
46 - }  
47 -  
48 - @Override  
49 - public OAuth2ClientRegistrationInfo toData() {  
50 - return super.toOAuth2ClientRegistrationInfo();  
51 - }  
52 -}  
@@ -38,18 +38,9 @@ import org.thingsboard.server.common.data.oauth2.OAuth2RegistrationInfo; @@ -38,18 +38,9 @@ import org.thingsboard.server.common.data.oauth2.OAuth2RegistrationInfo;
38 import org.thingsboard.server.common.data.oauth2.PlatformType; 38 import org.thingsboard.server.common.data.oauth2.PlatformType;
39 import org.thingsboard.server.common.data.oauth2.SchemeType; 39 import org.thingsboard.server.common.data.oauth2.SchemeType;
40 import org.thingsboard.server.common.data.oauth2.TenantNameStrategyType; 40 import org.thingsboard.server.common.data.oauth2.TenantNameStrategyType;
41 -import org.thingsboard.server.common.data.oauth2.deprecated.ClientRegistrationDto;  
42 -import org.thingsboard.server.common.data.oauth2.deprecated.DomainInfo;  
43 -import org.thingsboard.server.common.data.oauth2.deprecated.ExtendedOAuth2ClientRegistrationInfo;  
44 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistration;  
45 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
46 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientsDomainParams;  
47 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientsParams;  
48 import org.thingsboard.server.dao.entity.AbstractEntityService; 41 import org.thingsboard.server.dao.entity.AbstractEntityService;
49 import org.thingsboard.server.dao.exception.DataValidationException; 42 import org.thingsboard.server.dao.exception.DataValidationException;
50 import org.thingsboard.server.dao.exception.IncorrectParameterException; 43 import org.thingsboard.server.dao.exception.IncorrectParameterException;
51 -import org.thingsboard.server.dao.oauth2.deprecated.OAuth2ClientRegistrationDao;  
52 -import org.thingsboard.server.dao.oauth2.deprecated.OAuth2ClientRegistrationInfoDao;  
53 44
54 import javax.transaction.Transactional; 45 import javax.transaction.Transactional;
55 import java.util.ArrayList; 46 import java.util.ArrayList;
@@ -72,10 +63,6 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se @@ -72,10 +63,6 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se
72 public static final String INCORRECT_DOMAIN_SCHEME = "Incorrect domainScheme "; 63 public static final String INCORRECT_DOMAIN_SCHEME = "Incorrect domainScheme ";
73 64
74 @Autowired 65 @Autowired
75 - private OAuth2ClientRegistrationInfoDao clientRegistrationInfoDao;  
76 - @Autowired  
77 - private OAuth2ClientRegistrationDao clientRegistrationDao;  
78 - @Autowired  
79 private OAuth2ParamsDao oauth2ParamsDao; 66 private OAuth2ParamsDao oauth2ParamsDao;
80 @Autowired 67 @Autowired
81 private OAuth2RegistrationDao oauth2RegistrationDao; 68 private OAuth2RegistrationDao oauth2RegistrationDao;
@@ -104,27 +91,6 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se @@ -104,27 +91,6 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se
104 .collect(Collectors.toList()); 91 .collect(Collectors.toList());
105 } 92 }
106 93
107 - @Deprecated  
108 - @Override  
109 - @Transactional  
110 - public void saveOAuth2Params(OAuth2ClientsParams oauth2Params) {  
111 - log.trace("Executing saveOAuth2Params [{}]", oauth2Params);  
112 - clientParamsValidator.accept(oauth2Params);  
113 - clientRegistrationDao.deleteAll();  
114 - clientRegistrationInfoDao.deleteAll();  
115 - oauth2Params.getDomainsParams().forEach(domainParams -> {  
116 - domainParams.getClientRegistrations().forEach(clientRegistrationDto -> {  
117 - OAuth2ClientRegistrationInfo oAuth2ClientRegistrationInfo = OAuth2Utils.toClientRegistrationInfo(oauth2Params.isEnabled(), clientRegistrationDto);  
118 - OAuth2ClientRegistrationInfo savedClientRegistrationInfo = clientRegistrationInfoDao.save(TenantId.SYS_TENANT_ID, oAuth2ClientRegistrationInfo);  
119 - domainParams.getDomainInfos().forEach(domainInfo -> {  
120 - OAuth2ClientRegistration oAuth2ClientRegistration = OAuth2Utils.toClientRegistration(savedClientRegistrationInfo.getId(),  
121 - domainInfo.getScheme(), domainInfo.getName());  
122 - clientRegistrationDao.save(TenantId.SYS_TENANT_ID, oAuth2ClientRegistration);  
123 - });  
124 - });  
125 - });  
126 - }  
127 -  
128 @Override 94 @Override
129 @Transactional 95 @Transactional
130 public void saveOAuth2Info(OAuth2Info oauth2Info) { 96 public void saveOAuth2Info(OAuth2Info oauth2Info) {
@@ -151,14 +117,6 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se @@ -151,14 +117,6 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se
151 }); 117 });
152 } 118 }
153 119
154 - @Deprecated  
155 - @Override  
156 - public OAuth2ClientsParams findOAuth2Params() {  
157 - log.trace("Executing findOAuth2Params");  
158 - List<ExtendedOAuth2ClientRegistrationInfo> extendedInfos = clientRegistrationInfoDao.findAllExtended();  
159 - return OAuth2Utils.toOAuth2Params(extendedInfos);  
160 - }  
161 -  
162 @Override 120 @Override
163 public OAuth2Info findOAuth2Info() { 121 public OAuth2Info findOAuth2Info() {
164 log.trace("Executing findOAuth2Info"); 122 log.trace("Executing findOAuth2Info");
@@ -198,114 +156,6 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se @@ -198,114 +156,6 @@ public class OAuth2ServiceImpl extends AbstractEntityService implements OAuth2Se
198 return oauth2RegistrationDao.find(TenantId.SYS_TENANT_ID); 156 return oauth2RegistrationDao.find(TenantId.SYS_TENANT_ID);
199 } 157 }
200 158
201 - private final Consumer<OAuth2ClientsParams> clientParamsValidator = oauth2Params -> {  
202 - if (oauth2Params == null  
203 - || oauth2Params.getDomainsParams() == null) {  
204 - throw new DataValidationException("Domain params should be specified!");  
205 - }  
206 - for (OAuth2ClientsDomainParams domainParams : oauth2Params.getDomainsParams()) {  
207 - if (domainParams.getDomainInfos() == null  
208 - || domainParams.getDomainInfos().isEmpty()) {  
209 - throw new DataValidationException("List of domain configuration should be specified!");  
210 - }  
211 - for (DomainInfo domainInfo : domainParams.getDomainInfos()) {  
212 - if (StringUtils.isEmpty(domainInfo.getName())) {  
213 - throw new DataValidationException("Domain name should be specified!");  
214 - }  
215 - if (domainInfo.getScheme() == null) {  
216 - throw new DataValidationException("Domain scheme should be specified!");  
217 - }  
218 - }  
219 - domainParams.getDomainInfos().stream()  
220 - .collect(Collectors.groupingBy(DomainInfo::getName))  
221 - .forEach((domainName, domainInfos) -> {  
222 - if (domainInfos.size() > 1 && domainInfos.stream().anyMatch(domainInfo -> domainInfo.getScheme() == SchemeType.MIXED)) {  
223 - throw new DataValidationException("MIXED scheme type shouldn't be combined with another scheme type!");  
224 - }  
225 - });  
226 - if (domainParams.getClientRegistrations() == null || domainParams.getClientRegistrations().isEmpty()) {  
227 - throw new DataValidationException("Client registrations should be specified!");  
228 - }  
229 - for (ClientRegistrationDto clientRegistration : domainParams.getClientRegistrations()) {  
230 - if (StringUtils.isEmpty(clientRegistration.getClientId())) {  
231 - throw new DataValidationException("Client ID should be specified!");  
232 - }  
233 - if (StringUtils.isEmpty(clientRegistration.getClientSecret())) {  
234 - throw new DataValidationException("Client secret should be specified!");  
235 - }  
236 - if (StringUtils.isEmpty(clientRegistration.getAuthorizationUri())) {  
237 - throw new DataValidationException("Authorization uri should be specified!");  
238 - }  
239 - if (StringUtils.isEmpty(clientRegistration.getAccessTokenUri())) {  
240 - throw new DataValidationException("Token uri should be specified!");  
241 - }  
242 - if (StringUtils.isEmpty(clientRegistration.getScope())) {  
243 - throw new DataValidationException("Scope should be specified!");  
244 - }  
245 - if (StringUtils.isEmpty(clientRegistration.getUserInfoUri())) {  
246 - throw new DataValidationException("User info uri should be specified!");  
247 - }  
248 - if (StringUtils.isEmpty(clientRegistration.getUserNameAttributeName())) {  
249 - throw new DataValidationException("User name attribute name should be specified!");  
250 - }  
251 - if (StringUtils.isEmpty(clientRegistration.getClientAuthenticationMethod())) {  
252 - throw new DataValidationException("Client authentication method should be specified!");  
253 - }  
254 - if (StringUtils.isEmpty(clientRegistration.getLoginButtonLabel())) {  
255 - throw new DataValidationException("Login button label should be specified!");  
256 - }  
257 - OAuth2MapperConfig mapperConfig = clientRegistration.getMapperConfig();  
258 - if (mapperConfig == null) {  
259 - throw new DataValidationException("Mapper config should be specified!");  
260 - }  
261 - if (mapperConfig.getType() == null) {  
262 - throw new DataValidationException("Mapper config type should be specified!");  
263 - }  
264 - if (mapperConfig.getType() == MapperType.BASIC) {  
265 - OAuth2BasicMapperConfig basicConfig = mapperConfig.getBasic();  
266 - if (basicConfig == null) {  
267 - throw new DataValidationException("Basic config should be specified!");  
268 - }  
269 - if (StringUtils.isEmpty(basicConfig.getEmailAttributeKey())) {  
270 - throw new DataValidationException("Email attribute key should be specified!");  
271 - }  
272 - if (basicConfig.getTenantNameStrategy() == null) {  
273 - throw new DataValidationException("Tenant name strategy should be specified!");  
274 - }  
275 - if (basicConfig.getTenantNameStrategy() == TenantNameStrategyType.CUSTOM  
276 - && StringUtils.isEmpty(basicConfig.getTenantNamePattern())) {  
277 - throw new DataValidationException("Tenant name pattern should be specified!");  
278 - }  
279 - }  
280 - if (mapperConfig.getType() == MapperType.GITHUB) {  
281 - OAuth2BasicMapperConfig basicConfig = mapperConfig.getBasic();  
282 - if (basicConfig == null) {  
283 - throw new DataValidationException("Basic config should be specified!");  
284 - }  
285 - if (!StringUtils.isEmpty(basicConfig.getEmailAttributeKey())) {  
286 - throw new DataValidationException("Email attribute key cannot be configured for GITHUB mapper type!");  
287 - }  
288 - if (basicConfig.getTenantNameStrategy() == null) {  
289 - throw new DataValidationException("Tenant name strategy should be specified!");  
290 - }  
291 - if (basicConfig.getTenantNameStrategy() == TenantNameStrategyType.CUSTOM  
292 - && StringUtils.isEmpty(basicConfig.getTenantNamePattern())) {  
293 - throw new DataValidationException("Tenant name pattern should be specified!");  
294 - }  
295 - }  
296 - if (mapperConfig.getType() == MapperType.CUSTOM) {  
297 - OAuth2CustomMapperConfig customConfig = mapperConfig.getCustom();  
298 - if (customConfig == null) {  
299 - throw new DataValidationException("Custom config should be specified!");  
300 - }  
301 - if (StringUtils.isEmpty(customConfig.getUrl())) {  
302 - throw new DataValidationException("Custom mapper URL should be specified!");  
303 - }  
304 - }  
305 - }  
306 - }  
307 - };  
308 -  
309 private final Consumer<OAuth2Info> oauth2InfoValidator = oauth2Info -> { 159 private final Consumer<OAuth2Info> oauth2InfoValidator = oauth2Info -> {
310 if (oauth2Info == null 160 if (oauth2Info == null
311 || oauth2Info.getOauth2ParamsInfos() == null) { 161 || oauth2Info.getOauth2ParamsInfos() == null) {
@@ -18,15 +18,7 @@ package org.thingsboard.server.dao.oauth2; @@ -18,15 +18,7 @@ package org.thingsboard.server.dao.oauth2;
18 import org.thingsboard.server.common.data.BaseData; 18 import org.thingsboard.server.common.data.BaseData;
19 import org.thingsboard.server.common.data.id.OAuth2ParamsId; 19 import org.thingsboard.server.common.data.id.OAuth2ParamsId;
20 import org.thingsboard.server.common.data.id.TenantId; 20 import org.thingsboard.server.common.data.id.TenantId;
21 -import org.thingsboard.server.common.data.id.deprecated.OAuth2ClientRegistrationInfoId;  
22 import org.thingsboard.server.common.data.oauth2.*; 21 import org.thingsboard.server.common.data.oauth2.*;
23 -import org.thingsboard.server.common.data.oauth2.deprecated.ClientRegistrationDto;  
24 -import org.thingsboard.server.common.data.oauth2.deprecated.DomainInfo;  
25 -import org.thingsboard.server.common.data.oauth2.deprecated.ExtendedOAuth2ClientRegistrationInfo;  
26 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistration;  
27 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
28 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientsDomainParams;  
29 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientsParams;  
30 22
31 import java.util.*; 23 import java.util.*;
32 import java.util.stream.Collectors; 24 import java.util.stream.Collectors;
@@ -42,75 +34,6 @@ public class OAuth2Utils { @@ -42,75 +34,6 @@ public class OAuth2Utils {
42 return client; 34 return client;
43 } 35 }
44 36
45 - public static OAuth2ClientsParams toOAuth2Params(List<ExtendedOAuth2ClientRegistrationInfo> extendedOAuth2ClientRegistrationInfos) {  
46 - Map<OAuth2ClientRegistrationInfoId, List<DomainInfo>> domainsByInfoId = new LinkedHashMap<>();  
47 - Map<OAuth2ClientRegistrationInfoId, OAuth2ClientRegistrationInfo> infoById = new LinkedHashMap<>();  
48 - for (ExtendedOAuth2ClientRegistrationInfo extendedClientRegistrationInfo : extendedOAuth2ClientRegistrationInfos) {  
49 - String domainName = extendedClientRegistrationInfo.getDomainName();  
50 - SchemeType domainScheme = extendedClientRegistrationInfo.getDomainScheme();  
51 - domainsByInfoId.computeIfAbsent(extendedClientRegistrationInfo.getId(), key -> new ArrayList<>())  
52 - .add(new DomainInfo(domainScheme, domainName));  
53 - infoById.put(extendedClientRegistrationInfo.getId(), extendedClientRegistrationInfo);  
54 - }  
55 - Map<List<DomainInfo>, OAuth2ClientsDomainParams> domainParamsMap = new LinkedHashMap<>();  
56 - domainsByInfoId.forEach((clientRegistrationInfoId, domainInfos) -> {  
57 - domainParamsMap.computeIfAbsent(domainInfos,  
58 - key -> new OAuth2ClientsDomainParams(key, new ArrayList<>())  
59 - )  
60 - .getClientRegistrations()  
61 - .add(toClientRegistrationDto(infoById.get(clientRegistrationInfoId)));  
62 - });  
63 - boolean enabled = extendedOAuth2ClientRegistrationInfos.stream()  
64 - .map(OAuth2ClientRegistrationInfo::isEnabled)  
65 - .findFirst().orElse(false);  
66 - return new OAuth2ClientsParams(enabled, new ArrayList<>(domainParamsMap.values()));  
67 - }  
68 -  
69 - public static ClientRegistrationDto toClientRegistrationDto(OAuth2ClientRegistrationInfo oAuth2ClientRegistrationInfo) {  
70 - return ClientRegistrationDto.builder()  
71 - .mapperConfig(oAuth2ClientRegistrationInfo.getMapperConfig())  
72 - .clientId(oAuth2ClientRegistrationInfo.getClientId())  
73 - .clientSecret(oAuth2ClientRegistrationInfo.getClientSecret())  
74 - .authorizationUri(oAuth2ClientRegistrationInfo.getAuthorizationUri())  
75 - .accessTokenUri(oAuth2ClientRegistrationInfo.getAccessTokenUri())  
76 - .scope(oAuth2ClientRegistrationInfo.getScope())  
77 - .userInfoUri(oAuth2ClientRegistrationInfo.getUserInfoUri())  
78 - .userNameAttributeName(oAuth2ClientRegistrationInfo.getUserNameAttributeName())  
79 - .jwkSetUri(oAuth2ClientRegistrationInfo.getJwkSetUri())  
80 - .clientAuthenticationMethod(oAuth2ClientRegistrationInfo.getClientAuthenticationMethod())  
81 - .loginButtonLabel(oAuth2ClientRegistrationInfo.getLoginButtonLabel())  
82 - .loginButtonIcon(oAuth2ClientRegistrationInfo.getLoginButtonIcon())  
83 - .additionalInfo(oAuth2ClientRegistrationInfo.getAdditionalInfo())  
84 - .build();  
85 - }  
86 -  
87 - public static OAuth2ClientRegistrationInfo toClientRegistrationInfo(boolean enabled, ClientRegistrationDto clientRegistrationDto) {  
88 - OAuth2ClientRegistrationInfo clientRegistrationInfo = new OAuth2ClientRegistrationInfo();  
89 - clientRegistrationInfo.setEnabled(enabled);  
90 - clientRegistrationInfo.setMapperConfig(clientRegistrationDto.getMapperConfig());  
91 - clientRegistrationInfo.setClientId(clientRegistrationDto.getClientId());  
92 - clientRegistrationInfo.setClientSecret(clientRegistrationDto.getClientSecret());  
93 - clientRegistrationInfo.setAuthorizationUri(clientRegistrationDto.getAuthorizationUri());  
94 - clientRegistrationInfo.setAccessTokenUri(clientRegistrationDto.getAccessTokenUri());  
95 - clientRegistrationInfo.setScope(clientRegistrationDto.getScope());  
96 - clientRegistrationInfo.setUserInfoUri(clientRegistrationDto.getUserInfoUri());  
97 - clientRegistrationInfo.setUserNameAttributeName(clientRegistrationDto.getUserNameAttributeName());  
98 - clientRegistrationInfo.setJwkSetUri(clientRegistrationDto.getJwkSetUri());  
99 - clientRegistrationInfo.setClientAuthenticationMethod(clientRegistrationDto.getClientAuthenticationMethod());  
100 - clientRegistrationInfo.setLoginButtonLabel(clientRegistrationDto.getLoginButtonLabel());  
101 - clientRegistrationInfo.setLoginButtonIcon(clientRegistrationDto.getLoginButtonIcon());  
102 - clientRegistrationInfo.setAdditionalInfo(clientRegistrationDto.getAdditionalInfo());  
103 - return clientRegistrationInfo;  
104 - }  
105 -  
106 - public static OAuth2ClientRegistration toClientRegistration(OAuth2ClientRegistrationInfoId clientRegistrationInfoId, SchemeType domainScheme, String domainName) {  
107 - OAuth2ClientRegistration clientRegistration = new OAuth2ClientRegistration();  
108 - clientRegistration.setClientRegistrationId(clientRegistrationInfoId);  
109 - clientRegistration.setDomainName(domainName);  
110 - clientRegistration.setDomainScheme(domainScheme);  
111 - return clientRegistration;  
112 - }  
113 -  
114 public static OAuth2ParamsInfo toOAuth2ParamsInfo(List<OAuth2Registration> registrations, List<OAuth2Domain> domains, List<OAuth2Mobile> mobiles) { 37 public static OAuth2ParamsInfo toOAuth2ParamsInfo(List<OAuth2Registration> registrations, List<OAuth2Domain> domains, List<OAuth2Mobile> mobiles) {
115 OAuth2ParamsInfo oauth2ParamsInfo = new OAuth2ParamsInfo(); 38 OAuth2ParamsInfo oauth2ParamsInfo = new OAuth2ParamsInfo();
116 oauth2ParamsInfo.setClientRegistrations(registrations.stream().sorted(Comparator.comparing(BaseData::getUuidId)).map(OAuth2Utils::toOAuth2RegistrationInfo).collect(Collectors.toList())); 39 oauth2ParamsInfo.setClientRegistrations(registrations.stream().sorted(Comparator.comparing(BaseData::getUuidId)).map(OAuth2Utils::toOAuth2RegistrationInfo).collect(Collectors.toList()));
@@ -194,46 +117,4 @@ public class OAuth2Utils { @@ -194,46 +117,4 @@ public class OAuth2Utils {
194 mobile.setAppSecret(mobileInfo.getAppSecret()); 117 mobile.setAppSecret(mobileInfo.getAppSecret());
195 return mobile; 118 return mobile;
196 } 119 }
197 -  
198 - @Deprecated  
199 - public static OAuth2Info clientParamsToOAuth2Info(OAuth2ClientsParams clientsParams) {  
200 - OAuth2Info oauth2Info = new OAuth2Info();  
201 - oauth2Info.setEnabled(clientsParams.isEnabled());  
202 - oauth2Info.setOauth2ParamsInfos(clientsParams.getDomainsParams().stream().map(OAuth2Utils::clientsDomainParamsToOAuth2ParamsInfo).collect(Collectors.toList()));  
203 - return oauth2Info;  
204 - }  
205 -  
206 - private static OAuth2ParamsInfo clientsDomainParamsToOAuth2ParamsInfo(OAuth2ClientsDomainParams clientsDomainParams) {  
207 - OAuth2ParamsInfo oauth2ParamsInfo = new OAuth2ParamsInfo();  
208 - oauth2ParamsInfo.setMobileInfos(Collections.emptyList());  
209 - oauth2ParamsInfo.setClientRegistrations(clientsDomainParams.getClientRegistrations().stream().map(OAuth2Utils::clientRegistrationDtoToOAuth2RegistrationInfo).collect(Collectors.toList()));  
210 - oauth2ParamsInfo.setDomainInfos(clientsDomainParams.getDomainInfos().stream().map(OAuth2Utils::domainInfoToOAuth2DomainInfo).collect(Collectors.toList()));  
211 - return oauth2ParamsInfo;  
212 - }  
213 -  
214 - private static OAuth2RegistrationInfo clientRegistrationDtoToOAuth2RegistrationInfo(ClientRegistrationDto clientRegistrationDto) {  
215 - return OAuth2RegistrationInfo.builder()  
216 - .mapperConfig(clientRegistrationDto.getMapperConfig())  
217 - .clientId(clientRegistrationDto.getClientId())  
218 - .clientSecret(clientRegistrationDto.getClientSecret())  
219 - .authorizationUri(clientRegistrationDto.getAuthorizationUri())  
220 - .accessTokenUri(clientRegistrationDto.getAccessTokenUri())  
221 - .scope(clientRegistrationDto.getScope())  
222 - .userInfoUri(clientRegistrationDto.getUserInfoUri())  
223 - .userNameAttributeName(clientRegistrationDto.getUserNameAttributeName())  
224 - .jwkSetUri(clientRegistrationDto.getJwkSetUri())  
225 - .clientAuthenticationMethod(clientRegistrationDto.getClientAuthenticationMethod())  
226 - .loginButtonLabel(clientRegistrationDto.getLoginButtonLabel())  
227 - .loginButtonIcon(clientRegistrationDto.getLoginButtonIcon())  
228 - .additionalInfo(clientRegistrationDto.getAdditionalInfo())  
229 - .platforms(Collections.emptyList())  
230 - .build();  
231 - }  
232 -  
233 - private static OAuth2DomainInfo domainInfoToOAuth2DomainInfo(DomainInfo domainInfo) {  
234 - return OAuth2DomainInfo.builder()  
235 - .name(domainInfo.getName())  
236 - .scheme(domainInfo.getScheme())  
237 - .build();  
238 - }  
239 } 120 }
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.oauth2.deprecated;  
17 -  
18 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistration;  
19 -import org.thingsboard.server.dao.Dao;  
20 -  
21 -@Deprecated  
22 -public interface OAuth2ClientRegistrationDao extends Dao<OAuth2ClientRegistration> {  
23 - void deleteAll();  
24 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.oauth2.deprecated;  
17 -  
18 -import org.thingsboard.server.common.data.oauth2.deprecated.ExtendedOAuth2ClientRegistrationInfo;  
19 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
20 -import org.thingsboard.server.common.data.oauth2.SchemeType;  
21 -import org.thingsboard.server.dao.Dao;  
22 -  
23 -import java.util.List;  
24 -  
25 -@Deprecated  
26 -public interface OAuth2ClientRegistrationInfoDao extends Dao<OAuth2ClientRegistrationInfo> {  
27 - List<OAuth2ClientRegistrationInfo> findAll();  
28 -  
29 - List<ExtendedOAuth2ClientRegistrationInfo> findAllExtended();  
30 -  
31 - List<OAuth2ClientRegistrationInfo> findByDomainSchemesAndDomainName(List<SchemeType> domainSchemes, String domainName);  
32 -  
33 - void deleteAll();  
34 -}  
@@ -133,6 +133,7 @@ public class BaseOtaPackageService implements OtaPackageService { @@ -133,6 +133,7 @@ public class BaseOtaPackageService implements OtaPackageService {
133 return getHashFunction(checksumAlgorithm).hashBytes(data.array()).toString(); 133 return getHashFunction(checksumAlgorithm).hashBytes(data.array()).toString();
134 } 134 }
135 135
  136 + @SuppressWarnings("deprecation")
136 private HashFunction getHashFunction(ChecksumAlgorithm checksumAlgorithm) { 137 private HashFunction getHashFunction(ChecksumAlgorithm checksumAlgorithm) {
137 switch (checksumAlgorithm) { 138 switch (checksumAlgorithm) {
138 case MD5: 139 case MD5:
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.sql.oauth2.deprecated;  
17 -  
18 -import lombok.RequiredArgsConstructor;  
19 -import org.springframework.data.repository.CrudRepository;  
20 -import org.springframework.stereotype.Component;  
21 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistration;  
22 -import org.thingsboard.server.dao.model.sql.deprecated.OAuth2ClientRegistrationEntity;  
23 -import org.thingsboard.server.dao.oauth2.deprecated.OAuth2ClientRegistrationDao;  
24 -import org.thingsboard.server.dao.sql.JpaAbstractDao;  
25 -  
26 -import java.util.UUID;  
27 -  
28 -@Deprecated  
29 -@Component  
30 -@RequiredArgsConstructor  
31 -public class JpaOAuth2ClientRegistrationDao extends JpaAbstractDao<OAuth2ClientRegistrationEntity, OAuth2ClientRegistration> implements OAuth2ClientRegistrationDao {  
32 - private final OAuth2ClientRegistrationRepository repository;  
33 -  
34 - @Override  
35 - protected Class<OAuth2ClientRegistrationEntity> getEntityClass() {  
36 - return OAuth2ClientRegistrationEntity.class;  
37 - }  
38 -  
39 - @Override  
40 - protected CrudRepository<OAuth2ClientRegistrationEntity, UUID> getCrudRepository() {  
41 - return repository;  
42 - }  
43 -  
44 - @Override  
45 - public void deleteAll() {  
46 - repository.deleteAll();  
47 - }  
48 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.sql.oauth2.deprecated;  
17 -  
18 -import lombok.RequiredArgsConstructor;  
19 -import org.springframework.data.repository.CrudRepository;  
20 -import org.springframework.stereotype.Component;  
21 -import org.thingsboard.server.common.data.oauth2.deprecated.ExtendedOAuth2ClientRegistrationInfo;  
22 -import org.thingsboard.server.common.data.oauth2.deprecated.OAuth2ClientRegistrationInfo;  
23 -import org.thingsboard.server.common.data.oauth2.SchemeType;  
24 -import org.thingsboard.server.dao.DaoUtil;  
25 -import org.thingsboard.server.dao.model.sql.deprecated.OAuth2ClientRegistrationInfoEntity;  
26 -import org.thingsboard.server.dao.oauth2.deprecated.OAuth2ClientRegistrationInfoDao;  
27 -import org.thingsboard.server.dao.sql.JpaAbstractDao;  
28 -  
29 -import java.util.ArrayList;  
30 -import java.util.List;  
31 -import java.util.UUID;  
32 -import java.util.stream.Collectors;  
33 -  
34 -@Deprecated  
35 -@Component  
36 -@RequiredArgsConstructor  
37 -public class JpaOAuth2ClientRegistrationInfoDao extends JpaAbstractDao<OAuth2ClientRegistrationInfoEntity, OAuth2ClientRegistrationInfo> implements OAuth2ClientRegistrationInfoDao {  
38 - private final OAuth2ClientRegistrationInfoRepository repository;  
39 -  
40 - @Override  
41 - protected Class<OAuth2ClientRegistrationInfoEntity> getEntityClass() {  
42 - return OAuth2ClientRegistrationInfoEntity.class;  
43 - }  
44 -  
45 - @Override  
46 - protected CrudRepository<OAuth2ClientRegistrationInfoEntity, UUID> getCrudRepository() {  
47 - return repository;  
48 - }  
49 -  
50 - @Override  
51 - public List<OAuth2ClientRegistrationInfo> findAll() {  
52 - Iterable<OAuth2ClientRegistrationInfoEntity> entities = repository.findAll();  
53 - List<OAuth2ClientRegistrationInfo> result = new ArrayList<>();  
54 - entities.forEach(entity -> {  
55 - result.add(DaoUtil.getData(entity));  
56 - });  
57 - return result;  
58 - }  
59 -  
60 - @Override  
61 - public List<ExtendedOAuth2ClientRegistrationInfo> findAllExtended() {  
62 - return repository.findAllExtended().stream()  
63 - .map(DaoUtil::getData)  
64 - .collect(Collectors.toList());  
65 - }  
66 -  
67 - @Override  
68 - public List<OAuth2ClientRegistrationInfo> findByDomainSchemesAndDomainName(List<SchemeType> domainSchemes, String domainName) {  
69 - List<OAuth2ClientRegistrationInfoEntity> entities = repository.findAllByDomainSchemesAndName(domainSchemes, domainName);  
70 - return entities.stream().map(DaoUtil::getData).collect(Collectors.toList());  
71 - }  
72 -  
73 - @Override  
74 - public void deleteAll() {  
75 - repository.deleteAll();  
76 - }  
77 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.sql.oauth2.deprecated;  
17 -  
18 -import org.springframework.data.jpa.repository.Query;  
19 -import org.springframework.data.repository.CrudRepository;  
20 -import org.springframework.data.repository.query.Param;  
21 -import org.thingsboard.server.common.data.oauth2.SchemeType;  
22 -import org.thingsboard.server.dao.model.sql.deprecated.ExtendedOAuth2ClientRegistrationInfoEntity;  
23 -import org.thingsboard.server.dao.model.sql.deprecated.OAuth2ClientRegistrationInfoEntity;  
24 -  
25 -import java.util.List;  
26 -import java.util.UUID;  
27 -  
28 -@Deprecated  
29 -public interface OAuth2ClientRegistrationInfoRepository extends CrudRepository<OAuth2ClientRegistrationInfoEntity, UUID> {  
30 - @Query("SELECT new OAuth2ClientRegistrationInfoEntity(cr_info) " +  
31 - "FROM OAuth2ClientRegistrationInfoEntity cr_info " +  
32 - "LEFT JOIN OAuth2ClientRegistrationEntity cr on cr_info.id = cr.clientRegistrationInfoId " +  
33 - "WHERE cr.domainName = :domainName " +  
34 - "AND cr.domainScheme IN (:domainSchemes)")  
35 - List<OAuth2ClientRegistrationInfoEntity> findAllByDomainSchemesAndName(@Param("domainSchemes") List<SchemeType> domainSchemes,  
36 - @Param("domainName") String domainName);  
37 -  
38 - @Query("SELECT new org.thingsboard.server.dao.model.sql.deprecated.ExtendedOAuth2ClientRegistrationInfoEntity(cr_info, cr.domainName, cr.domainScheme) " +  
39 - "FROM OAuth2ClientRegistrationInfoEntity cr_info " +  
40 - "LEFT JOIN OAuth2ClientRegistrationEntity cr on cr_info.id = cr.clientRegistrationInfoId ")  
41 - List<ExtendedOAuth2ClientRegistrationInfoEntity> findAllExtended();  
42 -}  
1 -/**  
2 - * Copyright © 2016-2021 The Thingsboard Authors  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -package org.thingsboard.server.dao.sql.oauth2.deprecated;  
17 -  
18 -import org.springframework.data.repository.CrudRepository;  
19 -import org.thingsboard.server.dao.model.sql.deprecated.OAuth2ClientRegistrationEntity;  
20 -  
21 -import java.util.UUID;  
22 -  
23 -@Deprecated  
24 -public interface OAuth2ClientRegistrationRepository extends CrudRepository<OAuth2ClientRegistrationEntity, UUID> {  
25 -}  
@@ -71,6 +71,7 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest { @@ -71,6 +71,7 @@ public abstract class BaseDeviceServiceTest extends AbstractServiceTest {
71 tenantProfileService.deleteTenantProfiles(anotherTenantId); 71 tenantProfileService.deleteTenantProfiles(anotherTenantId);
72 } 72 }
73 73
  74 + @SuppressWarnings("deprecation")
74 @Rule 75 @Rule
75 public ExpectedException thrown = ExpectedException.none(); 76 public ExpectedException thrown = ExpectedException.none();
76 77
@@ -77,6 +77,7 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest { @@ -77,6 +77,7 @@ public abstract class BaseOtaPackageServiceTest extends AbstractServiceTest {
77 deviceProfileId = savedDeviceProfile.getId(); 77 deviceProfileId = savedDeviceProfile.getId();
78 } 78 }
79 79
  80 + @SuppressWarnings("deprecation")
80 @Rule 81 @Rule
81 public ExpectedException thrown = ExpectedException.none(); 82 public ExpectedException thrown = ExpectedException.none();
82 83
@@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens @@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
17 17
18 buildscript { 18 buildscript {
19 ext { 19 ext {
20 - osPackageVersion = "8.3.0" 20 + osPackageVersion = "8.6.3"
21 } 21 }
22 repositories { 22 repositories {
23 jcenter() 23 jcenter()
@@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens @@ -17,7 +17,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
17 17
18 buildscript { 18 buildscript {
19 ext { 19 ext {
20 - osPackageVersion = "8.3.0" 20 + osPackageVersion = "8.6.3"
21 } 21 }
22 repositories { 22 repositories {
23 jcenter() 23 jcenter()
@@ -217,12 +217,6 @@ public interface TbContext { @@ -217,12 +217,6 @@ public interface TbContext {
217 217
218 EdgeEventService getEdgeEventService(); 218 EdgeEventService getEdgeEventService();
219 219
220 - /**  
221 - * Js script executors call are completely asynchronous  
222 - * */  
223 - @Deprecated  
224 - ListeningExecutor getJsExecutor();  
225 -  
226 ListeningExecutor getMailExecutor(); 220 ListeningExecutor getMailExecutor();
227 221
228 ListeningExecutor getSmsExecutor(); 222 ListeningExecutor getSmsExecutor();