public static String buildExceptionMessage(String baseMessage, InternalClient client) { if (client == null || client.getConfig() == null) { throw new IllegalArgumentException("client and config must not be null"); } return buildExceptionMessage( baseMessage, client.getConfig().getDeviceId(), client.getConfig().getProtocol().toString(), client.getConfig().getIotHubHostname(), client.getConfig().getModuleId()); }
public static String buildExceptionMessage(String baseMessage, Collection<InternalClient> clients) { String hostname = ""; String protocol = ""; Collection<String> deviceIds = new ArrayList<>(); Collection<String> moduleIds = new ArrayList<>(); for (InternalClient client : clients) { hostname = client.getConfig().getIotHubHostname(); protocol = client.getConfig().getProtocol().toString(); deviceIds.add(client.getConfig().getDeviceId()); if (client.getConfig().getModuleId() != null && !client.getConfig().getModuleId().isEmpty()) { moduleIds.add(client.getConfig().getModuleId()); } } return buildExceptionMessage( baseMessage, deviceIds, protocol, hostname, moduleIds); }
public SendMessagesTestInstance(InternalClient client, IotHubClientProtocol protocol, BaseDevice identity, AuthenticationType authenticationType, ClientType clientType, String publicKeyCert, String privateKey, String x509Thumbprint) { this.client = client; this.protocol = protocol; this.identity = identity; this.authenticationType = authenticationType; this.clientType = clientType; this.publicKeyCert = publicKeyCert; this.privateKey = privateKey; this.x509Thumbprint = x509Thumbprint; String deviceId = ""; String moduleId = ""; if (identity instanceof Module) { deviceId = identity.getDeviceId(); moduleId = ((Module) identity).getId(); } else if (identity instanceof Device) { deviceId = identity.getDeviceId(); } this.correlationDetailsLoggingAssert = new CorrelationDetailsLoggingAssert(this.client.getConfig().getIotHubHostname(), deviceId, protocol.toString(), moduleId); } }