Merge pull request #10210 from thingsboard/fix_bug_test_any
fix_bug: any Tetsts
This commit is contained in:
commit
1afea63f8b
@ -27,7 +27,6 @@ import org.springframework.http.HttpHeaders;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.util.Base64Utils;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -60,6 +59,7 @@ import org.thingsboard.server.service.security.model.SecurityUser;
|
|||||||
import org.thingsboard.server.service.security.permission.Operation;
|
import org.thingsboard.server.service.security.permission.Operation;
|
||||||
import org.thingsboard.server.service.security.permission.Resource;
|
import org.thingsboard.server.service.security.permission.Resource;
|
||||||
|
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.thingsboard.server.controller.ControllerConstants.PAGE_NUMBER_DESCRIPTION;
|
import static org.thingsboard.server.controller.ControllerConstants.PAGE_NUMBER_DESCRIPTION;
|
||||||
@ -196,7 +196,7 @@ public class ImageController extends BaseController {
|
|||||||
.resourceKey(imageInfo.getResourceKey())
|
.resourceKey(imageInfo.getResourceKey())
|
||||||
.isPublic(imageInfo.isPublic())
|
.isPublic(imageInfo.isPublic())
|
||||||
.publicResourceKey(imageInfo.getPublicResourceKey())
|
.publicResourceKey(imageInfo.getPublicResourceKey())
|
||||||
.data(Base64Utils.encodeToString(data))
|
.data(Base64.getEncoder().encodeToString(data))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ public class ImageController extends BaseController {
|
|||||||
ImageDescriptor descriptor = new ImageDescriptor();
|
ImageDescriptor descriptor = new ImageDescriptor();
|
||||||
descriptor.setMediaType(imageData.getMediaType());
|
descriptor.setMediaType(imageData.getMediaType());
|
||||||
image.setDescriptorValue(descriptor);
|
image.setDescriptorValue(descriptor);
|
||||||
image.setData(Base64Utils.decodeFromString(imageData.getData()));
|
image.setData(Base64.getDecoder().decode(imageData.getData()));
|
||||||
return tbImageService.save(image, user);
|
return tbImageService.save(image, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,19 +15,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.transport.lwm2m.security.sql;
|
package org.thingsboard.server.transport.lwm2m.security.sql;
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.eclipse.leshan.client.object.Security;
|
import org.eclipse.leshan.client.object.Security;
|
||||||
import org.eclipse.leshan.core.util.Hex;
|
import org.eclipse.leshan.core.util.Hex;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
import org.springframework.util.Base64Utils;
|
|
||||||
import org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MDeviceCredentials;
|
import org.thingsboard.server.common.data.device.credentials.lwm2m.LwM2MDeviceCredentials;
|
||||||
import org.thingsboard.server.common.data.device.credentials.lwm2m.X509ClientCredential;
|
import org.thingsboard.server.common.data.device.credentials.lwm2m.X509ClientCredential;
|
||||||
import org.thingsboard.server.common.data.device.profile.Lwm2mDeviceProfileTransportConfiguration;
|
import org.thingsboard.server.common.data.device.profile.Lwm2mDeviceProfileTransportConfiguration;
|
||||||
import org.thingsboard.server.transport.lwm2m.security.AbstractSecurityLwM2MIntegrationTest;
|
import org.thingsboard.server.transport.lwm2m.security.AbstractSecurityLwM2MIntegrationTest;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
import static org.eclipse.leshan.client.object.Security.x509;
|
import static org.eclipse.leshan.client.object.Security.x509;
|
||||||
import static org.eclipse.leshan.client.object.Security.x509Bootstrap;
|
import static org.eclipse.leshan.client.object.Security.x509Bootstrap;
|
||||||
@ -48,7 +48,7 @@ public class X509_NoTrustLwM2MIntegrationTest extends AbstractSecurityLwM2MInteg
|
|||||||
PrivateKey privateKey = clientPrivateKeyFromCertTrustNo;
|
PrivateKey privateKey = clientPrivateKeyFromCertTrustNo;
|
||||||
X509ClientCredential clientCredentials = new X509ClientCredential();
|
X509ClientCredential clientCredentials = new X509ClientCredential();
|
||||||
clientCredentials.setEndpoint(clientEndpoint);
|
clientCredentials.setEndpoint(clientEndpoint);
|
||||||
clientCredentials.setCert(Base64Utils.encodeToString(certificate.getEncoded()));
|
clientCredentials.setCert(Base64.getEncoder().encodeToString(certificate.getEncoded()));
|
||||||
Security security = x509(SECURE_URI,
|
Security security = x509(SECURE_URI,
|
||||||
shortServerId,
|
shortServerId,
|
||||||
certificate.getEncoded(),
|
certificate.getEncoded(),
|
||||||
@ -93,7 +93,7 @@ public class X509_NoTrustLwM2MIntegrationTest extends AbstractSecurityLwM2MInteg
|
|||||||
PrivateKey privateKey = clientPrivateKeyFromCertTrustNo;
|
PrivateKey privateKey = clientPrivateKeyFromCertTrustNo;
|
||||||
X509ClientCredential clientCredentials = new X509ClientCredential();
|
X509ClientCredential clientCredentials = new X509ClientCredential();
|
||||||
clientCredentials.setEndpoint(clientEndpoint);
|
clientCredentials.setEndpoint(clientEndpoint);
|
||||||
clientCredentials.setCert(Base64Utils.encodeToString(certificate.getEncoded()));
|
clientCredentials.setCert(Base64.getEncoder().encodeToString(certificate.getEncoded()));
|
||||||
Lwm2mDeviceProfileTransportConfiguration transportConfiguration = getTransportConfiguration(OBSERVE_ATTRIBUTES_WITHOUT_PARAMS, getBootstrapServerCredentialsSecure(X509, NONE));
|
Lwm2mDeviceProfileTransportConfiguration transportConfiguration = getTransportConfiguration(OBSERVE_ATTRIBUTES_WITHOUT_PARAMS, getBootstrapServerCredentialsSecure(X509, NONE));
|
||||||
LwM2MDeviceCredentials deviceCredentials = getDeviceCredentialsSecure(clientCredentials, privateKey, certificate, X509, true);
|
LwM2MDeviceCredentials deviceCredentials = getDeviceCredentialsSecure(clientCredentials, privateKey, certificate, X509, true);
|
||||||
createDeviceProfile(transportConfiguration);
|
createDeviceProfile(transportConfiguration);
|
||||||
@ -111,7 +111,7 @@ public class X509_NoTrustLwM2MIntegrationTest extends AbstractSecurityLwM2MInteg
|
|||||||
PrivateKey privateKey = clientPrivateKeyFromCertTrustNo;
|
PrivateKey privateKey = clientPrivateKeyFromCertTrustNo;
|
||||||
X509ClientCredential clientCredentials = new X509ClientCredential();
|
X509ClientCredential clientCredentials = new X509ClientCredential();
|
||||||
clientCredentials.setEndpoint(clientEndpoint);
|
clientCredentials.setEndpoint(clientEndpoint);
|
||||||
clientCredentials.setCert(Base64Utils.encodeToString(certificate.getEncoded()));
|
clientCredentials.setCert(Base64.getEncoder().encodeToString(certificate.getEncoded()));
|
||||||
Security security = x509Bootstrap(SECURE_URI_BS,
|
Security security = x509Bootstrap(SECURE_URI_BS,
|
||||||
certificate.getEncoded(),
|
certificate.getEncoded(),
|
||||||
privateKey.getEncoded(),
|
privateKey.getEncoded(),
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.thingsboard.server.transport.lwm2m.utils;
|
package org.thingsboard.server.transport.lwm2m.utils;
|
||||||
|
|
||||||
import com.google.api.client.util.Base64;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.leshan.core.model.ResourceModel.Type;
|
import org.eclipse.leshan.core.model.ResourceModel.Type;
|
||||||
import org.eclipse.leshan.core.node.LwM2mPath;
|
import org.eclipse.leshan.core.node.LwM2mPath;
|
||||||
@ -28,6 +27,7 @@ import org.thingsboard.server.common.data.StringUtils;
|
|||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import static org.eclipse.leshan.core.model.ResourceModel.Type.OPAQUE;
|
import static org.eclipse.leshan.core.model.ResourceModel.Type.OPAQUE;
|
||||||
@ -172,7 +172,7 @@ public class LwM2mValueConverterImpl implements LwM2mValueConverter {
|
|||||||
return Hex.decodeHex(((String)value).toCharArray());
|
return Hex.decodeHex(((String)value).toCharArray());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
try {
|
try {
|
||||||
return Base64.decodeBase64(((String) value).getBytes());
|
return Base64.getDecoder().decode(((String) value).getBytes());
|
||||||
} catch (IllegalArgumentException ea) {
|
} catch (IllegalArgumentException ea) {
|
||||||
throw new CodecException("Unable to convert hexastring or base64 [%s] to byte array for resource %s",
|
throw new CodecException("Unable to convert hexastring or base64 [%s] to byte array for resource %s",
|
||||||
value, resourcePath);
|
value, resourcePath);
|
||||||
|
|||||||
@ -16,13 +16,11 @@
|
|||||||
package org.thingsboard.server.common.transport.util;
|
package org.thingsboard.server.common.transport.util;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.bouncycastle.asn1.x500.RDN;
|
import org.bouncycastle.asn1.x500.RDN;
|
||||||
import org.bouncycastle.asn1.x500.X500Name;
|
import org.bouncycastle.asn1.x500.X500Name;
|
||||||
import org.bouncycastle.asn1.x500.style.BCStyle;
|
import org.bouncycastle.asn1.x500.style.BCStyle;
|
||||||
import org.bouncycastle.asn1.x500.style.IETFUtils;
|
import org.bouncycastle.asn1.x500.style.IETFUtils;
|
||||||
import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
|
import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;
|
||||||
import org.springframework.util.Base64Utils;
|
|
||||||
import org.thingsboard.server.common.msg.EncryptionUtil;
|
import org.thingsboard.server.common.msg.EncryptionUtil;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
@ -31,6 +29,8 @@ import java.security.cert.Certificate;
|
|||||||
import java.security.cert.CertificateEncodingException;
|
import java.security.cert.CertificateEncodingException;
|
||||||
import java.security.cert.CertificateFactory;
|
import java.security.cert.CertificateFactory;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Valerii Sosliuk
|
* @author Valerii Sosliuk
|
||||||
@ -43,7 +43,7 @@ public class SslUtil {
|
|||||||
|
|
||||||
public static String getCertificateString(Certificate cert)
|
public static String getCertificateString(Certificate cert)
|
||||||
throws CertificateEncodingException {
|
throws CertificateEncodingException {
|
||||||
return EncryptionUtil.certTrimNewLines(Base64Utils.encodeToString(cert.getEncoded()));
|
return EncryptionUtil.certTrimNewLines(Base64.getEncoder().encodeToString(cert.getEncoded()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCertificateChainString(Certificate[] chain)
|
public static String getCertificateChainString(Certificate[] chain)
|
||||||
@ -52,7 +52,7 @@ public class SslUtil {
|
|||||||
String end = "-----END CERTIFICATE-----";
|
String end = "-----END CERTIFICATE-----";
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
for (Certificate cert: chain) {
|
for (Certificate cert: chain) {
|
||||||
stringBuilder.append(begin).append(EncryptionUtil.certTrimNewLines(Base64Utils.encodeToString(cert.getEncoded()))).append(end).append("\n");
|
stringBuilder.append(begin).append(EncryptionUtil.certTrimNewLines(Base64.getEncoder().encodeToString(cert.getEncoded()))).append(end).append("\n");
|
||||||
}
|
}
|
||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ public class SslUtil {
|
|||||||
fileContent = fileContent.replace("-----BEGIN CERTIFICATE-----", "")
|
fileContent = fileContent.replace("-----BEGIN CERTIFICATE-----", "")
|
||||||
.replace("-----END CERTIFICATE-----", "")
|
.replace("-----END CERTIFICATE-----", "")
|
||||||
.replaceAll("\\s", "");
|
.replaceAll("\\s", "");
|
||||||
byte[] decoded = Base64.decodeBase64(fileContent);
|
byte[] decoded = Base64.getDecoder().decode(fileContent);
|
||||||
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
|
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
|
||||||
try (InputStream inStream = new ByteArrayInputStream(decoded)) {
|
try (InputStream inStream = new ByteArrayInputStream(decoded)) {
|
||||||
certificate = (X509Certificate) certFactory.generateCertificate(inStream);
|
certificate = (X509Certificate) certFactory.generateCertificate(inStream);
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -29,7 +30,6 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
|
|||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Base64Utils;
|
|
||||||
import org.thingsboard.common.util.JacksonUtil;
|
import org.thingsboard.common.util.JacksonUtil;
|
||||||
import org.thingsboard.server.common.data.Dashboard;
|
import org.thingsboard.server.common.data.Dashboard;
|
||||||
import org.thingsboard.server.common.data.DataConstants;
|
import org.thingsboard.server.common.data.DataConstants;
|
||||||
@ -60,7 +60,6 @@ import org.thingsboard.server.dao.util.JsonPathProcessingTask;
|
|||||||
import org.thingsboard.server.dao.widget.WidgetTypeDao;
|
import org.thingsboard.server.dao.widget.WidgetTypeDao;
|
||||||
import org.thingsboard.server.dao.widget.WidgetsBundleDao;
|
import org.thingsboard.server.dao.widget.WidgetsBundleDao;
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -432,8 +431,8 @@ public class BaseImageService extends BaseResourceService implements ImageServic
|
|||||||
String mdResourceName = null;
|
String mdResourceName = null;
|
||||||
String mdMediaType;
|
String mdMediaType;
|
||||||
if (matches) {
|
if (matches) {
|
||||||
mdResourceKey = new String(Base64Utils.decodeFromString(matcher.group(1)), StandardCharsets.UTF_8);
|
mdResourceKey = new String(Base64.getDecoder().decode(matcher.group(1)), StandardCharsets.UTF_8);
|
||||||
mdResourceName = new String(Base64Utils.decodeFromString(matcher.group(2)), StandardCharsets.UTF_8);
|
mdResourceName = new String(Base64.getDecoder().decode(matcher.group(2)), StandardCharsets.UTF_8);
|
||||||
mdMediaType = matcher.group(3);
|
mdMediaType = matcher.group(3);
|
||||||
} else if (data.startsWith(DataConstants.TB_IMAGE_PREFIX + "data:image/") || (!strict && data.startsWith("data:image/"))) {
|
} else if (data.startsWith(DataConstants.TB_IMAGE_PREFIX + "data:image/") || (!strict && data.startsWith("data:image/"))) {
|
||||||
mdMediaType = StringUtils.substringBetween(data, "data:", ";base64");
|
mdMediaType = StringUtils.substringBetween(data, "data:", ";base64");
|
||||||
@ -623,10 +622,10 @@ public class BaseImageService extends BaseResourceService implements ImageServic
|
|||||||
ImageDescriptor descriptor = getImageDescriptor(imageInfo, key.isPreview());
|
ImageDescriptor descriptor = getImageDescriptor(imageInfo, key.isPreview());
|
||||||
String tbImagePrefix = "";
|
String tbImagePrefix = "";
|
||||||
if (addTbImagePrefix) {
|
if (addTbImagePrefix) {
|
||||||
tbImagePrefix = "tb-image:" + Base64Utils.encodeToString(imageInfo.getResourceKey().getBytes(StandardCharsets.UTF_8)) + ":"
|
tbImagePrefix = "tb-image:" + Base64.getEncoder().encodeToString(imageInfo.getResourceKey().getBytes(StandardCharsets.UTF_8)) + ":"
|
||||||
+ Base64Utils.encodeToString(imageInfo.getName().getBytes(StandardCharsets.UTF_8)) + ";";
|
+ Base64.getEncoder().encodeToString(imageInfo.getName().getBytes(StandardCharsets.UTF_8)) + ";";
|
||||||
}
|
}
|
||||||
return tbImagePrefix + "data:" + descriptor.getMediaType() + ";base64," + Base64Utils.encodeToString(data);
|
return tbImagePrefix + "data:" + descriptor.getMediaType() + ";base64," + Base64.getEncoder().encodeToString(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.Base64Utils;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.thingsboard.server.common.data.DashboardInfo;
|
import org.thingsboard.server.common.data.DashboardInfo;
|
||||||
import org.thingsboard.server.common.data.DeviceProfile;
|
import org.thingsboard.server.common.data.DeviceProfile;
|
||||||
@ -64,6 +63,7 @@ import java.security.cert.CertificateEncodingException;
|
|||||||
import java.security.cert.PKIXParameters;
|
import java.security.cert.PKIXParameters;
|
||||||
import java.security.cert.TrustAnchor;
|
import java.security.cert.TrustAnchor;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -411,6 +411,6 @@ public class DeviceProfileDataValidator extends AbstractHasOtaPackageValidator<D
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getCertificateString(X509Certificate cert) throws CertificateEncodingException {
|
private String getCertificateString(X509Certificate cert) throws CertificateEncodingException {
|
||||||
return EncryptionUtil.certTrimNewLines(Base64Utils.encodeToString(cert.getEncoded()));
|
return EncryptionUtil.certTrimNewLines(Base64.getEncoder().encodeToString(cert.getEncoded()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import io.netty.handler.ssl.SslContextBuilder;
|
|||||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -49,6 +48,7 @@ import reactor.netty.transport.ProxyProvider;
|
|||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -310,7 +310,7 @@ public class TbHttpClient {
|
|||||||
if (CredentialsType.BASIC == credentials.getType()) {
|
if (CredentialsType.BASIC == credentials.getType()) {
|
||||||
BasicCredentials basicCredentials = (BasicCredentials) credentials;
|
BasicCredentials basicCredentials = (BasicCredentials) credentials;
|
||||||
String authString = basicCredentials.getUsername() + ":" + basicCredentials.getPassword();
|
String authString = basicCredentials.getUsername() + ":" + basicCredentials.getPassword();
|
||||||
String encodedAuthString = new String(Base64.encodeBase64(authString.getBytes(StandardCharsets.UTF_8)));
|
String encodedAuthString = new String(Base64.getDecoder().decode(authString.getBytes(StandardCharsets.UTF_8)));
|
||||||
headers.add("Authorization", "Basic " + encodedAuthString);
|
headers.add("Authorization", "Basic " + encodedAuthString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import org.thingsboard.rule.engine.api.TbContext;
|
|||||||
import org.thingsboard.rule.engine.api.TbNode;
|
import org.thingsboard.rule.engine.api.TbNode;
|
||||||
import org.thingsboard.rule.engine.api.TbNodeConfiguration;
|
import org.thingsboard.rule.engine.api.TbNodeConfiguration;
|
||||||
import org.thingsboard.rule.engine.api.TbNodeException;
|
import org.thingsboard.rule.engine.api.TbNodeException;
|
||||||
|
import org.thingsboard.server.common.data.AttributeScope;
|
||||||
import org.thingsboard.server.common.data.id.DeviceId;
|
import org.thingsboard.server.common.data.id.DeviceId;
|
||||||
import org.thingsboard.server.common.data.id.EntityId;
|
import org.thingsboard.server.common.data.id.EntityId;
|
||||||
import org.thingsboard.server.common.data.msg.TbMsgType;
|
import org.thingsboard.server.common.data.msg.TbMsgType;
|
||||||
@ -137,7 +138,7 @@ class TbGpsGeofencingActionNodeTest extends AbstractRuleNodeUpgradeTest {
|
|||||||
node.onMsg(ctx, msg);
|
node.onMsg(ctx, msg);
|
||||||
|
|
||||||
// THEN
|
// THEN
|
||||||
verify(ctx.getAttributesService(), never()).find(any(), any(), any(), anyString());
|
verify(ctx.getAttributesService(), never()).find(any(), any(), any(AttributeScope.class), anyString());
|
||||||
verify(ctx, never()).tellFailure(any(), any(Throwable.class));
|
verify(ctx, never()).tellFailure(any(), any(Throwable.class));
|
||||||
verify(ctx, never()).enqueueForTellNext(any(), eq(expectedOutput), any(), any());
|
verify(ctx, never()).enqueueForTellNext(any(), eq(expectedOutput), any(), any());
|
||||||
verify(ctx, never()).ack(any());
|
verify(ctx, never()).ack(any());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user