├── .editorconfig ├── .gitattributes ├── .github ├── CODEOWNERS ├── CODING_GUIDELINES.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── feature_request.md │ └── technical-question.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── cleanup.yml │ ├── github_issues.yml │ └── issuelabeler.yml ├── .gitignore ├── .idea ├── inspectionProfiles │ └── Project_Default.xml └── scopes │ └── OnlySDK.xml ├── LICENSE.txt ├── NOTICE ├── SDK v2 migration guide.md ├── SECURITY.md ├── configure_tls_protocol_version_and_ciphers.md ├── doc ├── Mqtt.vsdx ├── java-devbox-setup.md ├── media │ ├── add_requirement │ │ ├── add_requirement_step1.png │ │ ├── add_requirement_step2.png │ │ ├── add_requirement_step3.png │ │ └── add_requirement_step4.png │ └── docs-link-buttons │ │ ├── azure-documentation.svg │ │ ├── azure-how-to-guide.svg │ │ ├── azure-quickstart.svg │ │ └── azure-tutorial.svg └── settings │ ├── README.md │ └── settings.zip ├── iot-e2e-tests ├── android │ ├── AndroidDeviceSelect.py │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── android │ │ │ │ ├── digitaltwin │ │ │ │ ├── DigitalTwinClientAndroidRunner.java │ │ │ │ └── DigitalTwinClientComponentTestsAndroidRunner.java │ │ │ │ ├── helper │ │ │ │ ├── TestGroup1.java │ │ │ │ ├── TestGroup10.java │ │ │ │ ├── TestGroup11.java │ │ │ │ ├── TestGroup12.java │ │ │ │ ├── TestGroup2.java │ │ │ │ ├── TestGroup3.java │ │ │ │ ├── TestGroup4.java │ │ │ │ ├── TestGroup5.java │ │ │ │ ├── TestGroup6.java │ │ │ │ ├── TestGroup7.java │ │ │ │ ├── TestGroup8.java │ │ │ │ └── TestGroup9.java │ │ │ │ ├── iothub │ │ │ │ ├── FileUploadAndroidRunner.java │ │ │ │ ├── MultiplexingClientAndroidRunner.java │ │ │ │ ├── TokenRenewalAndroidRunner.java │ │ │ │ ├── connection │ │ │ │ │ └── ConnectionTestsAndroidRunner.java │ │ │ │ ├── errorinjection │ │ │ │ │ ├── DirectMethodsErrInjAndroidRunner.java │ │ │ │ │ ├── ReceiveMessagesErrInjAndroidRunner.java │ │ │ │ │ ├── SendMessagesErrInjAndroidRunner.java │ │ │ │ │ └── TwinErrInjAndroidRunner.java │ │ │ │ ├── messaging │ │ │ │ │ ├── ReceiveMessagesAndroidRunner.java │ │ │ │ │ └── SendMessagesAndroidRunner.java │ │ │ │ ├── methods │ │ │ │ │ └── DirectMethodsAndroidRunner.java │ │ │ │ └── twin │ │ │ │ │ └── TwinAndroidRunner.java │ │ │ │ └── provisioning │ │ │ │ ├── ProvisioningClientSymmetricKeyAndroidRunner.java │ │ │ │ ├── ProvisioningClientX509AndroidRunner.java │ │ │ │ └── ProvisioningServiceClientAndroidRunner.java │ │ │ └── main │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── renew_env.cmd │ ├── runInstrumentationTests.py │ ├── runTestsOnThings.cmd │ └── settings.gradle ├── common │ ├── pom.xml │ └── src │ │ └── test │ │ ├── java │ │ └── tests │ │ │ └── integration │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ ├── digitaltwin │ │ │ ├── DigitalTwinClientComponentTests.java │ │ │ ├── DigitalTwinClientTests.java │ │ │ └── helpers │ │ │ │ └── E2ETestConstants.java │ │ │ ├── helpers │ │ │ ├── BasicProxyAuthenticator.java │ │ │ ├── BulkMessagesAndResult.java │ │ │ ├── ClientType.java │ │ │ ├── CorrelationDetailsLoggingAssert.java │ │ │ ├── CustomObject.java │ │ │ ├── DeviceConnectionString.java │ │ │ ├── ErrorInjectionHelper.java │ │ │ ├── EventCallback.java │ │ │ ├── ExportImportDevicesParser.java │ │ │ ├── IntegrationTest.java │ │ │ ├── IotHubServicesCommon.java │ │ │ ├── MessageAndResult.java │ │ │ ├── NestedCustomObject.java │ │ │ ├── Rerun.java │ │ │ ├── SSLContextBuilder.java │ │ │ ├── SasTokenGenerator.java │ │ │ ├── SasTokenProviderImpl.java │ │ │ ├── SasTokenTools.java │ │ │ ├── Success.java │ │ │ ├── TestConstants.java │ │ │ ├── TestDeviceIdentity.java │ │ │ ├── TestIdentity.java │ │ │ ├── TestModuleIdentity.java │ │ │ ├── Tools.java │ │ │ ├── X509CertificateGenerator.java │ │ │ ├── annotations │ │ │ │ ├── BasicTierHubOnlyTest.java │ │ │ │ ├── ContinuousIntegrationTest.java │ │ │ │ ├── DeviceProvisioningServiceTest.java │ │ │ │ ├── DigitalTwinTest.java │ │ │ │ ├── ErrInjTest.java │ │ │ │ ├── FlakeyTest.java │ │ │ │ ├── IotHubTest.java │ │ │ │ ├── MultiplexingClientTest.java │ │ │ │ └── StandardTierHubOnlyTest.java │ │ │ ├── proxy │ │ │ │ ├── ActivityTracker.java │ │ │ │ ├── ActivityTrackerAdapter.java │ │ │ │ ├── ChainedProxy.java │ │ │ │ ├── ChainedProxyAdapter.java │ │ │ │ ├── ChainedProxyManager.java │ │ │ │ ├── DefaultHostResolver.java │ │ │ │ ├── FlowContext.java │ │ │ │ ├── FullFlowContext.java │ │ │ │ ├── HostResolver.java │ │ │ │ ├── HttpFilters.java │ │ │ │ ├── HttpFiltersAdapter.java │ │ │ │ ├── HttpFiltersSource.java │ │ │ │ ├── HttpFiltersSourceAdapter.java │ │ │ │ ├── HttpProxyServer.java │ │ │ │ ├── HttpProxyServerBootstrap.java │ │ │ │ ├── MitmManager.java │ │ │ │ ├── ProxyAuthenticator.java │ │ │ │ ├── SslEngineSource.java │ │ │ │ ├── TransportProtocol.java │ │ │ │ ├── UnknownTransportProtocolException.java │ │ │ │ ├── extras │ │ │ │ │ ├── SelfSignedMitmManager.java │ │ │ │ │ └── SelfSignedSslEngineSource.java │ │ │ │ ├── impl │ │ │ │ │ ├── CategorizedThreadFactory.java │ │ │ │ │ ├── ClientToProxyConnection.java │ │ │ │ │ ├── ConnectionFlow.java │ │ │ │ │ ├── ConnectionFlowStep.java │ │ │ │ │ ├── ConnectionState.java │ │ │ │ │ ├── DefaultHttpProxyServer.java │ │ │ │ │ ├── NetworkUtils.java │ │ │ │ │ ├── ProxyConnection.java │ │ │ │ │ ├── ProxyThreadPools.java │ │ │ │ │ ├── ProxyToServerConnection.java │ │ │ │ │ ├── ProxyUtils.java │ │ │ │ │ ├── ServerGroup.java │ │ │ │ │ └── ThreadPoolConfiguration.java │ │ │ │ └── readme.md │ │ │ └── rules │ │ │ │ ├── BasicTierHubOnlyTestRule.java │ │ │ │ ├── ContinuousIntegrationTestRule.java │ │ │ │ ├── DeviceProvisioningServiceTestRule.java │ │ │ │ ├── DigitalTwinTestRule.java │ │ │ │ ├── ErrInjTestRule.java │ │ │ │ ├── FlakeyTestRule.java │ │ │ │ ├── IotHubTestRule.java │ │ │ │ ├── MultiplexingClientTestRule.java │ │ │ │ ├── RerunFailedTestRule.java │ │ │ │ ├── StandardTierHubOnlyTestRule.java │ │ │ │ └── ThrottleResistantTestRule.java │ │ │ ├── iothub │ │ │ ├── FileUploadTests.java │ │ │ ├── MultiplexingClientTests.java │ │ │ ├── TokenRenewalTests.java │ │ │ ├── connection │ │ │ │ └── ConnectionTests.java │ │ │ ├── errorinjection │ │ │ │ ├── DirectMethodsErrInjTests.java │ │ │ │ ├── ReceiveMessagesErrInjTests.java │ │ │ │ ├── SendMessagesErrInjTests.java │ │ │ │ └── TwinErrInjTests.java │ │ │ ├── methods │ │ │ │ └── DirectMethodsTests.java │ │ │ ├── setup │ │ │ │ ├── DirectMethodsCommon.java │ │ │ │ ├── ReceiveMessagesCommon.java │ │ │ │ ├── SendMessagesCommon.java │ │ │ │ └── TwinCommon.java │ │ │ ├── telemetry │ │ │ │ ├── ReceiveMessagesTests.java │ │ │ │ └── SendMessagesTests.java │ │ │ └── twin │ │ │ │ └── TwinTests.java │ │ │ └── provisioning │ │ │ ├── ProvisioningServiceClientTests.java │ │ │ ├── ProvisioningTests.java │ │ │ └── setup │ │ │ └── ProvisioningCommon.java │ │ └── resources │ │ └── log4j2.properties ├── device-deletion-sample │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── samples │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ ├── DeviceDeletionSample.java │ │ └── ExportImportDevicesParser.java ├── docker │ ├── docker-setup.sh │ ├── haproxy │ │ ├── errors │ │ │ ├── 400.http │ │ │ ├── 403.http │ │ │ ├── 408.http │ │ │ ├── 500.http │ │ │ ├── 502.http │ │ │ ├── 503.http │ │ │ └── 504.http │ │ ├── haproxy.bin │ │ ├── haproxydps.cfg │ │ ├── haproxygde.cfg │ │ └── haproxyhub.cfg │ └── readme.md ├── edge-e2e │ ├── .swagger-codegen-ignore │ ├── .swagger-codegen │ │ └── VERSION │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ ├── com │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── e2e │ │ │ │ └── Main.java │ │ ├── glue │ │ │ ├── ModuleGlue.java │ │ │ ├── RegistryGlue.java │ │ │ ├── ServiceGlue.java │ │ │ └── WrapperGlue.java │ │ └── io │ │ │ └── swagger │ │ │ └── server │ │ │ └── api │ │ │ ├── MainApiException.java │ │ │ ├── MainApiVerticle.java │ │ │ ├── model │ │ │ ├── Certificate.java │ │ │ ├── ConnectResponse.java │ │ │ ├── MethodRequestResponse.java │ │ │ └── RoundtripMethodCallBody.java │ │ │ └── verticle │ │ │ ├── DeviceApi.java │ │ │ ├── DeviceApiException.java │ │ │ ├── DeviceApiImpl.java │ │ │ ├── DeviceApiVerticle.java │ │ │ ├── EventhubApi.java │ │ │ ├── EventhubApiException.java │ │ │ ├── EventhubApiVerticle.java │ │ │ ├── ModuleApi.java │ │ │ ├── ModuleApiException.java │ │ │ ├── ModuleApiImpl.java │ │ │ ├── ModuleApiVerticle.java │ │ │ ├── RegistryApi.java │ │ │ ├── RegistryApiException.java │ │ │ ├── RegistryApiImpl.java │ │ │ ├── RegistryApiVerticle.java │ │ │ ├── ServiceApi.java │ │ │ ├── ServiceApiException.java │ │ │ ├── ServiceApiImpl.java │ │ │ ├── ServiceApiVerticle.java │ │ │ ├── WrappedTwin.java │ │ │ ├── WrapperApi.java │ │ │ ├── WrapperApiException.java │ │ │ ├── WrapperApiImpl.java │ │ │ └── WrapperApiVerticle.java │ │ └── resources │ │ └── swagger.json ├── iot-e2e-jvm-tests │ ├── pom.xml │ └── src │ │ └── test │ │ ├── java │ │ └── tests │ │ │ └── integration │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ ├── ProvisioningTPMTests.java │ │ │ └── Tools.java │ │ └── resources │ │ └── log4j2.properties └── pom.xml ├── iothub ├── device │ ├── iot-device-client │ │ ├── devdoc │ │ │ └── requirement_docs │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── iothub │ │ │ │ ├── retryPolicy.md │ │ │ │ └── transport │ │ │ │ └── transportExceptions.md │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── device │ │ │ │ │ ├── BatchMessage.java │ │ │ │ │ ├── ClientConfiguration.java │ │ │ │ │ ├── ClientOptions.java │ │ │ │ │ ├── ConnectionStatusChangeContext.java │ │ │ │ │ ├── CorrelatingMessageCallback.java │ │ │ │ │ ├── DeviceClient.java │ │ │ │ │ ├── DeviceClientType.java │ │ │ │ │ ├── DeviceIO.java │ │ │ │ │ ├── FileUpload.java │ │ │ │ │ ├── FileUploadCompletionNotification.java │ │ │ │ │ ├── FileUploadSasUriRequest.java │ │ │ │ │ ├── FileUploadSasUriResponse.java │ │ │ │ │ ├── InternalClient.java │ │ │ │ │ ├── IotHubClientProtocol.java │ │ │ │ │ ├── IotHubConnectionStatusChangeCallback.java │ │ │ │ │ ├── IotHubConnectionStatusChangeReason.java │ │ │ │ │ ├── IotHubConnectionString.java │ │ │ │ │ ├── IotHubMessageResult.java │ │ │ │ │ ├── IotHubStatusCode.java │ │ │ │ │ ├── Message.java │ │ │ │ │ ├── MessageCallback.java │ │ │ │ │ ├── MessageProperty.java │ │ │ │ │ ├── MessageSentCallback.java │ │ │ │ │ ├── MessageType.java │ │ │ │ │ ├── MessagesSentCallback.java │ │ │ │ │ ├── ModuleClient.java │ │ │ │ │ ├── MultiplexingClient.java │ │ │ │ │ ├── MultiplexingClientOptions.java │ │ │ │ │ ├── ProductInfo.java │ │ │ │ │ ├── ProxySettings.java │ │ │ │ │ ├── SasTokenProvider.java │ │ │ │ │ ├── auth │ │ │ │ │ ├── IotHubAuthenticationProvider.java │ │ │ │ │ ├── IotHubSSLContext.java │ │ │ │ │ ├── IotHubSasToken.java │ │ │ │ │ ├── IotHubSasTokenAuthenticationProvider.java │ │ │ │ │ ├── IotHubSasTokenHardwareAuthenticationProvider.java │ │ │ │ │ ├── IotHubSasTokenProvidedAuthenticationProvider.java │ │ │ │ │ ├── IotHubSasTokenSoftwareAuthenticationProvider.java │ │ │ │ │ ├── IotHubSasTokenWithRefreshAuthenticationProvider.java │ │ │ │ │ ├── IotHubX509HardwareAuthenticationProvider.java │ │ │ │ │ ├── IotHubX509SoftwareAuthenticationProvider.java │ │ │ │ │ ├── Signature.java │ │ │ │ │ ├── SignatureHelper.java │ │ │ │ │ ├── SignatureProvider.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── edge │ │ │ │ │ ├── DirectMethodRequest.java │ │ │ │ │ ├── DirectMethodResponse.java │ │ │ │ │ ├── HttpsHsmTrustBundleProvider.java │ │ │ │ │ └── TrustBundleProvider.java │ │ │ │ │ ├── exceptions │ │ │ │ │ ├── IotHubClientException.java │ │ │ │ │ └── MultiplexingClientRegistrationException.java │ │ │ │ │ ├── hsm │ │ │ │ │ ├── HttpHsmSignatureProvider.java │ │ │ │ │ ├── HttpsHsmClient.java │ │ │ │ │ ├── HttpsRequestResponseSerializer.java │ │ │ │ │ ├── IotHubSasTokenHsmAuthenticationProvider.java │ │ │ │ │ ├── UnixDomainSocketChannel.java │ │ │ │ │ └── parser │ │ │ │ │ │ ├── ErrorResponse.java │ │ │ │ │ │ ├── SignRequest.java │ │ │ │ │ │ ├── SignResponse.java │ │ │ │ │ │ └── TrustBundleResponse.java │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── transport │ │ │ │ │ ├── CorrelationCallbackContext.java │ │ │ │ │ ├── ExponentialBackoffWithJitter.java │ │ │ │ │ ├── HttpProxySocketFactory.java │ │ │ │ │ ├── IotHubConnectionStatus.java │ │ │ │ │ ├── IotHubListener.java │ │ │ │ │ ├── IotHubReceiveTask.java │ │ │ │ │ ├── IotHubReconnectTask.java │ │ │ │ │ ├── IotHubSendTask.java │ │ │ │ │ ├── IotHubServiceException.java │ │ │ │ │ ├── IotHubTransport.java │ │ │ │ │ ├── IotHubTransportConnection.java │ │ │ │ │ ├── IotHubTransportMessage.java │ │ │ │ │ ├── IotHubTransportPacket.java │ │ │ │ │ ├── MultiplexedDeviceState.java │ │ │ │ │ ├── MultiplexingDeviceUnauthorizedException.java │ │ │ │ │ ├── NoRetry.java │ │ │ │ │ ├── ProtocolException.java │ │ │ │ │ ├── ProxiedSSLSocket.java │ │ │ │ │ ├── RetryDecision.java │ │ │ │ │ ├── RetryPolicy.java │ │ │ │ │ ├── TransportException.java │ │ │ │ │ ├── TransportUtils.java │ │ │ │ │ ├── amqps │ │ │ │ │ │ ├── AmqpsCbsReceiverLinkHandler.java │ │ │ │ │ │ ├── AmqpsCbsSenderLinkHandler.java │ │ │ │ │ │ ├── AmqpsCbsSessionHandler.java │ │ │ │ │ │ ├── AmqpsExceptionTranslator.java │ │ │ │ │ │ ├── AmqpsIotHubConnection.java │ │ │ │ │ │ ├── AmqpsLinkStateCallback.java │ │ │ │ │ │ ├── AmqpsMessage.java │ │ │ │ │ │ ├── AmqpsMethodsReceiverLinkHandler.java │ │ │ │ │ │ ├── AmqpsMethodsSenderLinkHandler.java │ │ │ │ │ │ ├── AmqpsReceiverLinkHandler.java │ │ │ │ │ │ ├── AmqpsSasTokenRenewalHandler.java │ │ │ │ │ │ ├── AmqpsSendResult.java │ │ │ │ │ │ ├── AmqpsSenderLinkHandler.java │ │ │ │ │ │ ├── AmqpsSessionHandler.java │ │ │ │ │ │ ├── AmqpsSessionStateCallback.java │ │ │ │ │ │ ├── AmqpsTelemetryReceiverLinkHandler.java │ │ │ │ │ │ ├── AmqpsTelemetrySenderLinkHandler.java │ │ │ │ │ │ ├── AmqpsTwinReceiverLinkHandler.java │ │ │ │ │ │ ├── AmqpsTwinSenderLinkHandler.java │ │ │ │ │ │ ├── AuthenticationMessageCallback.java │ │ │ │ │ │ ├── LoggingFlowController.java │ │ │ │ │ │ ├── ReactorRunner.java │ │ │ │ │ │ ├── ReactorRunnerStateCallback.java │ │ │ │ │ │ ├── SendResult.java │ │ │ │ │ │ ├── SubscriptionType.java │ │ │ │ │ │ ├── exceptions │ │ │ │ │ │ │ ├── AmqpConnectionForcedException.java │ │ │ │ │ │ │ ├── AmqpConnectionFramingErrorException.java │ │ │ │ │ │ │ ├── AmqpConnectionRedirectException.java │ │ │ │ │ │ │ ├── AmqpConnectionThrottledException.java │ │ │ │ │ │ │ ├── AmqpDecodeErrorException.java │ │ │ │ │ │ │ ├── AmqpFrameSizeTooSmallException.java │ │ │ │ │ │ │ ├── AmqpIllegalStateException.java │ │ │ │ │ │ │ ├── AmqpInternalErrorException.java │ │ │ │ │ │ │ ├── AmqpInvalidFieldException.java │ │ │ │ │ │ │ ├── AmqpLinkCreationConflict.java │ │ │ │ │ │ │ ├── AmqpLinkDetachForcedException.java │ │ │ │ │ │ │ ├── AmqpLinkMessageSizeExceededException.java │ │ │ │ │ │ │ ├── AmqpLinkRedirectException.java │ │ │ │ │ │ │ ├── AmqpLinkStolenException.java │ │ │ │ │ │ │ ├── AmqpLinkTransferLimitExceededException.java │ │ │ │ │ │ │ ├── AmqpNotAllowedException.java │ │ │ │ │ │ │ ├── AmqpNotFoundException.java │ │ │ │ │ │ │ ├── AmqpNotImplementedException.java │ │ │ │ │ │ │ ├── AmqpPreconditionFailedException.java │ │ │ │ │ │ │ ├── AmqpResourceDeletedException.java │ │ │ │ │ │ │ ├── AmqpResourceLimitExceededException.java │ │ │ │ │ │ │ ├── AmqpResourceLockedException.java │ │ │ │ │ │ │ ├── AmqpSessionErrantLinkException.java │ │ │ │ │ │ │ ├── AmqpSessionHandleInUseException.java │ │ │ │ │ │ │ ├── AmqpSessionUnattachedHandleException.java │ │ │ │ │ │ │ ├── AmqpSessionWindowViolationException.java │ │ │ │ │ │ │ ├── AmqpUnauthorizedAccessException.java │ │ │ │ │ │ │ └── ProtonIOException.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── https │ │ │ │ │ │ ├── HttpsBatchMessage.java │ │ │ │ │ │ ├── HttpsConnection.java │ │ │ │ │ │ ├── HttpsIotHubConnection.java │ │ │ │ │ │ ├── HttpsMessage.java │ │ │ │ │ │ ├── HttpsMethod.java │ │ │ │ │ │ ├── HttpsRequest.java │ │ │ │ │ │ ├── HttpsResponse.java │ │ │ │ │ │ ├── HttpsSingleMessage.java │ │ │ │ │ │ ├── HttpsTransportManager.java │ │ │ │ │ │ ├── IotHubAbandonUri.java │ │ │ │ │ │ ├── IotHubCompleteUri.java │ │ │ │ │ │ ├── IotHubEventUri.java │ │ │ │ │ │ ├── IotHubMessageUri.java │ │ │ │ │ │ ├── IotHubRejectUri.java │ │ │ │ │ │ ├── IotHubUri.java │ │ │ │ │ │ ├── exceptions │ │ │ │ │ │ │ ├── BadFormatException.java │ │ │ │ │ │ │ ├── HubOrDeviceIdNotFoundException.java │ │ │ │ │ │ │ ├── InternalServerErrorException.java │ │ │ │ │ │ │ ├── PreconditionFailedException.java │ │ │ │ │ │ │ ├── QuotaExceededException.java │ │ │ │ │ │ │ ├── RequestEntityTooLargeException.java │ │ │ │ │ │ │ ├── ServerBusyException.java │ │ │ │ │ │ │ ├── ServiceUnknownException.java │ │ │ │ │ │ │ ├── ThrottledException.java │ │ │ │ │ │ │ └── UnauthorizedException.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── mqtt │ │ │ │ │ │ ├── Mqtt.java │ │ │ │ │ │ ├── MqttDirectMethod.java │ │ │ │ │ │ ├── MqttIotHubConnection.java │ │ │ │ │ │ ├── MqttMessageListener.java │ │ │ │ │ │ ├── MqttMessaging.java │ │ │ │ │ │ ├── MqttTwin.java │ │ │ │ │ │ ├── Socks5SocketFactory.java │ │ │ │ │ │ ├── TopicParser.java │ │ │ │ │ │ └── exceptions │ │ │ │ │ │ │ ├── MqttBadUsernameOrPasswordException.java │ │ │ │ │ │ │ ├── MqttIdentifierRejectedException.java │ │ │ │ │ │ │ ├── MqttRejectedProtocolVersionException.java │ │ │ │ │ │ │ ├── MqttServerUnavailableException.java │ │ │ │ │ │ │ ├── MqttUnauthorizedException.java │ │ │ │ │ │ │ ├── MqttUnexpectedErrorException.java │ │ │ │ │ │ │ └── PahoExceptionTranslator.java │ │ │ │ │ └── package-info.java │ │ │ │ │ └── twin │ │ │ │ │ ├── DesiredPropertiesCallback.java │ │ │ │ │ ├── DeviceOperations.java │ │ │ │ │ ├── DeviceTwin.java │ │ │ │ │ ├── DirectMethod.java │ │ │ │ │ ├── DirectMethodPayload.java │ │ │ │ │ ├── DirectMethodResponse.java │ │ │ │ │ ├── GetTwinCallback.java │ │ │ │ │ ├── GetTwinCorrelatingMessageCallback.java │ │ │ │ │ ├── MethodCallback.java │ │ │ │ │ ├── MethodParser.java │ │ │ │ │ ├── Pair.java │ │ │ │ │ ├── ParserUtility.java │ │ │ │ │ ├── Property.java │ │ │ │ │ ├── ReportedPropertiesCallback.java │ │ │ │ │ ├── ReportedPropertiesUpdateCorrelatingMessageCallback.java │ │ │ │ │ ├── ReportedPropertiesUpdateResponse.java │ │ │ │ │ ├── SubscriptionAcknowledgedCallback.java │ │ │ │ │ ├── Tools.java │ │ │ │ │ ├── Twin.java │ │ │ │ │ ├── TwinCollection.java │ │ │ │ │ ├── TwinGsonBuilder.java │ │ │ │ │ ├── TwinMetadata.java │ │ │ │ │ └── TwinProperties.java │ │ │ └── resources │ │ │ │ └── iothub-device-client.properties │ │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ └── device │ │ │ ├── ClientConfigurationTest.java │ │ │ ├── DeviceClientTest.java │ │ │ ├── DeviceIOTest.java │ │ │ ├── FileUploadCompletionNotificationTest.java │ │ │ ├── FileUploadSasUriRequestTest.java │ │ │ ├── FileUploadSasUriResponseTest.java │ │ │ ├── FileUploadTest.java │ │ │ ├── Helpers.java │ │ │ ├── InternalClientTest.java │ │ │ ├── IotHubConnectionStringTest.java │ │ │ ├── IotHubStatusCodeTest.java │ │ │ ├── MessagePropertyTest.java │ │ │ ├── MessageTest.java │ │ │ ├── ModuleClientTest.java │ │ │ ├── ProductInfoTest.java │ │ │ ├── ProxySettingsTest.java │ │ │ ├── auth │ │ │ ├── IotHubAuthenticationProviderTest.java │ │ │ ├── IotHubSSLContextParsingTest.java │ │ │ ├── IotHubSSLContextTest.java │ │ │ ├── IotHubSasTokenAuthenticationProviderTest.java │ │ │ ├── IotHubSasTokenHardwareAuthenticationProviderTest.java │ │ │ ├── IotHubSasTokenSoftwareIotHubAuthenticationProviderTest.java │ │ │ ├── IotHubSasTokenTest.java │ │ │ ├── IotHubSasTokenWithRefreshAuthenticationProviderTest.java │ │ │ ├── IotHubX509HardwareIotHubAuthenticationProviderTest.java │ │ │ ├── IotHubX509SoftwareIotHubAuthenticationProviderTest.java │ │ │ ├── SignatureHelperTest.java │ │ │ └── SignatureTest.java │ │ │ ├── edge │ │ │ ├── DirectMethodRequestTest.java │ │ │ ├── DirectMethodResponseTest.java │ │ │ └── HttpsHsmTrustBundleProviderTest.java │ │ │ ├── hsm │ │ │ ├── HttpHsmSignatureProviderTest.java │ │ │ ├── HttpsHsmClientTest.java │ │ │ ├── HttpsRequestResponseSerializerTest.java │ │ │ ├── IotHubSasTokenHsmAuthenticationProviderTest.java │ │ │ └── parser │ │ │ │ ├── ErrorResponseTest.java │ │ │ │ ├── SignRequestTest.java │ │ │ │ ├── SignResponseTest.java │ │ │ │ └── TrustBundleResponseTest.java │ │ │ ├── transport │ │ │ ├── ExponentialBackoffWithJitterTest.java │ │ │ ├── IotHubReceiveTaskTest.java │ │ │ ├── IotHubSendTaskTest.java │ │ │ ├── IotHubTransportMessageTest.java │ │ │ ├── IotHubTransportPacketTest.java │ │ │ ├── IotHubTransportTest.java │ │ │ ├── NoRetryTest.java │ │ │ ├── RetryDecisionTest.java │ │ │ ├── amqps │ │ │ │ ├── AmqpsIotHubConnectionTest.java │ │ │ │ └── AmqpsSendResultTest.java │ │ │ ├── https │ │ │ │ ├── HttpsBatchMessageTest.java │ │ │ │ ├── HttpsConnectionTest.java │ │ │ │ ├── HttpsIotHubConnectionTest.java │ │ │ │ ├── HttpsRequestTest.java │ │ │ │ ├── HttpsResponseTest.java │ │ │ │ ├── HttpsSingleMessageTest.java │ │ │ │ ├── HttpsTransportManagerTest.java │ │ │ │ ├── IotHubAbandonUriTest.java │ │ │ │ ├── IotHubCompleteUriTest.java │ │ │ │ ├── IotHubEventUriTest.java │ │ │ │ ├── IotHubMessageUriTest.java │ │ │ │ ├── IotHubRejectUriTest.java │ │ │ │ └── IotHubUriTest.java │ │ │ └── mqtt │ │ │ │ ├── MqttDirectMethodTest.java │ │ │ │ ├── MqttIotHubConnectionTest.java │ │ │ │ ├── MqttMessagingTest.java │ │ │ │ ├── MqttTest.java │ │ │ │ ├── MqttTwinTest.java │ │ │ │ ├── TopicParserTest.java │ │ │ │ └── exceptions │ │ │ │ └── PahoExceptionTranslatorTest.java │ │ │ └── twin │ │ │ ├── DeviceTwinMessageTest.java │ │ │ ├── DirectMethodMessageTest.java │ │ │ ├── DirectMethodResponseTest.java │ │ │ ├── DirectMethodTest.java │ │ │ ├── PairTest.java │ │ │ └── PropertyTest.java │ ├── iot-device-samples │ │ ├── android-sample │ │ │ ├── app │ │ │ │ ├── build.gradle │ │ │ │ ├── proguard-rules.pro │ │ │ │ └── src │ │ │ │ │ └── main │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── iothub │ │ │ │ │ │ └── azure │ │ │ │ │ │ └── microsoft │ │ │ │ │ │ └── com │ │ │ │ │ │ └── androidsample │ │ │ │ │ │ └── MainActivity.java │ │ │ │ │ └── res │ │ │ │ │ ├── layout │ │ │ │ │ └── activity_main.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values-w820dp │ │ │ │ │ └── dimens.xml │ │ │ │ │ └── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── dimens.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── styles.xml │ │ │ ├── build.gradle │ │ │ └── settings.gradle │ │ ├── custom-sas-token-provider-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── CustomSasTokenProviderSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── device-reconnection-sample │ │ │ ├── pom.xml │ │ │ ├── readme.md │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ ├── DeviceClientManager.java │ │ │ │ │ ├── DeviceClientManagerSample.java │ │ │ │ │ └── SampleParameters.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── device-twin-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── DeviceTwinSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── direct-method-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── DirectMethodSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── file-upload-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ ├── FileUploadSample.java │ │ │ │ │ └── FileUploadSimpleSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── handle-messages │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── HandleMessages.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── module-invoke-method-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── ModuleInvokeMethodSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── module-method-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── ModuleMethodSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── module-twin-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── ModuleTwinSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── multiplexing-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ ├── ClientManagerBase.java │ │ │ │ │ ├── ConnectionStatus.java │ │ │ │ │ ├── ConnectionStatusTracker.java │ │ │ │ │ ├── DeviceClientManager.java │ │ │ │ │ ├── MultiplexingClientManager.java │ │ │ │ │ └── MultiplexingSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── pnp-device-sample │ │ │ ├── pom.xml │ │ │ ├── readme.md │ │ │ ├── temperature-controller-device-sample │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ │ ├── main │ │ │ │ │ ├── java │ │ │ │ │ │ └── samples │ │ │ │ │ │ │ └── com │ │ │ │ │ │ │ └── microsoft │ │ │ │ │ │ │ └── azure │ │ │ │ │ │ │ └── sdk │ │ │ │ │ │ │ └── iot │ │ │ │ │ │ │ └── device │ │ │ │ │ │ │ ├── PnpConvention.java │ │ │ │ │ │ │ ├── TemperatureController.java │ │ │ │ │ │ │ └── WritablePropertyResponse.java │ │ │ │ │ └── resources │ │ │ │ │ │ ├── TemperatureController.json │ │ │ │ │ │ ├── Thermostat.json │ │ │ │ │ │ ├── Thermostat2.json │ │ │ │ │ │ └── log4j2.properties │ │ │ │ │ └── test │ │ │ │ │ └── java │ │ │ │ │ └── tests │ │ │ │ │ └── unit │ │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── device │ │ │ │ │ └── PnpConventionTests.java │ │ │ └── thermostat-device-sample │ │ │ │ ├── pom.xml │ │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── device │ │ │ │ │ └── Thermostat.java │ │ │ │ └── resources │ │ │ │ ├── Thermostat.json │ │ │ │ └── log4j2.properties │ │ ├── pom.xml │ │ ├── readme.md │ │ ├── send-batch-events │ │ │ ├── README.md │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── SendBatchEvents.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── send-event-with-proxy │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── SendEventWithProxy.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── send-event-x509 │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ ├── SSLContextBuilder.java │ │ │ │ │ └── SendEventX509.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── send-event │ │ │ ├── README.md │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ ├── InputParameters.java │ │ │ │ │ └── SendEvent.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── send-receive-module-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── SendReceiveModuleSample.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── send-receive-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── SendReceive.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ ├── send-receive-x509-sample │ │ │ ├── pom.xml │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── java │ │ │ │ └── samples │ │ │ │ │ └── com │ │ │ │ │ └── microsoft │ │ │ │ │ └── azure │ │ │ │ │ └── sdk │ │ │ │ │ └── iot │ │ │ │ │ └── SendReceiveX509.java │ │ │ │ └── resources │ │ │ │ └── log4j2.properties │ │ └── unix-domain-socket-sample │ │ │ ├── README.md │ │ │ ├── pom.xml │ │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── samples │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── UnixDomainSocketSample.java │ │ │ └── resources │ │ │ └── log4j2.properties │ ├── pom.xml │ └── readme.md └── pom.xml ├── logging.md ├── lts_branches.png ├── pom.xml ├── provisioning ├── pom.xml ├── provisioning-device-client-samples │ ├── pom.xml │ ├── provisioning-X509-sample │ │ ├── pom.xml │ │ ├── readme.md │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── samples │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── ProvisioningX509Sample.java │ │ │ └── resources │ │ │ └── log4j2.properties │ ├── provisioning-symmetrickey-group-sample │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── samples │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ ├── ComputeDerivedSymmetricKeySample.java │ │ │ │ └── ProvisioningSymmetricKeyEnrollmentGroupSample.java │ │ │ └── resources │ │ │ └── log4j2.properties │ ├── provisioning-symmetrickey-individual-sample │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── samples │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── ProvisioningSymmetricKeyIndividualEnrollmentSample.java │ │ │ └── resources │ │ │ └── log4j2.properties │ ├── provisioning-tpm-sample │ │ ├── pom.xml │ │ ├── readme.md │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── samples │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── ProvisioningTpmSample.java │ │ │ └── resources │ │ │ └── log4j2.properties │ └── readme.md ├── provisioning-device-client │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── provisioning │ │ │ │ └── device │ │ │ │ ├── AdditionalData.java │ │ │ │ ├── ProvisioningDeviceClient.java │ │ │ │ ├── ProvisioningDeviceClientRegistrationCallback.java │ │ │ │ ├── ProvisioningDeviceClientRegistrationResult.java │ │ │ │ ├── ProvisioningDeviceClientStatus.java │ │ │ │ ├── ProvisioningDeviceClientSubstatus.java │ │ │ │ ├── ProvisioningDeviceClientTransportProtocol.java │ │ │ │ ├── internal │ │ │ │ ├── ObjectLock.java │ │ │ │ ├── ProvisioningDeviceClientConfig.java │ │ │ │ ├── SDKUtils.java │ │ │ │ ├── contract │ │ │ │ │ ├── ProvisioningDeviceClientContract.java │ │ │ │ │ ├── ResponseCallback.java │ │ │ │ │ ├── UrlPathBuilder.java │ │ │ │ │ ├── amqp │ │ │ │ │ │ ├── AmqpsProvisioningSaslHandler.java │ │ │ │ │ │ ├── AmqpsProvisioningSymmetricKeySaslHandler.java │ │ │ │ │ │ ├── ContractAPIAmqp.java │ │ │ │ │ │ └── ProvisioningAmqpOperations.java │ │ │ │ │ ├── http │ │ │ │ │ │ └── ContractAPIHttp.java │ │ │ │ │ └── mqtt │ │ │ │ │ │ └── ContractAPIMqtt.java │ │ │ │ ├── exceptions │ │ │ │ │ ├── ProvisioningDeviceClientAuthenticationException.java │ │ │ │ │ ├── ProvisioningDeviceClientException.java │ │ │ │ │ ├── ProvisioningDeviceClientExceptionManager.java │ │ │ │ │ ├── ProvisioningDeviceConnectionException.java │ │ │ │ │ ├── ProvisioningDeviceHubException.java │ │ │ │ │ ├── ProvisioningDeviceSecurityException.java │ │ │ │ │ └── ProvisioningDeviceTransportException.java │ │ │ │ ├── parser │ │ │ │ │ ├── DeviceRegistrationParser.java │ │ │ │ │ ├── DeviceRegistrationResultParser.java │ │ │ │ │ ├── ProvisioningErrorParser.java │ │ │ │ │ ├── RegistrationOperationStatusParser.java │ │ │ │ │ ├── TpmRegistrationResultParser.java │ │ │ │ │ └── X509RegistrationResultParser.java │ │ │ │ └── task │ │ │ │ │ ├── Authorization.java │ │ │ │ │ ├── ContractState.java │ │ │ │ │ ├── ProvisioningStatus.java │ │ │ │ │ ├── ProvisioningTask.java │ │ │ │ │ ├── RegisterTask.java │ │ │ │ │ ├── RegistrationResult.java │ │ │ │ │ ├── RequestData.java │ │ │ │ │ ├── ResponseData.java │ │ │ │ │ └── StatusTask.java │ │ │ │ ├── plugandplay │ │ │ │ └── PnpHelper.java │ │ │ │ └── transport │ │ │ │ ├── amqp │ │ │ │ ├── AmqpDeviceOperations.java │ │ │ │ ├── AmqpListener.java │ │ │ │ ├── AmqpMessage.java │ │ │ │ ├── AmqpReactor.java │ │ │ │ ├── AmqpsConnection.java │ │ │ │ ├── AmqpsMessage.java │ │ │ │ ├── ErrorLoggingBaseHandler.java │ │ │ │ ├── ErrorLoggingBaseHandlerWithCleanup.java │ │ │ │ ├── ProtonJExceptionParser.java │ │ │ │ ├── SaslHandler.java │ │ │ │ └── SaslListenerImpl.java │ │ │ │ ├── https │ │ │ │ ├── HttpConnection.java │ │ │ │ ├── HttpMessage.java │ │ │ │ ├── HttpMethod.java │ │ │ │ ├── HttpRequest.java │ │ │ │ └── HttpResponse.java │ │ │ │ └── mqtt │ │ │ │ ├── MqttConnection.java │ │ │ │ ├── MqttListener.java │ │ │ │ ├── MqttMessage.java │ │ │ │ └── MqttQos.java │ │ └── resources │ │ │ └── provisioning-device-client.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ └── provisioning │ │ └── device │ │ ├── AdditionalDataTest.java │ │ ├── ProvisioningDeviceClientRegistrationResultTest.java │ │ ├── ProvisioningDeviceClientTest.java │ │ ├── internal │ │ ├── ProvisioningDeviceClientConfigTest.java │ │ ├── contract │ │ │ ├── ProvisioningDeviceClientContractTest.java │ │ │ ├── UrlPathBuilderTest.java │ │ │ ├── amqp │ │ │ │ ├── AmqpsProvisioningSaslHandlerTest.java │ │ │ │ ├── AmqpsProvisioningSymmetricKeySaslHandlerTest.java │ │ │ │ ├── ContractAPIAmqpTest.java │ │ │ │ └── ProvisioningAmqpOperationsTest.java │ │ │ ├── http │ │ │ │ └── ContractAPIHttpTest.java │ │ │ └── mqtt │ │ │ │ └── ContractAPIMqttTest.java │ │ ├── parser │ │ │ ├── DeviceRegistrationParserTest.java │ │ │ ├── DeviceRegistrationResultParserTest.java │ │ │ ├── ProvisioningErrorParserTest.java │ │ │ └── RegistrationOperationStatusParserTest.java │ │ └── task │ │ │ ├── AuthorizationTest.java │ │ │ ├── ProvisioningStatusTest.java │ │ │ ├── ProvisioningTaskTest.java │ │ │ ├── RegisterTaskTest.java │ │ │ ├── RegistrationInfoTest.java │ │ │ ├── RequestDataTest.java │ │ │ ├── ResponseDataTest.java │ │ │ └── StatusTaskTest.java │ │ └── transport │ │ ├── amqp │ │ ├── AmqpConnectionTest.java │ │ ├── AmqpDeviceOperationsTest.java │ │ ├── AmqpMessageTest.java │ │ ├── AmqpReactorTest.java │ │ ├── AmqpsMessageTest.java │ │ ├── ErrorLoggingBaseHandlerTest.java │ │ ├── ErrorLoggingBaseHandlerWithCleanupTest.java │ │ ├── ProtonJExceptionParserTest.java │ │ └── SaslListenerImplTest.java │ │ ├── https │ │ ├── HttpConnectionTest.java │ │ ├── HttpsRequestTest.java │ │ └── HttpsResponseTest.java │ │ └── mqtt │ │ ├── MqttConnectionTest.java │ │ └── MqttMessageTest.java ├── provisioning-service-client-samples │ ├── pom.xml │ ├── service-bulkoperation-sample │ │ ├── pom.xml │ │ ├── readme.md │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── samples │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── ServiceBulkOperationSample.java │ │ │ └── resources │ │ │ └── log4j2.properties │ ├── service-enrollment-group-sample │ │ ├── pom.xml │ │ ├── readme.md │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── samples │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── ServiceEnrollmentGroupSample.java │ │ │ └── resources │ │ │ └── log4j2.properties │ ├── service-enrollment-sample │ │ ├── pom.xml │ │ ├── readme.md │ │ └── src │ │ │ └── main │ │ │ ├── java │ │ │ └── samples │ │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── ServiceEnrollmentSample.java │ │ │ └── resources │ │ │ └── log4j2.properties │ └── service-update-enrollment-sample │ │ ├── pom.xml │ │ ├── readme.md │ │ └── src │ │ └── main │ │ ├── java │ │ └── samples │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ └── ServiceUpdateEnrollmentSample.java │ │ └── resources │ │ └── log4j2.properties ├── provisioning-service-client │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── microsoft │ │ │ │ └── azure │ │ │ │ └── sdk │ │ │ │ └── iot │ │ │ │ └── provisioning │ │ │ │ └── service │ │ │ │ ├── EnrollmentGroupManager.java │ │ │ │ ├── IndividualEnrollmentManager.java │ │ │ │ ├── ProvisioningServiceClient.java │ │ │ │ ├── Query.java │ │ │ │ ├── RegistrationStatusManager.java │ │ │ │ ├── Tools.java │ │ │ │ ├── auth │ │ │ │ ├── AuthenticationMethod.java │ │ │ │ ├── ProvisioningConnectionString.java │ │ │ │ ├── ProvisioningConnectionStringBuilder.java │ │ │ │ ├── ProvisioningSasToken.java │ │ │ │ ├── ServiceAuthenticationWithSharedAccessPolicyKey.java │ │ │ │ ├── ServiceAuthenticationWithSharedAccessPolicyToken.java │ │ │ │ └── Tools.java │ │ │ │ ├── configs │ │ │ │ ├── AllocationPolicy.java │ │ │ │ ├── Attestation.java │ │ │ │ ├── AttestationMechanism.java │ │ │ │ ├── AttestationMechanismType.java │ │ │ │ ├── BulkEnrollmentOperation.java │ │ │ │ ├── BulkEnrollmentOperationError.java │ │ │ │ ├── BulkEnrollmentOperationResult.java │ │ │ │ ├── BulkOperationMode.java │ │ │ │ ├── CustomAllocationDefinition.java │ │ │ │ ├── DeviceCapabilities.java │ │ │ │ ├── DeviceRegistrationState.java │ │ │ │ ├── EnrollmentGroup.java │ │ │ │ ├── EnrollmentStatus.java │ │ │ │ ├── IndividualEnrollment.java │ │ │ │ ├── ParserUtility.java │ │ │ │ ├── ProvisioningStatus.java │ │ │ │ ├── QueryResult.java │ │ │ │ ├── QueryResultType.java │ │ │ │ ├── QuerySpecification.java │ │ │ │ ├── QuerySpecificationBuilder.java │ │ │ │ ├── ReprovisionPolicy.java │ │ │ │ ├── Serializable.java │ │ │ │ ├── SymmetricKeyAttestation.java │ │ │ │ ├── TpmAttestation.java │ │ │ │ ├── TwinCollection.java │ │ │ │ ├── TwinMetadata.java │ │ │ │ ├── TwinProperties.java │ │ │ │ ├── TwinState.java │ │ │ │ ├── X509Attestation.java │ │ │ │ ├── X509CAReferences.java │ │ │ │ ├── X509CertificateInfo.java │ │ │ │ ├── X509CertificateWithInfo.java │ │ │ │ └── X509Certificates.java │ │ │ │ ├── contract │ │ │ │ ├── ContractApiHttp.java │ │ │ │ └── SDKUtils.java │ │ │ │ ├── exceptions │ │ │ │ ├── ErrorMessageParser.java │ │ │ │ ├── ProvisioningServiceClientBadFormatException.java │ │ │ │ ├── ProvisioningServiceClientBadUsageException.java │ │ │ │ ├── ProvisioningServiceClientException.java │ │ │ │ ├── ProvisioningServiceClientExceptionManager.java │ │ │ │ ├── ProvisioningServiceClientInternalServerErrorException.java │ │ │ │ ├── ProvisioningServiceClientNotFoundException.java │ │ │ │ ├── ProvisioningServiceClientPreconditionFailedException.java │ │ │ │ ├── ProvisioningServiceClientServiceException.java │ │ │ │ ├── ProvisioningServiceClientTooManyRequestsException.java │ │ │ │ ├── ProvisioningServiceClientTransientException.java │ │ │ │ ├── ProvisioningServiceClientTransportException.java │ │ │ │ ├── ProvisioningServiceClientUnathorizedException.java │ │ │ │ └── ProvisioningServiceClientUnknownException.java │ │ │ │ └── transport │ │ │ │ └── https │ │ │ │ ├── HttpConnection.java │ │ │ │ ├── HttpMessage.java │ │ │ │ ├── HttpMethod.java │ │ │ │ ├── HttpRequest.java │ │ │ │ └── HttpResponse.java │ │ └── resources │ │ │ └── provisioning-service-client.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ └── provisioning │ │ └── service │ │ ├── EnrollmentGroupManagerTest.java │ │ ├── Helpers.java │ │ ├── IndividualEnrollmentManagerTest.java │ │ ├── ProvisioningServiceClientTest.java │ │ ├── QueryTest.java │ │ ├── RegistrationStatusManagerTest.java │ │ ├── auth │ │ ├── ProvisioningConnectionStringBuilderTest.java │ │ ├── ProvisioningConnectionStringTest.java │ │ ├── ProvisioningServiceSasTokenTest.java │ │ ├── ServiceAuthenticationWithSharedAccessPolicyKeyTest.java │ │ └── ServiceAuthenticationWithSharedAccessPolicyTokenTest.java │ │ ├── configs │ │ ├── AttestationMechanismTest.java │ │ ├── BulkEnrollmentOperationErrorTest.java │ │ ├── BulkEnrollmentOperationResultTest.java │ │ ├── BulkEnrollmentOperationTest.java │ │ ├── CustomAllocationDefinitionTest.java │ │ ├── DeviceRegistrationStateTest.java │ │ ├── EnrollmentGroupTest.java │ │ ├── IndividualEnrollmentTest.java │ │ ├── QueryResultTest.java │ │ ├── QuerySpecificationBuilderTest.java │ │ ├── QuerySpecificationTest.java │ │ ├── ReprovisionPolicyTest.java │ │ ├── SerializableTest.java │ │ ├── SymmetricKeyAttestationTest.java │ │ ├── TpmAttestationTest.java │ │ ├── TwinCollectionTest.java │ │ ├── TwinMetadataTest.java │ │ ├── TwinPropertiesTest.java │ │ ├── TwinStateTest.java │ │ ├── X509AttestationTest.java │ │ ├── X509CAReferencesTest.java │ │ ├── X509CertificateInfoTest.java │ │ ├── X509CertificateWithInfoTest.java │ │ └── X509CertificatesTest.java │ │ ├── contract │ │ ├── ContractApiHttpTest.java │ │ └── SDKUtilsTest.java │ │ ├── exceptions │ │ └── ProvisioningServiceClientExceptionManagerTest.java │ │ └── transport │ │ └── https │ │ ├── HttpConnectionTest.java │ │ ├── HttpsRequestTest.java │ │ └── HttpsResponseTest.java ├── provisioning-tools │ ├── pom.xml │ ├── provisioning-x509-cert-generator │ │ ├── pom.xml │ │ ├── readme.md │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── tools │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ └── ProvisioningX509CertGen.java │ └── tpm-simulator │ │ ├── Microsoft.Devices.Tpm.TcpEmulator.0.0.1.nuspec │ │ ├── NVChip │ │ ├── Simulator.exe │ │ ├── Tpm.dll │ │ └── build │ │ └── Microsoft.Devices.Tpm.TcpEmulator.targets └── security │ ├── dice-provider-emulator │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ └── provisioning │ │ │ └── security │ │ │ └── hsm │ │ │ └── SecurityProviderDiceEmulator.java │ │ └── test │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ └── provisioning │ │ └── security │ │ └── hsm │ │ └── SecurityProviderDiceEmulatorTest.java │ ├── dice-provider │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ └── provisioning │ │ └── security │ │ └── hsm │ │ └── SecurityProviderDice.java │ ├── pom.xml │ ├── security-provider │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ └── provisioning │ │ │ └── security │ │ │ ├── SecurityProvider.java │ │ │ ├── SecurityProviderSymmetricKey.java │ │ │ ├── SecurityProviderTpm.java │ │ │ ├── SecurityProviderX509.java │ │ │ └── exceptions │ │ │ └── SecurityProviderException.java │ │ └── test │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ └── provisioning │ │ └── security │ │ ├── SecurityProviderSymmetricKeyTest.java │ │ ├── SecurityProviderTpmTest.java │ │ └── SecurityProviderX509Test.java │ ├── tpm-provider-emulator │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ └── provisioning │ │ │ └── security │ │ │ └── hsm │ │ │ └── SecurityProviderTPMEmulator.java │ │ └── test │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ └── provisioning │ │ └── security │ │ └── hsm │ │ └── SecurityProviderTPMEmulatorTest.java │ ├── tpm-provider │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── microsoft │ │ │ └── azure │ │ │ └── sdk │ │ │ └── iot │ │ │ └── provisioning │ │ │ └── security │ │ │ └── hsm │ │ │ └── SecurityProviderTPMHsm.java │ │ └── test │ │ └── java │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ └── provisioning │ │ └── security │ │ └── hsm │ │ └── SecurityProviderTPMHsmTest.java │ └── x509-provider │ ├── pom.xml │ └── src │ ├── main │ └── java │ │ └── com │ │ └── microsoft │ │ └── azure │ │ └── sdk │ │ └── iot │ │ └── provisioning │ │ └── security │ │ └── hsm │ │ └── SecurityProviderX509Cert.java │ └── test │ └── java │ └── com │ └── microsoft │ └── azure │ └── sdk │ └── iot │ └── provisioning │ └── security │ └── hsm │ └── SecurityProviderX509CertTest.java ├── readme.md ├── supported_platforms.md ├── thirdpartynotice.txt ├── upcoming_certificate_changes_readme.md ├── versions.json └── vsts ├── CredScanSuppressions.json ├── RunTestsOnEmulator.sh ├── StartEmulator.sh ├── TsaUploadConfigFile.json ├── build_e2e_tests.ps1 ├── build_repo.ps1 ├── determine_if_android_test_group_needs_to_run.ps1 ├── determine_tests_to_run.ps1 ├── echo_versions.ps1 ├── generate_javadocs_branch.ps1 ├── gradle_build.ps1 ├── horton-e2e.yaml ├── release ├── package-maven-artifacts-for-release.ps1 └── release-notes-template.md ├── sdl.yaml ├── spotbugs.ps1 ├── start_tpm_windows.ps1 └── windowsLinuxAndAndroidBuildMatrixConfig.yaml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Default behavior: if Git thinks a file is text (as opposed to binary), it 2 | # will normalize line endings to LF in the repository, but convert to your 3 | # platform's native line endings on checkout (e.g., CRLF for Windows). 4 | * text=auto 5 | 6 | # Explicitly declare text files you want to always be normalized and converted 7 | # to native line endings on checkout. E.g., 8 | #*.c text 9 | 10 | # Declare files that will always have CRLF line endings on checkout. E.g., 11 | #*.sln text eol=crlf 12 | 13 | # Declare files that will always have LF line endings on checkout. E.g., 14 | *.sh text eol=lf 15 | *.json text eol=lf 16 | 17 | # Denote all files that should not have line endings normalized, should not be 18 | # merged, and should not show in a textual diff. 19 | *.docm binary 20 | *.docx binary 21 | *.ico binary 22 | *.lib binary 23 | *.png binary 24 | *.pptx binary 25 | *.snk binary 26 | *.vsdx binary 27 | *.xps binary 28 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # CODEOWNERS is a GitHub standard to specify who is automatically assigned pull requests to review. 2 | # This helps to prevent pull requests from languishing without review. 3 | # GitHub can also be configured to require review from code owners before a pull request can be merged. 4 | 5 | # Further reading is available from the following two URLs: 6 | # https://blog.github.com/2017-07-06-introducing-code-owners/ 7 | # https://help.github.com/articles/about-codeowners/ 8 | 9 | # Default owner for repo 10 | * @timtay-microsoft @abhipsaMisra @andyk-ms @brycewang-microsoft @tmahmood-microsoft @patilsnr 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Azure IoT support and help options 4 | url: https://aka.ms/IoTHelp 5 | about: The main landing page for all Azure IoT support options. 6 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | # Checklist 9 | - [ ] I have read the [contribution guidelines] (https://github.com/Azure/azure-iot-sdk-java/blob/main/.github/CONTRIBUTING.md). 10 | - [ ] I added or modified the existing tests to cover the change (we do not allow our test coverage to go down). 11 | - I submitted this PR against the correct branch: 12 | - [ ] This pull-request is submitted against the `main` branch. 13 | 14 | # Reference/Link to the issue solved with this PR (if any) 15 | 16 | # Description of the problem 17 | 18 | 19 | # Description of the solution 20 | -------------------------------------------------------------------------------- /.github/workflows/cleanup.yml: -------------------------------------------------------------------------------- 1 | name: Nightly Cleanup 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: '0 2 * * *' # run at 2 AM UTC 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | - name: Set up JDK 1 16 | uses: actions/setup-java@v3 17 | with: 18 | java-version: '11' 19 | distribution: 'temurin' 20 | cache: maven 21 | - name: Build with Maven 22 | run: mvn -B package -DskipTests 23 | - name: Cleanup 24 | run: java -jar iot-e2e-tests/device-deletion-sample/target/deviceDeletionSample.jar 25 | env: 26 | IOT_DPS_CONNECTION_STRING: ${{ secrets.IOT_DPS_CONNECTION_STRING }} 27 | IOTHUB_CONNECTION_STRING: ${{ secrets.IOTHUB_CONNECTION_STRING }} -------------------------------------------------------------------------------- /.github/workflows/github_issues.yml: -------------------------------------------------------------------------------- 1 | name: Sync issue to Azure DevOps work item 2 | 3 | "on": 4 | issues: 5 | types: 6 | [opened, reopened] 7 | 8 | jobs: 9 | alert: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: danhellem/github-actions-issue-to-work-item@master 13 | env: 14 | ado_token: "${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}" 15 | ado_organization: "${{ secrets.ADO_ORGANIZATION }}" 16 | ado_project: "${{ secrets.ADO_PROJECT }}" 17 | ado_area_path: "${{ secrets.ADO_AREA_PATH }}" 18 | ado_wit: "Bug" 19 | ado_new_state: "New" 20 | ado_close_state: "Done" 21 | ado_bypassrules: false 22 | log_level: 300 23 | -------------------------------------------------------------------------------- /.github/workflows/issuelabeler.yml: -------------------------------------------------------------------------------- 1 | name: "Set Issue Label" 2 | on: 3 | issues: 4 | types: [opened] 5 | 6 | jobs: 7 | test: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: Naturalclar/issue-action@v1.0.0 11 | with: 12 | keywords: '[""]' 13 | labels: '["IoTSDK"]' 14 | github-token: "${{ secrets.GITHUB_TOKEN }}" 15 | -------------------------------------------------------------------------------- /.idea/scopes/OnlySDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Microsoft Azure IoT SDK for Java 2 | Copyright (c) Microsoft Corporation 3 | All rights reserved. 4 | MIT License 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the ""Software""), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /doc/Mqtt.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/doc/Mqtt.vsdx -------------------------------------------------------------------------------- /doc/media/add_requirement/add_requirement_step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/doc/media/add_requirement/add_requirement_step1.png -------------------------------------------------------------------------------- /doc/media/add_requirement/add_requirement_step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/doc/media/add_requirement/add_requirement_step2.png -------------------------------------------------------------------------------- /doc/media/add_requirement/add_requirement_step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/doc/media/add_requirement/add_requirement_step3.png -------------------------------------------------------------------------------- /doc/media/add_requirement/add_requirement_step4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/doc/media/add_requirement/add_requirement_step4.png -------------------------------------------------------------------------------- /doc/settings/README.md: -------------------------------------------------------------------------------- 1 | This folder contains the importable settings for Intellij for code style and file headers that all contributors of this 2 | project should use. In order to import them for newer Intellij versions, navigate to 3 | 4 | File -> Manage IDE Settings -> Import Settings 5 | 6 | For older Intellij versions, navigate to 7 | 8 | File -> Import Settings 9 | 10 | Note that these settings do not include any hotkey settings, so your existing hotkeys will not be overridden. -------------------------------------------------------------------------------- /doc/settings/settings.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/doc/settings/settings.zip -------------------------------------------------------------------------------- /iot-e2e-tests/android/AndroidDeviceSelect.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | import re 4 | 5 | def setTarget(deviceName): 6 | #os.popen("echo " + deviceName + ">device_udid.txt").read() 7 | os.popen("setx ANDROID_DEVICE_NAME "+deviceName).read() 8 | 9 | def getDeviceList(): 10 | res = os.popen("adb devices").read() 11 | formatted_string = res.strip().split('\n') 12 | deviceList = [] 13 | for x in formatted_string: 14 | if "\tdevice" in x: 15 | deviceList.append(x) 16 | print (deviceList) 17 | return deviceList 18 | 19 | def killAvd(): 20 | hasRealDevice = False 21 | deviceList = getDeviceList() 22 | print("Getting connected Devices") 23 | for device in deviceList: 24 | if not device.startswith('emulator'): 25 | hasRealDevice = True 26 | print("found real device "+device) 27 | device = re.sub('\tdevice$', '', device) 28 | setTarget(device) 29 | break 30 | if not hasRealDevice: 31 | print("no real android device found") 32 | 33 | print("selecting android device") 34 | killAvd() -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/digitaltwin/DigitalTwinClientAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.digitaltwin; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup10; 9 | 10 | import tests.integration.com.microsoft.azure.sdk.iot.digitaltwin.DigitalTwinClientTests; 11 | 12 | @TestGroup10 13 | public class DigitalTwinClientAndroidRunner extends DigitalTwinClientTests 14 | { 15 | // Intentionally empty class. The important part of this file is that the class inherits tests 16 | // from DigitalTwinClientTests and is assigned to a test group. 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/digitaltwin/DigitalTwinClientComponentTestsAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.digitaltwin; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup10; 9 | 10 | import tests.integration.com.microsoft.azure.sdk.iot.digitaltwin.DigitalTwinClientComponentTests; 11 | 12 | @TestGroup10 13 | public class DigitalTwinClientComponentTestsAndroidRunner extends DigitalTwinClientComponentTests 14 | { 15 | // Intentionally empty class. The important part of this file is that the class inherits tests 16 | // from DigitalTwinClientComponentTests and is assigned to a test group. 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup1 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup10.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup10 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup11.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup11 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup12.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup12 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup2 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup3 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup4 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup5.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup5 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup6.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup6 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup7.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup7 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup8.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup8 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/helper/TestGroup9.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.helper; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | 13 | @Target({ElementType.METHOD, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface TestGroup9 16 | { 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/FileUploadAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup10; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | import org.junit.runner.RunWith; 12 | import org.junit.runners.Parameterized; 13 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.FileUploadTests; 14 | 15 | @TestGroup10 16 | @RunWith(Parameterized.class) 17 | public class FileUploadAndroidRunner extends FileUploadTests 18 | { 19 | public FileUploadAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, boolean withProxy) throws Exception { 20 | super(protocol, authenticationType, withProxy); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/TokenRenewalAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup12; 9 | 10 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.TokenRenewalTests; 11 | 12 | @TestGroup12 13 | public class TokenRenewalAndroidRunner extends TokenRenewalTests 14 | { 15 | } 16 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/connection/ConnectionTestsAndroidRunner.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.android.iothub.connection; 2 | 3 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup11; 4 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 5 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 6 | import org.junit.runner.RunWith; 7 | import org.junit.runners.Parameterized; 8 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 9 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.connection.ConnectionTests; 10 | 11 | @TestGroup11 12 | @RunWith(Parameterized.class) 13 | public class ConnectionTestsAndroidRunner extends ConnectionTests 14 | { 15 | public ConnectionTestsAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType, boolean withProxy) throws Exception 16 | { 17 | super(protocol, authenticationType, clientType, withProxy); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/errorinjection/DirectMethodsErrInjAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub.errorinjection; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup5; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.junit.runners.Parameterized; 14 | 15 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 16 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.errorinjection.DirectMethodsErrInjTests; 17 | 18 | @TestGroup5 19 | @RunWith(Parameterized.class) 20 | public class DirectMethodsErrInjAndroidRunner extends DirectMethodsErrInjTests 21 | { 22 | public DirectMethodsErrInjAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType) throws Exception 23 | { 24 | super(protocol, authenticationType, clientType); 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/errorinjection/ReceiveMessagesErrInjAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub.errorinjection; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup3; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.junit.runners.Parameterized; 14 | 15 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 16 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.errorinjection.ReceiveMessagesErrInjTests; 17 | 18 | @TestGroup3 19 | @RunWith(Parameterized.class) 20 | public class ReceiveMessagesErrInjAndroidRunner extends ReceiveMessagesErrInjTests 21 | { 22 | public ReceiveMessagesErrInjAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType) throws Exception 23 | { 24 | super(protocol, authenticationType, clientType); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/errorinjection/SendMessagesErrInjAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub.errorinjection; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup4; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.junit.runners.Parameterized; 14 | 15 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 16 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.errorinjection.SendMessagesErrInjTests; 17 | 18 | @TestGroup4 19 | @RunWith(Parameterized.class) 20 | public class SendMessagesErrInjAndroidRunner extends SendMessagesErrInjTests 21 | { 22 | public SendMessagesErrInjAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType) throws Exception 23 | { 24 | super(protocol, authenticationType, clientType); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/errorinjection/TwinErrInjAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub.errorinjection; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup7; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | import org.junit.runner.RunWith; 12 | import org.junit.runners.Parameterized; 13 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 14 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.errorinjection.TwinErrInjTests; 15 | 16 | @TestGroup7 17 | @RunWith(Parameterized.class) 18 | public class TwinErrInjAndroidRunner extends TwinErrInjTests 19 | { 20 | public TwinErrInjAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType) throws Exception 21 | { 22 | super(protocol, authenticationType, clientType); 23 | } 24 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/messaging/ReceiveMessagesAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub.messaging; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup8; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.junit.runners.Parameterized; 14 | 15 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 16 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.telemetry.ReceiveMessagesTests; 17 | 18 | @TestGroup8 19 | @RunWith(Parameterized.class) 20 | public class ReceiveMessagesAndroidRunner extends ReceiveMessagesTests 21 | { 22 | public ReceiveMessagesAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType) throws Exception 23 | { 24 | super(protocol, authenticationType, clientType); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/messaging/SendMessagesAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub.messaging; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup8; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.junit.runners.Parameterized; 14 | 15 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 16 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.telemetry.SendMessagesTests; 17 | 18 | @TestGroup8 19 | @RunWith(Parameterized.class) 20 | public class SendMessagesAndroidRunner extends SendMessagesTests 21 | { 22 | public SendMessagesAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType) throws Exception 23 | { 24 | super(protocol, authenticationType, clientType); 25 | } 26 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/methods/DirectMethodsAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub.methods; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup9; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | 12 | import org.junit.runner.RunWith; 13 | import org.junit.runners.Parameterized; 14 | 15 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 16 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.methods.DirectMethodsTests; 17 | 18 | @TestGroup9 19 | @RunWith(Parameterized.class) 20 | public class DirectMethodsAndroidRunner extends DirectMethodsTests 21 | { 22 | public DirectMethodsAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType) throws Exception 23 | { 24 | super(protocol, authenticationType, clientType); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/iothub/twin/TwinAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.iothub.twin; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup10; 9 | import com.microsoft.azure.sdk.iot.device.IotHubClientProtocol; 10 | import com.microsoft.azure.sdk.iot.service.auth.AuthenticationType; 11 | import org.junit.runner.RunWith; 12 | import org.junit.runners.Parameterized; 13 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.ClientType; 14 | import tests.integration.com.microsoft.azure.sdk.iot.iothub.twin.TwinTests; 15 | 16 | @TestGroup10 17 | @RunWith(Parameterized.class) 18 | public class TwinAndroidRunner extends TwinTests 19 | { 20 | public TwinAndroidRunner(IotHubClientProtocol protocol, AuthenticationType authenticationType, ClientType clientType) throws Exception 21 | { 22 | super(protocol, authenticationType, clientType); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/androidTest/java/com/microsoft/azure/sdk/iot/android/provisioning/ProvisioningServiceClientAndroidRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.android.provisioning; 7 | 8 | import com.microsoft.azure.sdk.iot.android.helper.TestGroup1; 9 | 10 | import tests.integration.com.microsoft.azure.sdk.iot.provisioning.ProvisioningServiceClientTests; 11 | 12 | @TestGroup1 13 | public class ProvisioningServiceClientAndroidRunner extends ProvisioningServiceClientTests 14 | { 15 | // Intentionally empty class. The important part of this file is that the class inherits tests 16 | // from ProvisioningServiceClientTests and is assigned to a test group. 17 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.6.3' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | } 15 | 16 | allprojects { 17 | repositories { 18 | mavenLocal() 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | task clean(type: Delete) { 25 | delete rootProject.buildDir 26 | } -------------------------------------------------------------------------------- /iot-e2e-tests/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/iot-e2e-tests/android/gradle/wrapper/gradle-wrapper.properties -------------------------------------------------------------------------------- /iot-e2e-tests/android/renew_env.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo. 3 | echo Refreshing ANDROID_DEVICE_NAME from registry 4 | 5 | :: Get User ANDROID_DEVICE_NAME 6 | for /f "tokens=3*" %%A in ('reg query "HKCU\Environment" /v ANDROID_DEVICE_NAME') do set userANDROID_DEVICE_NAME=%%A%%B 7 | 8 | :: Set Refreshed ANDROID_DEVICE_NAME 9 | set ANDROID_DEVICE_NAME=%userANDROID_DEVICE_NAME% 10 | 11 | echo Refreshed ANDROID_DEVICE_NAME 12 | echo %ANDROID_DEVICE_NAME% -------------------------------------------------------------------------------- /iot-e2e-tests/android/runInstrumentationTests.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import os 3 | import time 4 | import sys 5 | 6 | env=dict(os.environ, PATH="path") 7 | cmd = "adb -s "+sys.argv[1]+" shell am instrument -w -r -e debug false -e package 'com.microsoft.azure.sdk.iot.androidthings' com.microsoft.azure.sdk.iot.androidthings.test/android.support.test.runner.AndroidJUnitRunner" 8 | print(cmd) 9 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8') 10 | (out, err) = p.communicate() 11 | print(out) 12 | print(err) 13 | os.popen("taskkill /IM cmd.exe /FI \"WINDOWTITLE eq C:\windows\system32\cmd.exe - emulator*\"") 14 | os.popen("setx ANDROID_DEVICE_NAME \"\"").read() 15 | if "Failures:" in out or len(err)>0: 16 | sys.exit(-1) 17 | print("exit-1") 18 | else: 19 | sys.exit(0) 20 | print("exit-0") -------------------------------------------------------------------------------- /iot-e2e-tests/android/runTestsOnThings.cmd: -------------------------------------------------------------------------------- 1 | @REM Copyright (c) Microsoft. All rights reserved. 2 | @REM Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | @REM -- Select Android Device -- 5 | python AndroidDeviceSelect.py 6 | @REM -- set device variable -- 7 | call renew_env.cmd 8 | ECHO We're working with "%ANDROID_DEVICE_NAME%" 9 | @REM -- installing device and test apk-- 10 | ECHO installing apk on device 11 | call adb -s %ANDROID_DEVICE_NAME% install -r -t "things\build\outputs\apk\debug\things-debug.apk" 12 | ECHO installing test apk on device 13 | call adb -s %ANDROID_DEVICE_NAME% install -r -t "things\build\outputs\apk\androidTest\debug\things-debug-androidTest.apk" 14 | @REM -- Starting Android Tests -- 15 | ECHO starting android tests 16 | python runInstrumentationTests.py %ANDROID_DEVICE_NAME% 17 | -------------------------------------------------------------------------------- /iot-e2e-tests/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/digitaltwin/helpers/E2ETestConstants.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.digitaltwin.helpers; 2 | 3 | public class E2ETestConstants { 4 | public static final String IOTHUB_CONNECTION_STRING_ENV_VAR_NAME = "IOTHUB_CONNECTION_STRING"; 5 | public static final String THERMOSTAT_MODEL_ID = "dtmi:com:example:Thermostat;1"; 6 | public static final String TEMPERATURE_CONTROLLER_MODEL_ID = "dtmi:com:example:TemperatureController;1"; 7 | } 8 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/BasicProxyAuthenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 7 | 8 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy.ProxyAuthenticator; 9 | 10 | public class BasicProxyAuthenticator implements ProxyAuthenticator 11 | { 12 | private final String expectedUsername; 13 | private final String expectedPassword; 14 | 15 | public BasicProxyAuthenticator(String expectedUsername, char[] expectedPassword) 16 | { 17 | this.expectedUsername = expectedUsername; 18 | this.expectedPassword = new String(expectedPassword); 19 | } 20 | 21 | @Override 22 | public boolean authenticate(String username, String password) 23 | { 24 | if (username == null || password == null) 25 | { 26 | return false; 27 | } 28 | 29 | return username.equals(expectedUsername) && password.equals(expectedPassword); 30 | } 31 | 32 | @Override 33 | public String getRealm() 34 | { 35 | return null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/BulkMessagesAndResult.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 2 | 3 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 4 | import com.microsoft.azure.sdk.iot.device.Message; 5 | 6 | import java.util.List; 7 | 8 | public class BulkMessagesAndResult { 9 | public List messages; 10 | public IotHubStatusCode statusCode; 11 | 12 | public BulkMessagesAndResult(List messages, IotHubStatusCode statusCode) { 13 | this.statusCode = statusCode; 14 | this.messages = messages; 15 | } 16 | } -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/ClientType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 7 | 8 | public enum ClientType 9 | { 10 | DEVICE_CLIENT, 11 | MODULE_CLIENT 12 | } 13 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/MessageAndResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.Message; 10 | 11 | public class MessageAndResult 12 | { 13 | public Message message; 14 | public IotHubStatusCode statusCode; 15 | 16 | public MessageAndResult(Message message, IotHubStatusCode statusCode) 17 | { 18 | this.statusCode = statusCode; 19 | this.message = message; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/NestedCustomObject.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 5 | 6 | import lombok.Getter; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * This class is for direct methods in e2e tests which takes Custom type as payload type. 13 | */ 14 | public class NestedCustomObject 15 | { 16 | @Getter 17 | private String stringAttri; 18 | 19 | @Getter 20 | private int intAttri; 21 | 22 | public NestedCustomObject(String stringAttri, int intAttri) 23 | { 24 | this.stringAttri = stringAttri; 25 | this.intAttri = intAttri; 26 | } 27 | 28 | public String toString() 29 | { 30 | Map map = new HashMap(){{ 31 | put("stringAttri", stringAttri); 32 | put("intAttri", intAttri); 33 | }}; 34 | 35 | return map.toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/Success.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 5 | 6 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 7 | 8 | public class Success 9 | { 10 | public Boolean result = null; 11 | private IotHubStatusCode callbackStatusCode; 12 | private boolean callbackWasFired = false; 13 | 14 | public void setResult(Boolean result) 15 | { 16 | this.result = result; 17 | } 18 | 19 | public void setCallbackStatusCode(IotHubStatusCode callbackStatusCode) 20 | { 21 | this.callbackStatusCode = callbackStatusCode; 22 | this.callbackWasFired = true; 23 | } 24 | 25 | public Boolean getResult() 26 | { 27 | return this.result; 28 | } 29 | 30 | public boolean wasCallbackFired() 31 | { 32 | return this.callbackWasFired; 33 | } 34 | 35 | public IotHubStatusCode getCallbackStatusCode() 36 | { 37 | return this.callbackStatusCode; 38 | } 39 | 40 | public void callbackWasFired() 41 | { 42 | callbackWasFired = true; 43 | } 44 | } -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/TestConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 7 | 8 | public class TestConstants 9 | { 10 | public static String IOT_HUB_CONNECTION_STRING_ENV_VAR_NAME = "IOTHUB_CONNECTION_STRING"; 11 | public static String IS_BASIC_TIER_HUB_ENV_VAR_NAME = "IS_BASIC_TIER_HUB"; 12 | public static String IS_PULL_REQUEST = "IS_PULL_REQUEST"; 13 | } 14 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/TestDeviceIdentity.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 5 | 6 | import com.microsoft.azure.sdk.iot.device.DeviceClient; 7 | import com.microsoft.azure.sdk.iot.device.InternalClient; 8 | import com.microsoft.azure.sdk.iot.service.registry.Device; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | 13 | /** 14 | * A collection of all the relevant identity and client objects that should be necessary to run a device side test involving a device. 15 | */ 16 | @AllArgsConstructor 17 | public class TestDeviceIdentity extends TestIdentity 18 | { 19 | @Getter 20 | @Setter 21 | DeviceClient deviceClient; 22 | 23 | @Getter 24 | Device device; 25 | 26 | @Override 27 | public String getDeviceId() 28 | { 29 | return device.getDeviceId(); 30 | } 31 | 32 | @Override 33 | public InternalClient getClient() 34 | { 35 | return deviceClient; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/TestIdentity.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package tests.integration.com.microsoft.azure.sdk.iot.helpers; 5 | 6 | import com.microsoft.azure.sdk.iot.device.InternalClient; 7 | import com.microsoft.azure.sdk.iot.service.registry.Device; 8 | 9 | /** 10 | * An abstract representation of a device-side identity that will be used by a test. See {@link TestDeviceIdentity} and 11 | * {@link TestModuleIdentity} for more details. 12 | */ 13 | public abstract class TestIdentity 14 | { 15 | // Some tests rely on the provided test identity having no pre-existing desired properties or reported properties. 16 | public boolean twinUpdated; 17 | 18 | public abstract String getDeviceId(); 19 | 20 | public abstract Device getDevice(); 21 | 22 | public abstract InternalClient getClient(); 23 | } 24 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/BasicTierHubOnlyTest.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Tests that only run against basic tier IoT Hubs 7 | */ 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.TYPE, ElementType.METHOD}) 10 | @Inherited 11 | public @interface BasicTierHubOnlyTest 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/ContinuousIntegrationTest.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Tests with this annotation will only be run during nightly or continuous integration builds. Typically these tests 7 | * run longer than most tests, cover niche scenarios, or test failure case scenarios that are atypical for users. 8 | */ 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Target({ElementType.TYPE, ElementType.METHOD}) 11 | @Inherited 12 | public @interface ContinuousIntegrationTest 13 | { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/DeviceProvisioningServiceTest.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Tests that use the Device Provisioning Service 7 | */ 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.TYPE, ElementType.METHOD}) 10 | @Inherited 11 | public @interface DeviceProvisioningServiceTest 12 | { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/DigitalTwinTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 5 | 6 | import java.lang.annotation.*; 7 | 8 | /** 9 | * Tests that run against IoT Hub 10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target({ElementType.TYPE, ElementType.METHOD}) 13 | @Inherited 14 | public @interface DigitalTwinTest 15 | { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/ErrInjTest.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Tests that run against IoT Hub with error injection. 7 | * If you are using a hub that is not part of our group with the error injection feature flag turned on you need to set 8 | * the RUN_ERRINJ_TESTS variable to false. Otherwise you'll have a number of test failures. 9 | */ 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Target({ElementType.TYPE, ElementType.METHOD}) 12 | @Inherited 13 | public @interface ErrInjTest 14 | { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/FlakeyTest.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Tests that have been identified as flakey. Ideally, these tests will be fixed or deleted eventually. 7 | */ 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.TYPE, ElementType.METHOD}) 10 | @Inherited 11 | public @interface FlakeyTest 12 | { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/IotHubTest.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Tests that run against IoT Hub 7 | */ 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.TYPE, ElementType.METHOD}) 10 | @Inherited 11 | public @interface IotHubTest 12 | { 13 | 14 | } 15 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/MultiplexingClientTest.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 2 | 3 | import com.microsoft.azure.sdk.iot.device.exceptions.MultiplexingClientRegistrationException; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Inherited; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | /** 12 | * Tests that use the {@link com.microsoft.azure.sdk.iot.device.MultiplexingClient}. This annotation adds some additional 13 | * logging to a test when it fails from a {@link MultiplexingClientRegistrationException}. 14 | * see {@link tests.integration.com.microsoft.azure.sdk.iot.helpers.rules.MultiplexingClientTestRule} for more details. 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target({ElementType.TYPE, ElementType.METHOD}) 18 | @Inherited 19 | public @interface MultiplexingClientTest 20 | { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/annotations/StandardTierHubOnlyTest.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.annotations; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Tests that can only run against standard tier hubs. Usually these tests involve twin or methods, which are a feature 7 | * of standard tier hubs, but not basic tier hubs. 8 | */ 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Target({ElementType.TYPE, ElementType.METHOD}) 11 | @Inherited 12 | public @interface StandardTierHubOnlyTest 13 | { 14 | } 15 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/DefaultHostResolver.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy; 2 | 3 | import java.net.InetAddress; 4 | import java.net.InetSocketAddress; 5 | import java.net.UnknownHostException; 6 | 7 | /** 8 | * Default implementation of {@link HostResolver} that just uses 9 | * {@link InetAddress#getByName(String)}. 10 | */ 11 | public class DefaultHostResolver implements HostResolver 12 | { 13 | @Override 14 | public InetSocketAddress resolve(String host, int port) 15 | throws UnknownHostException { 16 | InetAddress addr = InetAddress.getByName(host); 17 | return new InetSocketAddress(addr, port); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/HostResolver.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy; 2 | 3 | import java.net.InetSocketAddress; 4 | import java.net.UnknownHostException; 5 | 6 | /** 7 | * Resolves host and port into an InetSocketAddress. 8 | */ 9 | public interface HostResolver { 10 | public InetSocketAddress resolve(String host, int port) 11 | throws UnknownHostException; 12 | } 13 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/HttpFiltersSourceAdapter.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy; 2 | 3 | import io.netty.channel.ChannelHandlerContext; 4 | import io.netty.handler.codec.http.HttpRequest; 5 | 6 | /** 7 | * Convenience base class for implementations of {@link HttpFiltersSource}. 8 | */ 9 | public class HttpFiltersSourceAdapter implements HttpFiltersSource 10 | { 11 | 12 | public HttpFilters filterRequest(HttpRequest originalRequest) { 13 | return new HttpFiltersAdapter(originalRequest, null); 14 | } 15 | 16 | @Override 17 | public HttpFilters filterRequest(HttpRequest originalRequest, 18 | ChannelHandlerContext ctx) { 19 | return filterRequest(originalRequest); 20 | } 21 | 22 | @Override 23 | public int getMaximumRequestBufferSizeInBytes() { 24 | return 0; 25 | } 26 | 27 | @Override 28 | public int getMaximumResponseBufferSizeInBytes() { 29 | return 0; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/ProxyAuthenticator.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy; 2 | 3 | /** 4 | * Interface for objects that can authenticate someone for using our Proxy on 5 | * the basis of a username and password. 6 | */ 7 | public interface ProxyAuthenticator { 8 | /** 9 | * Authenticates the user using the specified userName and password. 10 | * 11 | * @param userName 12 | * The user name. 13 | * @param password 14 | * The password. 15 | * @return true if the credentials are acceptable, otherwise 16 | * false. 17 | */ 18 | boolean authenticate(String userName, String password); 19 | 20 | /** 21 | * The realm value to be used in the request for proxy authentication 22 | * ("Proxy-Authenticate" header). Returning null will cause the string 23 | * "Restricted Files" to be used by default. 24 | * 25 | * @return 26 | */ 27 | String getRealm(); 28 | } 29 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/SslEngineSource.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy; 2 | 3 | import javax.net.ssl.SSLEngine; 4 | 5 | /** 6 | * Source for {@link SSLEngine}s. 7 | */ 8 | public interface SslEngineSource { 9 | 10 | /** 11 | * Returns an {@link SSLEngine} to use for a server connection from 12 | * LittleProxy to the client. 13 | * 14 | * @return 15 | */ 16 | SSLEngine newSslEngine(); 17 | 18 | /** 19 | * Returns an {@link SSLEngine} to use for a client connection from 20 | * LittleProxy to the upstream server. * 21 | * 22 | * Note: Peer information is needed to send the server_name extension in 23 | * handshake with Server Name Indication (SNI). 24 | * 25 | * @param peerHost 26 | * to start a client connection to the server. 27 | * @param peerPort 28 | * to start a client connection to the server. 29 | * @return 30 | */ 31 | SSLEngine newSslEngine(String peerHost, int peerPort); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/TransportProtocol.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy; 2 | 3 | /** 4 | * Enumeration of transport protocols supported by LittleProxy. 5 | */ 6 | public enum TransportProtocol { 7 | TCP, UDT 8 | } -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/UnknownTransportProtocolException.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy; 2 | 3 | /** 4 | * This exception indicates that the system was asked to use a TransportProtocol that it didn't know how to handle. 5 | */ 6 | public class UnknownTransportProtocolException extends RuntimeException { 7 | private static final long serialVersionUID = 1L; 8 | 9 | public UnknownTransportProtocolException(TransportProtocol transportProtocol) { 10 | super(String.format("Unknown TransportProtocol: %1$s", transportProtocol)); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/extras/SelfSignedMitmManager.java: -------------------------------------------------------------------------------- 1 | package tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy.extras; 2 | 3 | import io.netty.handler.codec.http.HttpRequest; 4 | import tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy.MitmManager; 5 | 6 | import javax.net.ssl.SSLEngine; 7 | import javax.net.ssl.SSLSession; 8 | 9 | /** 10 | * {@link MitmManager} that uses self-signed certs for everything. 11 | */ 12 | public class SelfSignedMitmManager implements MitmManager 13 | { 14 | SelfSignedSslEngineSource selfSignedSslEngineSource = 15 | new SelfSignedSslEngineSource(true); 16 | 17 | @Override 18 | public SSLEngine serverSslEngine(String peerHost, int peerPort) { 19 | return selfSignedSslEngineSource.newSslEngine(peerHost, peerPort); 20 | } 21 | 22 | @Override 23 | public SSLEngine serverSslEngine() { 24 | return selfSignedSslEngineSource.newSslEngine(); 25 | } 26 | 27 | @Override 28 | public SSLEngine clientSslEngineFor(HttpRequest httpRequest, SSLSession serverSslSession) { 29 | return selfSignedSslEngineSource.newSslEngine(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/java/tests/integration/com/microsoft/azure/sdk/iot/helpers/proxy/readme.md: -------------------------------------------------------------------------------- 1 | The code within this directory is a copy of the [LittleProxy](https://github.com/adamfisk/LittleProxy) 2 | library that has fallen out of maintenence. Some small modifications made to accomodate more 3 | recent dependency versions of Guava since this library has security vulenerabilities otherwise. 4 | 5 | The code within this directory will not be published in any manner and is only used for test purposes. -------------------------------------------------------------------------------- /iot-e2e-tests/common/src/test/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | # Uncomment these lines to log from everything, including SDK and tests. LittleProxy and Netty make a lot 12 | # of logs though, so leaving this commented out and just printing SDK and test logs instead. 13 | #rootLogger.level = debug 14 | #rootLogger.appenderRefs = stdout 15 | #rootLogger.appenderRef.stdout.ref = LogToConsole 16 | 17 | # Log levels for the test HTTP proxy 18 | logger.testproxy.name = tests.integration.com.microsoft.azure.sdk.iot.helpers.proxy 19 | logger.testproxy.level = INFO 20 | 21 | # Log test logs at this level 22 | logger.tests.name = tests.integration.com.microsoft.azure.sdk.iot 23 | logger.tests.level = DEBUG 24 | 25 | logger.sdk.name = com.microsoft.azure.sdk.iot 26 | logger.sdk.level = INFO 27 | 28 | # Logs from this class in particular don't add anything helpful for us 29 | logger.retry.name = com.microsoft.azure.sdk.iot.device.transport.ExponentialBackoffWithJitter 30 | logger.retry.level = ERROR 31 | 32 | -------------------------------------------------------------------------------- /iot-e2e-tests/docker/haproxy/errors/400.http: -------------------------------------------------------------------------------- 1 | HTTP/1.0 400 Bad request 2 | Cache-Control: no-cache 3 | Connection: close 4 | Content-Type: text/html 5 | 6 |

400 Bad request

7 | Your browser sent an invalid request. 8 | 9 | -------------------------------------------------------------------------------- /iot-e2e-tests/docker/haproxy/errors/403.http: -------------------------------------------------------------------------------- 1 | HTTP/1.0 403 Forbidden 2 | Cache-Control: no-cache 3 | Connection: close 4 | Content-Type: text/html 5 | 6 |

403 Forbidden

7 | Request forbidden by administrative rules. 8 | 9 | -------------------------------------------------------------------------------- /iot-e2e-tests/docker/haproxy/errors/408.http: -------------------------------------------------------------------------------- 1 | HTTP/1.0 408 Request Time-out 2 | Cache-Control: no-cache 3 | Connection: close 4 | Content-Type: text/html 5 | 6 |

408 Request Time-out

7 | Your browser didn't send a complete request in time. 8 | 9 | -------------------------------------------------------------------------------- /iot-e2e-tests/docker/haproxy/errors/500.http: -------------------------------------------------------------------------------- 1 | HTTP/1.0 500 Internal Server Error 2 | Cache-Control: no-cache 3 | Connection: close 4 | Content-Type: text/html 5 | 6 |

500 Internal Server Error

7 | An internal server error occurred. 8 | 9 | -------------------------------------------------------------------------------- /iot-e2e-tests/docker/haproxy/errors/502.http: -------------------------------------------------------------------------------- 1 | HTTP/1.0 502 Bad Gateway 2 | Cache-Control: no-cache 3 | Connection: close 4 | Content-Type: text/html 5 | 6 |

502 Bad Gateway

7 | The server returned an invalid or incomplete response. 8 | 9 | -------------------------------------------------------------------------------- /iot-e2e-tests/docker/haproxy/errors/503.http: -------------------------------------------------------------------------------- 1 | HTTP/1.0 503 Service Unavailable 2 | Cache-Control: no-cache 3 | Connection: close 4 | Content-Type: text/html 5 | 6 |

503 Service Unavailable

7 | No server is available to handle this request. 8 | 9 | -------------------------------------------------------------------------------- /iot-e2e-tests/docker/haproxy/errors/504.http: -------------------------------------------------------------------------------- 1 | HTTP/1.0 504 Gateway Time-out 2 | Cache-Control: no-cache 3 | Connection: close 4 | Content-Type: text/html 5 | 6 |

504 Gateway Time-out

7 | The server didn't respond in time. 8 | 9 | -------------------------------------------------------------------------------- /iot-e2e-tests/docker/haproxy/haproxy.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/iot-e2e-tests/docker/haproxy/haproxy.bin -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/.swagger-codegen-ignore: -------------------------------------------------------------------------------- 1 | # Swagger Codegen Ignore 2 | # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen 3 | 4 | # Use this file to prevent files from being overwritten by the generator. 5 | # The patterns follow closely to .gitignore or .dockerignore. 6 | 7 | # As an example, the C# client generator defines ApiClient.cs. 8 | # You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: 9 | #ApiClient.cs 10 | 11 | # You can match any string of characters against a directory, file or extension with a single asterisk (*): 12 | #foo/*/qux 13 | # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux 14 | 15 | # You can recursively match patterns against a directory, file or extension with a double asterisk (**): 16 | #foo/**/qux 17 | # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux 18 | 19 | # You can also negate patterns with an exclamation (!). 20 | # For example, you can ignore all files in a docs folder with the file extension .md: 21 | #docs/*.md 22 | # Then explicitly reverse the ignore rule for a single file: 23 | #!docs/README.md 24 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/.swagger-codegen/VERSION: -------------------------------------------------------------------------------- 1 | 2.3.1 -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/README.md: -------------------------------------------------------------------------------- 1 | Project generated on : 2018-08-06T21:32:34.426Z 2 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/com/microsoft/azure/sdk/iot/e2e/Main.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.e2e; 2 | 3 | import io.swagger.server.api.MainApiVerticle; 4 | import io.vertx.core.Vertx; 5 | 6 | public class Main { 7 | 8 | public static void main(String[] args) { 9 | Vertx vertx = Vertx.vertx(); 10 | 11 | MainApiVerticle myVerticle = new MainApiVerticle(); 12 | 13 | vertx.deployVerticle(myVerticle, res -> { 14 | if (res.succeeded()) { 15 | System.out.println("Deployment id is: " + res.result()); 16 | } else { 17 | System.out.println("Deployment failed!"); 18 | } 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/glue/WrapperGlue.java: -------------------------------------------------------------------------------- 1 | package glue; 2 | 3 | import io.swagger.server.api.verticle.ModuleApiImpl; 4 | import io.swagger.server.api.verticle.RegistryApiImpl; 5 | import io.swagger.server.api.verticle.ServiceApiImpl; 6 | import io.vertx.core.AsyncResult; 7 | import io.vertx.core.Future; 8 | import io.vertx.core.Handler; 9 | import io.vertx.core.json.JsonObject; 10 | 11 | @SuppressWarnings("ALL") 12 | public class WrapperGlue 13 | { 14 | public void Cleanup(Handler> handler) 15 | { 16 | ModuleApiImpl._moduleGlue.Cleanup(); 17 | RegistryApiImpl._registryGlue.Cleanup(); 18 | ServiceApiImpl._serviceGlue.Cleanup(); 19 | handler.handle(Future.succeededFuture()); 20 | } 21 | 22 | public void outputMessage(Object message, Handler> handler) 23 | { 24 | System.out.println(((JsonObject)message).getString("message")); 25 | handler.handle(Future.succeededFuture()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/MainApiException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api; 2 | 3 | public class MainApiException extends Exception { 4 | private final int statusCode; 5 | private final String statusMessage; 6 | 7 | public MainApiException(int statusCode, String statusMessage) { 8 | super(); 9 | this.statusCode = statusCode; 10 | this.statusMessage = statusMessage; 11 | } 12 | 13 | public int getStatusCode() { 14 | return statusCode; 15 | } 16 | 17 | public String getStatusMessage() { 18 | return statusMessage; 19 | } 20 | 21 | public static final MainApiException INTERNAL_SERVER_ERROR = new MainApiException(500, "Internal Server Error"); 22 | } -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/DeviceApi.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.model.Certificate; 4 | import io.swagger.server.api.model.ConnectResponse; 5 | import io.swagger.server.api.model.RoundtripMethodCallBody; 6 | 7 | import io.vertx.core.AsyncResult; 8 | import io.vertx.core.Handler; 9 | 10 | @SuppressWarnings("ALL") 11 | public interface DeviceApi { 12 | //PUT_device_connect_transportType 13 | void deviceConnectTransportTypePut(String transportType, String connectionString, Certificate caCertificate, Handler> handler); 14 | 15 | //PUT_device_connectionId_disconnect 16 | void deviceConnectionIdDisconnectPut(String connectionId, Handler> handler); 17 | 18 | //PUT_device_connectionId_enableMethods 19 | void deviceConnectionIdEnableMethodsPut(String connectionId, Handler> handler); 20 | 21 | //PUT_device_connectionId_roundtripMethodCall_methodName 22 | void deviceConnectionIdRoundtripMethodCallMethodNamePut(String connectionId, String methodName, RoundtripMethodCallBody requestAndResponse, Handler> handler); 23 | } 24 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/DeviceApiException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.MainApiException; 4 | 5 | @SuppressWarnings("ALL") 6 | public final class DeviceApiException extends MainApiException { 7 | public DeviceApiException(int statusCode, String statusMessage) { 8 | super(statusCode, statusMessage); 9 | } 10 | 11 | 12 | 13 | } -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/EventhubApi.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.model.ConnectResponse; 4 | 5 | import io.vertx.core.AsyncResult; 6 | import io.vertx.core.Handler; 7 | 8 | public interface EventhubApi { 9 | //PUT_eventhub_connect 10 | void eventhubConnectPut(String connectionString, Handler> handler); 11 | 12 | //GET_eventhub_connectionId_deviceTelemetry_deviceId 13 | void eventhubConnectionIdDeviceTelemetryDeviceIdGet(String connectionId, String deviceId, Handler> handler); 14 | 15 | //PUT_eventhub_connectionId_disconnect_ 16 | void eventhubConnectionIdDisconnectPut(String connectionId, Handler> handler); 17 | 18 | //PUT_eventhub_connectionId_enableTelemetry 19 | void eventhubConnectionIdEnableTelemetryPut(String connectionId, Handler> handler); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/EventhubApiException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.MainApiException; 4 | 5 | @SuppressWarnings("ALL") 6 | public final class EventhubApiException extends MainApiException { 7 | public EventhubApiException(int statusCode, String statusMessage) { 8 | super(statusCode, statusMessage); 9 | } 10 | 11 | 12 | 13 | } -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/ModuleApiException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.MainApiException; 4 | 5 | @SuppressWarnings("ALL") 6 | public final class ModuleApiException extends MainApiException { 7 | public ModuleApiException(int statusCode, String statusMessage) { 8 | super(statusCode, statusMessage); 9 | } 10 | 11 | 12 | 13 | } -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/RegistryApi.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.model.ConnectResponse; 4 | 5 | import io.vertx.core.AsyncResult; 6 | import io.vertx.core.Handler; 7 | 8 | public interface RegistryApi { 9 | //PUT_registry_connect 10 | void registryConnectPut(String connectionString, Handler> handler); 11 | 12 | //PUT_registry_connectionId_disconnect_ 13 | void registryConnectionIdDisconnectPut(String connectionId, Handler> handler); 14 | 15 | //GET_registry_connectionId_moduleTwin_deviceId_moduleId 16 | void registryConnectionIdModuleTwinDeviceIdModuleIdGet(String connectionId, String deviceId, String moduleId, Handler> handler); 17 | 18 | //PATCH_registry_connectionId_moduleTwin_deviceId_moduleId 19 | void registryConnectionIdModuleTwinDeviceIdModuleIdPatch(String connectionId, String deviceId, String moduleId, Object props, Handler> handler); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/RegistryApiException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.MainApiException; 4 | 5 | @SuppressWarnings("ALL") 6 | public final class RegistryApiException extends MainApiException { 7 | public RegistryApiException(int statusCode, String statusMessage) { 8 | super(statusCode, statusMessage); 9 | } 10 | 11 | 12 | 13 | } -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/ServiceApi.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.model.ConnectResponse; 4 | 5 | import io.vertx.core.AsyncResult; 6 | import io.vertx.core.Handler; 7 | 8 | public interface ServiceApi { 9 | //PUT_service_connect 10 | void serviceConnectPut(String connectionString, Handler> handler); 11 | 12 | //PUT_service_connectionId_deviceMethod_deviceId 13 | void serviceConnectionIdDeviceMethodDeviceIdPut(String connectionId, String deviceId, Object methodInvokeParameters, Handler> handler); 14 | 15 | //PUT_service_connectionId_disconnect_ 16 | void serviceConnectionIdDisconnectPut(String connectionId, Handler> handler); 17 | 18 | //PUT_service_connectionId_moduleMethod_deviceId_moduleId 19 | void serviceConnectionIdModuleMethodDeviceIdModuleIdPut(String connectionId, String deviceId, String moduleId, Object methodInvokeParameters, Handler> handler); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/ServiceApiException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.MainApiException; 4 | 5 | @SuppressWarnings("ALL") 6 | public final class ServiceApiException extends MainApiException { 7 | public ServiceApiException(int statusCode, String statusMessage) { 8 | super(statusCode, statusMessage); 9 | } 10 | 11 | 12 | 13 | } -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/WrappedTwin.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import com.microsoft.azure.sdk.iot.service.twin.TwinCollection; 4 | import com.microsoft.azure.sdk.iot.service.twin.Twin; 5 | import io.vertx.core.json.JsonObject; 6 | 7 | public class WrappedTwin 8 | { 9 | final Twin twin; 10 | 11 | public WrappedTwin(Twin twin) 12 | { 13 | this.twin = twin; 14 | } 15 | 16 | private JsonObject mapToJson(TwinCollection map) 17 | { 18 | return new JsonObject(map.toJsonObject().toString()); 19 | } 20 | 21 | public JsonObject toJsonObject() 22 | { 23 | 24 | return new JsonObject() 25 | .put("properties", new JsonObject() 26 | .put("desired", mapToJson(this.twin.getDesiredProperties())) 27 | .put("reported", mapToJson(this.twin.getReportedProperties()))); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/WrapperApi.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.vertx.core.AsyncResult; 4 | import io.vertx.core.Handler; 5 | 6 | public interface WrapperApi { 7 | //PUT_wrapper_cleanup 8 | void wrapperCleanupPut(Handler> handler); 9 | 10 | //PUT_wrapper_message 11 | void wrapperMessagePut(Object msg, Handler> handler); 12 | 13 | //GET_wrapper_session 14 | void wrapperSessionGet(Handler> handler); 15 | 16 | //PUT_wrapper_session 17 | void wrapperSessionPut(Handler> handler); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/WrapperApiException.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import io.swagger.server.api.MainApiException; 4 | 5 | @SuppressWarnings("ALL") 6 | public final class WrapperApiException extends MainApiException { 7 | public WrapperApiException(int statusCode, String statusMessage) { 8 | super(statusCode, statusMessage); 9 | } 10 | 11 | 12 | 13 | } -------------------------------------------------------------------------------- /iot-e2e-tests/edge-e2e/src/main/java/io/swagger/server/api/verticle/WrapperApiImpl.java: -------------------------------------------------------------------------------- 1 | package io.swagger.server.api.verticle; 2 | 3 | import glue.WrapperGlue; 4 | import io.vertx.core.AsyncResult; 5 | import io.vertx.core.Future; 6 | import io.vertx.core.Handler; 7 | 8 | @SuppressWarnings("ALL") 9 | public class WrapperApiImpl implements WrapperApi { 10 | private final WrapperGlue _wrapperGlue= new WrapperGlue(); 11 | 12 | @Override 13 | public void wrapperCleanupPut(Handler> handler) 14 | { 15 | this._wrapperGlue.Cleanup(handler); 16 | } 17 | 18 | @Override 19 | public void wrapperMessagePut(Object message, Handler> handler) 20 | { 21 | this._wrapperGlue.outputMessage(message, handler); 22 | } 23 | 24 | @Override 25 | public void wrapperSessionGet(Handler> handler) 26 | { 27 | handler.handle(Future.succeededFuture()); 28 | } 29 | 30 | @Override 31 | public void wrapperSessionPut(Handler> handler) 32 | { 33 | handler.handle(Future.succeededFuture()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /iot-e2e-tests/iot-e2e-jvm-tests/src/test/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | # Uncomment these lines to log from everything, including SDK and tests. LittleProxy and Netty make a lot 12 | # of logs though, so leaving this commented out and just printing SDK and test logs instead. 13 | #rootLogger.level = debug 14 | #rootLogger.appenderRefs = stdout 15 | #rootLogger.appenderRef.stdout.ref = LogToConsole 16 | 17 | # Log test logs at this level 18 | logger.tests.name = tests.integration.com.microsoft.azure.sdk.iot 19 | logger.tests.level = DEBUG 20 | 21 | logger.sdk.name = com.microsoft.azure.sdk.iot 22 | logger.sdk.level = INFO 23 | 24 | # Logs from this class in particular don't add anything helpful for us 25 | logger.retry.name = com.microsoft.azure.sdk.iot.device.transport.ExponentialBackoffWithJitter 26 | logger.retry.level = ERROR 27 | 28 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/BatchMessage.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Used to construct batch messages to be sent to the IoT Hub {@link com.microsoft.azure.sdk.iot.device.InternalClient#sendEventsAsync(List, MessagesSentCallback, Object)} 7 | */ 8 | public class BatchMessage extends Message 9 | { 10 | /** 11 | * List of nested messages. 12 | */ 13 | private final List nestedMessages; 14 | 15 | /** 16 | * Creates a batch message 17 | * This constructor is internal and can only be called within the com.microsoft.azure.sdk.iot.device package. 18 | * @param messages The messages that will be sent as a batch 19 | */ 20 | BatchMessage(List messages) 21 | { 22 | this.nestedMessages = messages; 23 | } 24 | 25 | /** 26 | * Gets the list of nested messages. 27 | * @return All nested messages. 28 | */ 29 | public List getNestedMessages() 30 | { 31 | return this.nestedMessages; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/ConnectionStatusChangeContext.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device; 2 | 3 | import com.microsoft.azure.sdk.iot.device.transport.IotHubConnectionStatus; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | 7 | /** 8 | * The context surrounding a connection status change event for this client. 9 | */ 10 | @AllArgsConstructor 11 | public class ConnectionStatusChangeContext 12 | { 13 | /** 14 | * The new connection status of the client. 15 | */ 16 | @Getter 17 | IotHubConnectionStatus newStatus; 18 | 19 | /** 20 | * The previous status of this client. 21 | */ 22 | @Getter 23 | IotHubConnectionStatus previousStatus; 24 | 25 | /** 26 | * The reason why the sdk changed to this status. 27 | */ 28 | @Getter 29 | IotHubConnectionStatusChangeReason newStatusReason; 30 | 31 | /** 32 | * The throwable that caused the change in status. May be null if there wasn't an associated throwable. 33 | */ 34 | @Getter 35 | Throwable cause; 36 | 37 | /** 38 | * The user provided context object that was set when setting the connection status change callback on the client. 39 | */ 40 | @Getter 41 | Object callbackContext; 42 | } 43 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/DeviceClientType.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device; 2 | 3 | /** 4 | * The type of the device client. Used to differentiate between device clients that own their own connection from device 5 | * clients that are multiplexing. 6 | */ 7 | enum DeviceClientType 8 | { 9 | /** 10 | * The connection type is a non-multiplexed, single device identity connection. 11 | */ 12 | SINGLE_CLIENT, 13 | 14 | /** 15 | * The connection type is a multiplexed connection using {@link com.microsoft.azure.sdk.iot.device.MultiplexingClient} 16 | */ 17 | USE_MULTIPLEXING_CLIENT 18 | } 19 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/IotHubClientProtocol.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.device; 5 | 6 | /** 7 | * The application-layer protocol used by the client to communicate with an IoT 8 | * Hub. 9 | */ 10 | public enum IotHubClientProtocol 11 | { 12 | HTTPS, AMQPS, MQTT, AMQPS_WS, MQTT_WS 13 | } 14 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/IotHubConnectionStatusChangeCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.device; 5 | 6 | /** 7 | * Callback interface for allowing users to respond to changes in the connectivity of this sdk to Iot Hub. 8 | */ 9 | public interface IotHubConnectionStatusChangeCallback 10 | { 11 | /** 12 | * The callback that is executed each time the connection status of the client changes. Includes details for more 13 | * context on why that change occurred. 14 | * 15 | * @param connectionStatusChangeContext the context surrounding the status change, including the new status, the reason 16 | * for the new status, the underlying exception (if connection was lost), and the user provided context object that 17 | * was set when setting the connection status change callback on the client. 18 | */ 19 | void onStatusChanged(ConnectionStatusChangeContext connectionStatusChangeContext); 20 | } 21 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/MessageType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.device; 5 | 6 | /** 7 | * The IoTHub message type 8 | */ 9 | public enum MessageType 10 | { 11 | UNKNOWN, 12 | DEVICE_TELEMETRY, 13 | DEVICE_METHODS, 14 | DEVICE_TWIN 15 | } 16 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/auth/IotHubX509SoftwareAuthenticationProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.auth; 7 | 8 | import javax.net.ssl.SSLContext; 9 | 10 | public class IotHubX509SoftwareAuthenticationProvider extends IotHubAuthenticationProvider 11 | { 12 | public IotHubX509SoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, SSLContext sslContext) throws IllegalArgumentException 13 | { 14 | super(hostname, gatewayHostname, deviceId, moduleId, sslContext); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/auth/SignatureProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.auth; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.TransportException; 9 | 10 | import java.io.UnsupportedEncodingException; 11 | 12 | /** 13 | * Interface for a valid signature provider 14 | */ 15 | public interface SignatureProvider 16 | { 17 | /** 18 | * Sign the provided data using the provided key name 19 | * @param keyName the key used for signing 20 | * @param data the data to be signed 21 | * @param generationId the generation id 22 | * @return the signed data 23 | * @throws TransportException If the http client cannot reach the signing party 24 | */ 25 | String sign(String keyName, String data, String generationId) throws TransportException, UnsupportedEncodingException; 26 | } 27 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/auth/package-info.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /** Authenticates a device to an IoT Hub via SAS tokens. */ 5 | package com.microsoft.azure.sdk.iot.device.auth; -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/edge/TrustBundleProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.edge; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.TransportException; 9 | import com.microsoft.azure.sdk.iot.device.hsm.UnixDomainSocketChannel; 10 | 11 | import java.net.URISyntaxException; 12 | 13 | /** 14 | * Interface for providing trust bundles through an external provider 15 | */ 16 | public interface TrustBundleProvider 17 | { 18 | String getTrustBundleCerts(String providerUri, String apiVersion, UnixDomainSocketChannel unixDomainSocketChannel) throws URISyntaxException, TransportException; 19 | } 20 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/hsm/parser/SignResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.hsm.parser; 7 | 8 | import com.google.gson.GsonBuilder; 9 | import com.google.gson.annotations.Expose; 10 | import com.google.gson.annotations.SerializedName; 11 | import lombok.Getter; 12 | 13 | 14 | public class SignResponse 15 | { 16 | private static final String DIGEST_NAME = "digest"; 17 | @Expose 18 | @SerializedName(DIGEST_NAME) 19 | @Getter 20 | private String digest; 21 | 22 | //empty constructor for Gson to use 23 | public SignResponse() { } 24 | 25 | public static SignResponse fromJson(String json) 26 | { 27 | return new GsonBuilder().create().fromJson(json, SignResponse.class); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/package-info.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /** The API for a device to communicate with an IoT Hub. */ 5 | package com.microsoft.azure.sdk.iot.device; -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/CorrelationCallbackContext.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device.transport; 2 | 3 | import com.microsoft.azure.sdk.iot.device.CorrelatingMessageCallback; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Getter; 6 | 7 | @AllArgsConstructor 8 | class CorrelationCallbackContext 9 | { 10 | @Getter 11 | private final CorrelatingMessageCallback callback; 12 | 13 | @Getter 14 | private final Object userContext; 15 | 16 | // Used to store the number of milliseconds since epoch that this packet was created for a correlationId 17 | @Getter 18 | private final Long startTimeMillis; 19 | } 20 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/IotHubConnectionStatus.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.device.transport; 5 | 6 | public enum IotHubConnectionStatus 7 | { 8 | /** 9 | * The device or module is connected. 10 | *

The client is connected, and ready to be used.

11 | */ 12 | CONNECTED, 13 | 14 | /** 15 | * The device or module is disconnected. 16 | *

Inspect the associated {@link com.microsoft.azure.sdk.iot.device.IotHubConnectionStatusChangeReason} returned (and exception thrown, if any), and take appropriate action.

17 | */ 18 | DISCONNECTED, 19 | 20 | /** 21 | * The device or module is attempting to reconnect. 22 | *

The client is attempting to recover the connection. Do NOT close or open the client instance when it is retrying.

23 | */ 24 | DISCONNECTED_RETRYING 25 | } -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/NoRetry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.device.transport; 9 | 10 | import lombok.extern.slf4j.Slf4j; 11 | 12 | /** 13 | * Represents a retry policy that performs no retries. 14 | */ 15 | @Slf4j 16 | public class NoRetry implements RetryPolicy 17 | { 18 | public NoRetry() 19 | { 20 | log.info("NOTE: A new instance of NoRetry has been created, the client will not perform any retries on disconnect."); 21 | } 22 | /** 23 | * Always says to not retry. 24 | * 25 | * @param currentRetryCount the number of retries for the given operation 26 | * @param lastException the last exception encountered 27 | * @return the retry decision. 28 | */ 29 | public RetryDecision getRetryDecision(int currentRetryCount, TransportException lastException) 30 | { 31 | return new RetryDecision(false, 0); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/ProtocolException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport; 7 | 8 | /** 9 | * Exception class that covers all exceptions that occur within transport protocol communication. For example, if a 10 | * amqp:connection:forced exception is given by AMQP. 11 | */ 12 | public class ProtocolException extends TransportException 13 | { 14 | public ProtocolException() 15 | { 16 | super(); 17 | } 18 | 19 | public ProtocolException(String message) 20 | { 21 | super(message); 22 | } 23 | 24 | public ProtocolException(String message, Throwable cause) 25 | { 26 | super(message, cause); 27 | } 28 | 29 | public ProtocolException(Throwable cause) 30 | { 31 | super(cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/RetryPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | package com.microsoft.azure.sdk.iot.device.transport; 8 | 9 | /** 10 | * An interface for the retry policy. 11 | */ 12 | public interface RetryPolicy 13 | { 14 | /** 15 | * Determines whether the operation should be retried and the interval until the next retry. 16 | * 17 | * @param currentRetryCount the number of retries for the given operation 18 | * @param lastException the latest exception explaining why the retry is happening. This exception is guaranteed to 19 | * be retryable. In the event of a terminal exception occurring, this API will not be called. 20 | * Looking at this exception allows you to prevent retry on certain retryable exceptions, but 21 | * does not allow you to retry exceptions that are terminal. 22 | * @return the retry decision. 23 | */ 24 | RetryDecision getRetryDecision(int currentRetryCount, TransportException lastException); 25 | } -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/AmqpsMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.amqps; 7 | 8 | import lombok.Getter; 9 | import lombok.Setter; 10 | import org.apache.qpid.proton.amqp.transport.DeliveryState; 11 | import org.apache.qpid.proton.engine.Delivery; 12 | import org.apache.qpid.proton.message.impl.MessageImpl; 13 | 14 | /** 15 | * Extension of the QPID-Proton-J MessageImpl class which implements the Message interface. Adds a Delivery object as a 16 | * private member variable and adds a new ACK_TYPE enum. Adds the ability to easily acknowledge a single message. 17 | */ 18 | public class AmqpsMessage extends MessageImpl 19 | { 20 | @Getter 21 | @Setter 22 | private Delivery delivery; 23 | 24 | /** 25 | * Sends acknowledgement of this message using the provided ACK_TYPE. 26 | * 27 | * @param ackType acknowledgement type to send 28 | */ 29 | public void acknowledge(DeliveryState ackType) 30 | { 31 | delivery.disposition(ackType); 32 | delivery.settle(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/AmqpsSendResult.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device.transport.amqps; 2 | 3 | import lombok.Getter; 4 | 5 | import java.nio.charset.StandardCharsets; 6 | 7 | public class AmqpsSendResult 8 | { 9 | private static final int failedDeliveryTag = -1; 10 | 11 | @Getter 12 | private final boolean deliverySuccessful; 13 | @Getter 14 | private final int deliveryTag; 15 | 16 | /** 17 | * Create a return value object containing the delivery status and the delivery hash 18 | * 19 | */ 20 | AmqpsSendResult() 21 | { 22 | this.deliverySuccessful = false; 23 | this.deliveryTag = failedDeliveryTag; 24 | } 25 | 26 | AmqpsSendResult(byte[] deliveryTag) 27 | { 28 | this.deliverySuccessful = true; 29 | this.deliveryTag = Integer.parseInt(new String(deliveryTag, StandardCharsets.UTF_8)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/AuthenticationMessageCallback.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device.transport.amqps; 2 | 3 | import org.apache.qpid.proton.amqp.transport.DeliveryState; 4 | import org.apache.qpid.proton.reactor.Reactor; 5 | 6 | interface AuthenticationMessageCallback 7 | { 8 | DeliveryState handleAuthenticationResponseMessage(int status, String description, Reactor reactor); 9 | } 10 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/ReactorRunnerStateCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package com.microsoft.azure.sdk.iot.device.transport.amqps; 5 | 6 | /** 7 | * Callback for all Reactor level events that our AMQP code should handle 8 | */ 9 | interface ReactorRunnerStateCallback 10 | { 11 | /** 12 | * Executed when the proton-j reactor closed unexpectedly. For example, if the reactor encountered a runtime 13 | * exception and threw a handler exception at the ReactorRunner class. 14 | */ 15 | void onReactorClosedUnexpectedly(); 16 | } 17 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/SubscriptionType.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device.transport.amqps; 2 | 3 | enum SubscriptionType 4 | { 5 | DESIRED_PROPERTIES_SUBSCRIPTION 6 | } 7 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/exceptions/AmqpDecodeErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.amqps.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 9 | 10 | /** 11 | * This exception is thrown when a amqp:decode-error is encountered over an AMQP connection 12 | * 13 | For additional details, see this link 14 | */ 15 | public class AmqpDecodeErrorException extends ProtocolException 16 | { 17 | public static final String errorCode = "amqp:decode-error"; 18 | 19 | public AmqpDecodeErrorException() 20 | { 21 | super(); 22 | } 23 | 24 | public AmqpDecodeErrorException(String message) 25 | { 26 | super(message); 27 | } 28 | 29 | public AmqpDecodeErrorException(String message, Throwable cause) 30 | { 31 | super(message, cause); 32 | } 33 | 34 | public AmqpDecodeErrorException(Throwable cause) 35 | { 36 | super(cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/exceptions/AmqpIllegalStateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.amqps.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 9 | 10 | /** 11 | * This exception is thrown when a amqp:illegal-state error is encountered over an AMQP connection 12 | * 13 | For additional details, see this link 14 | */ 15 | public class AmqpIllegalStateException extends ProtocolException 16 | { 17 | public static final String errorCode = "amqp:illegal-state"; 18 | 19 | public AmqpIllegalStateException() 20 | { 21 | super(); 22 | } 23 | 24 | public AmqpIllegalStateException(String message) 25 | { 26 | super(message); 27 | } 28 | 29 | public AmqpIllegalStateException(String message, Throwable cause) 30 | { 31 | super(message, cause); 32 | } 33 | 34 | public AmqpIllegalStateException(Throwable cause) 35 | { 36 | super(cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/exceptions/AmqpInvalidFieldException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.amqps.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 9 | 10 | /** 11 | * This exception is thrown when a amqp:invalid-field error is encountered over an AMQP connection 12 | * 13 | For additional details, see this link 14 | */ 15 | public class AmqpInvalidFieldException extends ProtocolException 16 | { 17 | public static final String errorCode = "amqp:invalid-field"; 18 | 19 | public AmqpInvalidFieldException() 20 | { 21 | super(); 22 | } 23 | 24 | public AmqpInvalidFieldException(String message) 25 | { 26 | super(message); 27 | } 28 | 29 | public AmqpInvalidFieldException(String message, Throwable cause) 30 | { 31 | super(message, cause); 32 | } 33 | 34 | public AmqpInvalidFieldException(Throwable cause) 35 | { 36 | super(cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/exceptions/AmqpLinkCreationConflict.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device.transport.amqps.exceptions; 2 | 3 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 4 | 5 | public class AmqpLinkCreationConflict extends ProtocolException 6 | { 7 | public static final String errorCode = "com.microsoft:link-creation-conflict"; 8 | 9 | public AmqpLinkCreationConflict() 10 | { 11 | super(); 12 | this.isRetryable = true; 13 | } 14 | 15 | public AmqpLinkCreationConflict(String message) 16 | { 17 | super(message); 18 | this.isRetryable = true; 19 | } 20 | 21 | public AmqpLinkCreationConflict(String message, Throwable cause) 22 | { 23 | super(message, cause); 24 | this.isRetryable = true; 25 | } 26 | 27 | public AmqpLinkCreationConflict(Throwable cause) 28 | { 29 | super(cause); 30 | this.isRetryable = true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/exceptions/AmqpNotAllowedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.amqps.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 9 | 10 | /** 11 | * This exception is thrown when a amqp:not-allowed error is encountered over an AMQP connection 12 | * 13 | For additional details, see this link 14 | */ 15 | public class AmqpNotAllowedException extends ProtocolException 16 | { 17 | public static final String errorCode = "amqp:not-allowed"; 18 | 19 | public AmqpNotAllowedException() 20 | { 21 | super(); 22 | } 23 | 24 | public AmqpNotAllowedException(String message) 25 | { 26 | super(message); 27 | } 28 | 29 | public AmqpNotAllowedException(String message, Throwable cause) 30 | { 31 | super(message, cause); 32 | } 33 | 34 | public AmqpNotAllowedException(Throwable cause) 35 | { 36 | super(cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/exceptions/AmqpNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.amqps.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 9 | 10 | /** 11 | * This exception is thrown when a amqp:not-found error is encountered over an AMQP connection 12 | * 13 | For additional details, see this link 14 | */ 15 | public class AmqpNotFoundException extends ProtocolException 16 | { 17 | public static final String errorCode = "amqp:not-found"; 18 | 19 | public AmqpNotFoundException() 20 | { 21 | super(); 22 | } 23 | 24 | public AmqpNotFoundException(String message) 25 | { 26 | super(message); 27 | } 28 | 29 | public AmqpNotFoundException(String message, Throwable cause) 30 | { 31 | super(message, cause); 32 | } 33 | 34 | public AmqpNotFoundException(Throwable cause) 35 | { 36 | super(cause); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/exceptions/ProtonIOException.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device.transport.amqps.exceptions; 2 | 3 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 4 | 5 | public class ProtonIOException extends ProtocolException 6 | { 7 | public static final String errorCode = "proton:io"; 8 | 9 | public ProtonIOException() 10 | { 11 | super(); 12 | this.isRetryable = true; 13 | } 14 | 15 | public ProtonIOException(String message) 16 | { 17 | super(message); 18 | this.isRetryable = true; 19 | } 20 | 21 | public ProtonIOException(String message, Throwable cause) 22 | { 23 | super(message, cause); 24 | this.isRetryable = true; 25 | } 26 | 27 | public ProtonIOException(Throwable cause) 28 | { 29 | super(cause); 30 | this.isRetryable = true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/amqps/package-info.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /** AMQPS IoT Hub transport and communication classes. */ 5 | package com.microsoft.azure.sdk.iot.device.transport.amqps; -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/HttpsMethod.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.device.transport.https; 5 | 6 | /** The HTTPS request method (i.e. GET). */ 7 | public enum HttpsMethod 8 | { 9 | GET, POST, PUT, DELETE 10 | } 11 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/BadFormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 10 | 11 | public class BadFormatException extends IotHubServiceException 12 | { 13 | public BadFormatException() 14 | { 15 | super(); 16 | } 17 | 18 | public BadFormatException(String message) 19 | { 20 | super(message); 21 | } 22 | 23 | public BadFormatException(String message, Throwable cause) 24 | { 25 | super(message, cause); 26 | } 27 | 28 | public BadFormatException(Throwable cause) 29 | { 30 | super(cause); 31 | } 32 | 33 | @Override 34 | public IotHubStatusCode getStatusCode() 35 | { 36 | return IotHubStatusCode.BAD_FORMAT; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/HubOrDeviceIdNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 10 | 11 | public class HubOrDeviceIdNotFoundException extends IotHubServiceException 12 | { 13 | public HubOrDeviceIdNotFoundException() 14 | { 15 | super(); 16 | } 17 | 18 | public HubOrDeviceIdNotFoundException(String message) 19 | { 20 | super(message); 21 | } 22 | 23 | public HubOrDeviceIdNotFoundException(String message, Throwable cause) 24 | { 25 | super(message, cause); 26 | } 27 | 28 | public HubOrDeviceIdNotFoundException(Throwable cause) 29 | { 30 | super(cause); 31 | } 32 | 33 | @Override 34 | public IotHubStatusCode getStatusCode() 35 | { 36 | return IotHubStatusCode.NOT_FOUND; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/PreconditionFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 10 | 11 | public class PreconditionFailedException extends IotHubServiceException 12 | { 13 | public PreconditionFailedException() 14 | { 15 | super(); 16 | } 17 | 18 | public PreconditionFailedException(String message) 19 | { 20 | super(message); 21 | } 22 | 23 | public PreconditionFailedException(String message, Throwable cause) 24 | { 25 | super(message, cause); 26 | } 27 | 28 | public PreconditionFailedException(Throwable cause) 29 | { 30 | super(cause); 31 | } 32 | 33 | @Override 34 | public IotHubStatusCode getStatusCode() 35 | { 36 | return IotHubStatusCode.PRECONDITION_FAILED; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/QuotaExceededException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 10 | 11 | public class QuotaExceededException extends IotHubServiceException 12 | { 13 | public QuotaExceededException() 14 | { 15 | super(); 16 | } 17 | 18 | public QuotaExceededException(String message) 19 | { 20 | super(message); 21 | } 22 | 23 | public QuotaExceededException(String message, Throwable cause) 24 | { 25 | super(message, cause); 26 | } 27 | 28 | public QuotaExceededException(Throwable cause) 29 | { 30 | super(cause); 31 | } 32 | 33 | @Override 34 | public IotHubStatusCode getStatusCode() 35 | { 36 | return IotHubStatusCode.QUOTA_EXCEEDED; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/RequestEntityTooLargeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 10 | 11 | public class RequestEntityTooLargeException extends IotHubServiceException 12 | { 13 | public RequestEntityTooLargeException() 14 | { 15 | super(); 16 | } 17 | 18 | public RequestEntityTooLargeException(String message) 19 | { 20 | super(message); 21 | } 22 | 23 | public RequestEntityTooLargeException(String message, Throwable cause) 24 | { 25 | super(message, cause); 26 | } 27 | 28 | public RequestEntityTooLargeException(Throwable cause) 29 | { 30 | super(cause); 31 | } 32 | 33 | @Override 34 | public IotHubStatusCode getStatusCode() 35 | { 36 | return IotHubStatusCode.REQUEST_ENTITY_TOO_LARGE; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/ServerBusyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 10 | 11 | public class ServerBusyException extends IotHubServiceException 12 | { 13 | public ServerBusyException() 14 | { 15 | super(); 16 | this.isRetryable = true; 17 | } 18 | 19 | public ServerBusyException(String message) 20 | { 21 | super(message); 22 | this.isRetryable = true; 23 | } 24 | 25 | public ServerBusyException(String message, Throwable cause) 26 | { 27 | super(message, cause); 28 | this.isRetryable = true; 29 | } 30 | 31 | public ServerBusyException(Throwable cause) 32 | { 33 | super(cause); 34 | this.isRetryable = true; 35 | } 36 | 37 | @Override 38 | public IotHubStatusCode getStatusCode() 39 | { 40 | return IotHubStatusCode.SERVER_BUSY; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/ServiceUnknownException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 9 | 10 | public class ServiceUnknownException extends IotHubServiceException 11 | { 12 | public ServiceUnknownException() 13 | { 14 | super(); 15 | } 16 | 17 | public ServiceUnknownException(String message) 18 | { 19 | super(message); 20 | } 21 | 22 | public ServiceUnknownException(String message, Throwable cause) 23 | { 24 | super(message, cause); 25 | } 26 | 27 | public ServiceUnknownException(Throwable cause) 28 | { 29 | super(cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/ThrottledException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 10 | 11 | public class ThrottledException extends IotHubServiceException 12 | { 13 | public ThrottledException() 14 | { 15 | super(); 16 | this.isRetryable = true; 17 | } 18 | 19 | public ThrottledException(String message) 20 | { 21 | super(message); 22 | this.isRetryable = true; 23 | } 24 | 25 | public ThrottledException(String message, Throwable cause) 26 | { 27 | super(message, cause); 28 | this.isRetryable = true; 29 | } 30 | 31 | public ThrottledException(Throwable cause) 32 | { 33 | super(cause); 34 | this.isRetryable = true; 35 | } 36 | 37 | @Override 38 | public IotHubStatusCode getStatusCode() 39 | { 40 | return IotHubStatusCode.THROTTLED; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/exceptions/UnauthorizedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.https.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.IotHubStatusCode; 9 | import com.microsoft.azure.sdk.iot.device.transport.IotHubServiceException; 10 | 11 | public class UnauthorizedException extends IotHubServiceException 12 | { 13 | public UnauthorizedException() 14 | { 15 | super(); 16 | } 17 | 18 | public UnauthorizedException(String message) 19 | { 20 | super(message); 21 | } 22 | 23 | public UnauthorizedException(String message, Throwable cause) 24 | { 25 | super(message, cause); 26 | } 27 | 28 | public UnauthorizedException(Throwable cause) 29 | { 30 | super(cause); 31 | } 32 | 33 | @Override 34 | public IotHubStatusCode getStatusCode() 35 | { 36 | return IotHubStatusCode.UNAUTHORIZED; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/https/package-info.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /** HTTPS IoT Hub transport and communication classes. */ 5 | package com.microsoft.azure.sdk.iot.device.transport.https; -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/mqtt/MqttMessageListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.mqtt; 7 | 8 | interface MqttMessageListener 9 | { 10 | void onMessageArrived(int messageId); 11 | } 12 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/mqtt/exceptions/MqttUnauthorizedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.mqtt.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 9 | 10 | /** 11 | * This exception is thrown when an MQTT Connection Return code of 0x05 is encountered when opening an MQTT connection 12 | * 13 | * 14 | * MQTT Connect Return Code Documentation 15 | */ 16 | public class MqttUnauthorizedException extends ProtocolException 17 | { 18 | public MqttUnauthorizedException() 19 | { 20 | super(); 21 | } 22 | 23 | public MqttUnauthorizedException(String message) 24 | { 25 | super(message); 26 | } 27 | 28 | public MqttUnauthorizedException(String message, Throwable cause) 29 | { 30 | super(message, cause); 31 | } 32 | 33 | public MqttUnauthorizedException(Throwable cause) 34 | { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/mqtt/exceptions/MqttUnexpectedErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.transport.mqtt.exceptions; 7 | 8 | import com.microsoft.azure.sdk.iot.device.transport.ProtocolException; 9 | 10 | /** 11 | * This exception is thrown when an unrecognized MQTT Connection code is returned when opening an MQTT connection 12 | * 13 | * 14 | * MQTT Connect Return Code Documentation 15 | */ 16 | public class MqttUnexpectedErrorException extends ProtocolException 17 | { 18 | public MqttUnexpectedErrorException() 19 | { 20 | super(); 21 | } 22 | 23 | public MqttUnexpectedErrorException(String message) 24 | { 25 | super(message); 26 | } 27 | 28 | public MqttUnexpectedErrorException(String message, Throwable cause) 29 | { 30 | super(message, cause); 31 | } 32 | 33 | public MqttUnexpectedErrorException(Throwable cause) 34 | { 35 | super(cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/transport/package-info.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | /** 5 | * A transport for sending and receiving IoT Hub messages, along with supporting 6 | * functionality. 7 | */ 8 | package com.microsoft.azure.sdk.iot.device.transport; -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/twin/DesiredPropertiesCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package com.microsoft.azure.sdk.iot.device.twin; 5 | 6 | /** 7 | * The callback to be executed each time the client receives a desired property update from the service. 8 | */ 9 | public interface DesiredPropertiesCallback 10 | { 11 | /** 12 | * The callback to be executed each time the client receives a desired property update from the service. 13 | * 14 | * @param twin A {@link Twin} instance containing the updated desired properties. 15 | * @param context The context that was provided for this callback in 16 | * {@link com.microsoft.azure.sdk.iot.device.InternalClient#subscribeToDesiredPropertiesAsync(DesiredPropertiesCallback, Object, SubscriptionAcknowledgedCallback, Object)} 17 | */ 18 | void onDesiredPropertiesUpdated(Twin twin, Object context); 19 | } 20 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/twin/DeviceOperations.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.device.twin; 5 | 6 | public enum DeviceOperations 7 | { 8 | DEVICE_OPERATION_TWIN_GET_REQUEST, 9 | DEVICE_OPERATION_TWIN_GET_RESPONSE, 10 | DEVICE_OPERATION_TWIN_UPDATE_REPORTED_PROPERTIES_REQUEST, 11 | DEVICE_OPERATION_TWIN_UPDATE_REPORTED_PROPERTIES_RESPONSE, 12 | DEVICE_OPERATION_TWIN_SUBSCRIBE_DESIRED_PROPERTIES_REQUEST, 13 | DEVICE_OPERATION_TWIN_SUBSCRIBE_DESIRED_PROPERTIES_RESPONSE, 14 | DEVICE_OPERATION_TWIN_UNSUBSCRIBE_DESIRED_PROPERTIES_REQUEST, 15 | DEVICE_OPERATION_TWIN_UNSUBSCRIBE_DESIRED_PROPERTIES_RESPONSE, 16 | DEVICE_OPERATION_METHOD_SUBSCRIBE_REQUEST, 17 | DEVICE_OPERATION_METHOD_SUBSCRIBE_RESPONSE, 18 | DEVICE_OPERATION_METHOD_RECEIVE_REQUEST, 19 | DEVICE_OPERATION_METHOD_SEND_RESPONSE, 20 | DEVICE_OPERATION_UNKNOWN 21 | } 22 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/twin/GetTwinCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package com.microsoft.azure.sdk.iot.device.twin; 5 | 6 | import com.microsoft.azure.sdk.iot.device.exceptions.IotHubClientException; 7 | 8 | /** 9 | * The callback to be executed when the service responds to a getTwin request with the current twin. 10 | */ 11 | public interface GetTwinCallback 12 | { 13 | /** 14 | * The callback to be executed when the service responds to a getTwin request with the current twin. 15 | * @param twin The current twin. 16 | * @param context The context that was provided for this callback in 17 | * {@link com.microsoft.azure.sdk.iot.device.InternalClient#getTwinAsync(GetTwinCallback, Object)}. 18 | */ 19 | void onTwinReceived(Twin twin, IotHubClientException clientException, Object context); 20 | } 21 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/twin/MethodCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.device.twin; 5 | 6 | /** 7 | * The callback to be executed each time a direct method is invoked on this client. 8 | */ 9 | public interface MethodCallback 10 | { 11 | /** 12 | * The 13 | * @param methodName The name of the method being invoked. 14 | * @param methodPayload The payload of the method being invoked. May be null 15 | * @param context The context set when subscribing to direct methods. Will be null if no context was set when subscribing. 16 | * @return The direct method response to deliver to the process that invoked this method. May not be null. 17 | */ 18 | DirectMethodResponse onMethodInvoked(String methodName, DirectMethodPayload methodPayload, Object context); 19 | } 20 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/twin/ReportedPropertiesUpdateResponse.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.device.twin; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * The response fields for a reported properties update request. 8 | */ 9 | @AllArgsConstructor 10 | public class ReportedPropertiesUpdateResponse 11 | { 12 | /** 13 | * The new version of the reported properties after a successful reported properties update. If the client updating 14 | * its reported properties is connected to Edgehub instead of IoT Hub, then this version won't change since Edgehub 15 | * does not apply this reported properties update immediately. 16 | */ 17 | @Getter 18 | private final Integer version; 19 | } 20 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/twin/SubscriptionAcknowledgedCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | package com.microsoft.azure.sdk.iot.device.twin; 5 | 6 | import com.microsoft.azure.sdk.iot.device.exceptions.IotHubClientException; 7 | 8 | /** 9 | * Callback to be executed when the request to subscribe to desired properties has been acknowledged by the service. 10 | */ 11 | public interface SubscriptionAcknowledgedCallback 12 | { 13 | /** 14 | * The callback that is executed when the request to subscribe to desired properties or direct methodshas been 15 | * acknowledged by the service. 16 | * @param context The context that was provided for this callback in 17 | * {@link com.microsoft.azure.sdk.iot.device.InternalClient#subscribeToDesiredPropertiesAsync(DesiredPropertiesCallback, Object, SubscriptionAcknowledgedCallback, Object)} 18 | * or in {@link com.microsoft.azure.sdk.iot.device.InternalClient#subscribeToMethodsAsync(MethodCallback, Object, SubscriptionAcknowledgedCallback, Object)}. 19 | */ 20 | void onSubscriptionAcknowledged(IotHubClientException exception, Object context); 21 | } 22 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/twin/Tools.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.twin; 7 | 8 | /** 9 | * Collection of static helper functions 10 | */ 11 | class Tools 12 | { 13 | /** 14 | * Helper function to check if the input string is null or empty 15 | * 16 | * @param value The string to check 17 | * @return The value true if the input string is empty or null 18 | */ 19 | static Boolean isNullOrEmpty(String value) 20 | { 21 | boolean retVal; 22 | 23 | if (value == null) 24 | retVal = true; 25 | else 26 | retVal = value.length() == 0; 27 | 28 | return retVal; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/main/resources/iothub-device-client.properties: -------------------------------------------------------------------------------- 1 | artifactId=${project.artifactId} 2 | groupId=${project.groupId} 3 | version=${project.version} 4 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/test/java/com/microsoft/azure/sdk/iot/device/auth/IotHubX509SoftwareIotHubAuthenticationProviderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.auth; 7 | 8 | /** 9 | * Unit tests for IotHubX509SoftwareAuthenticationProvider.java 10 | * Methods: 100% 11 | * Lines: 100% 12 | */ 13 | public class IotHubX509SoftwareIotHubAuthenticationProviderTest 14 | { 15 | } 16 | 17 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/test/java/com/microsoft/azure/sdk/iot/device/hsm/parser/ErrorResponseTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.hsm.parser; 7 | 8 | import mockit.Deencapsulation; 9 | import org.junit.Test; 10 | 11 | import static junit.framework.TestCase.assertEquals; 12 | 13 | public class ErrorResponseTest 14 | { 15 | // Tests_SRS_HTTPHSMERRORRESPONSE_34_001: [This function shall return the saved message.] 16 | @Test 17 | public void getMessageWorks() 18 | { 19 | //arrange 20 | String expectedMessage = "some error message"; 21 | ErrorResponse errorResponse = new ErrorResponse(); 22 | Deencapsulation.setField(errorResponse, "message", expectedMessage); 23 | 24 | //act 25 | String actualMessage = errorResponse.getMessage(); 26 | 27 | //assert 28 | assertEquals(expectedMessage, actualMessage); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/test/java/com/microsoft/azure/sdk/iot/device/hsm/parser/SignResponseTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.device.hsm.parser; 7 | 8 | import mockit.Deencapsulation; 9 | import org.junit.Test; 10 | 11 | import static junit.framework.TestCase.assertEquals; 12 | 13 | public class SignResponseTest 14 | { 15 | // Tests_SRS_HTTPHSMSIGNRESPONSE_34_001: [This function shall return the saved digest.] 16 | @Test 17 | public void getDigestWorks() 18 | { 19 | //arrange 20 | String expectedDigest = "some digest"; 21 | SignResponse response = new SignResponse(); 22 | Deencapsulation.setField(response, "digest", expectedDigest); 23 | 24 | //act 25 | String actualDigest = response.getDigest(); 26 | 27 | //assert 28 | assertEquals(expectedDigest, actualDigest); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /iothub/device/iot-device-client/src/test/java/com/microsoft/azure/sdk/iot/device/transport/RetryDecisionTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.device.transport; 5 | 6 | import org.junit.Test; 7 | import static org.junit.Assert.*; 8 | 9 | public class RetryDecisionTest 10 | { 11 | // Tests_SRS_RETRYDECISION_28_001: [The constructor shall save the duration and getRetryDecision] 12 | // Tests_SRS_RETRYDECISION_28_002: [The function shall return the value of getRetryDecision] 13 | // Tests_SRS_RETRYDECISION_28_003: [The function shall return the value of duration] 14 | @Test 15 | public void constructorSavesParameters() 16 | { 17 | //act 18 | final RetryDecision retryDecisionTest = new RetryDecision(true, 10); 19 | 20 | // assert 21 | assertTrue(retryDecisionTest.shouldRetry()); 22 | assertEquals(10, retryDecisionTest.getDuration()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/iothub/device/iot-device-samples/android-sample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Azure IoT Sample 3 | 4 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.2' 10 | 11 | // NOTE: Do not place your application dependencies here; they belong 12 | // in the individual module build.gradle files 13 | } 14 | 15 | dependencies { 16 | classpath 'net.sf.proguard:proguard-gradle:6.2.2' 17 | } 18 | } 19 | 20 | allprojects { 21 | repositories { 22 | google() 23 | jcenter() 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/android-sample/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/custom-sas-token-provider-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/device-reconnection-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/device-twin-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/direct-method-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/file-upload-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/handle-messages/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/module-invoke-method-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/module-method-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/module-twin-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/multiplexing-sample/src/main/java/samples/com/microsoft/azure/sdk/iot/ConnectionStatus.java: -------------------------------------------------------------------------------- 1 | package samples.com.microsoft.azure.sdk.iot; 2 | 3 | public enum ConnectionStatus 4 | { 5 | // Either the connection is closed or is in a state where the ClientManager will not attempt to reconnect. 6 | DISCONNECTED, 7 | 8 | // The client manager is attempting to reconnect. 9 | CONNECTING, 10 | 11 | // The connection is established successfully. 12 | CONNECTED 13 | } 14 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/multiplexing-sample/src/main/java/samples/com/microsoft/azure/sdk/iot/ConnectionStatusTracker.java: -------------------------------------------------------------------------------- 1 | package samples.com.microsoft.azure.sdk.iot; 2 | 3 | /** 4 | * Allows for getting a connection status from implementing classes. 5 | */ 6 | public interface ConnectionStatusTracker 7 | { 8 | /** 9 | * Gets connection status {@link ConnectionStatus} of the implementing object 10 | */ 11 | ConnectionStatus getConnectionStatus(); 12 | } 13 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/multiplexing-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/pnp-device-sample/temperature-controller-device-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/pnp-device-sample/thermostat-device-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/send-batch-events/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/send-event-with-proxy/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/send-event-x509/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/send-event/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/send-receive-module-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/send-receive-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/send-receive-x509-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/unix-domain-socket-sample/README.md: -------------------------------------------------------------------------------- 1 | # Unix Domain Socket Implementation Sample 2 | 3 | This sample code demonstrates one possible implementation of the [UnixDomainSocketChannel][unix-domain-socket-channel-interface] interface defined by this SDK. 4 | 5 | This implementation uses [JNR Unixsocket][jnr-unixsocket-github], but there are other available libraries that provide 6 | unix domain socket capabilities. 7 | 8 | [unix-domain-socket-channel-interface]: ../../iot-device-client/src/main/java/com/microsoft/azure/sdk/iot/device/hsm/UnixDomainSocketChannel.java 9 | [jnr-unixsocket-github]: https://github.com/jnr/jnr-unixsocket 10 | 11 | 12 | -------------------------------------------------------------------------------- /iothub/device/iot-device-samples/unix-domain-socket-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /iothub/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | iot-sdk-java 7 | com.microsoft.azure.sdk.iot 8 | 1.0.0 9 | 10 | 4.0.0 11 | iothub 12 | 1.0.0 13 | IoT Hub Java Device Client Parent 14 | pom 15 | 16 | 17 | microsoft 18 | Microsoft 19 | 20 | 21 | 22 | device 23 | 24 | 25 | 26 | 8 27 | 8 28 | 29 | 30 | -------------------------------------------------------------------------------- /lts_branches.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/lts_branches.png -------------------------------------------------------------------------------- /provisioning/pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | com.microsoft.azure.sdk.iot 9 | iot-sdk-java 10 | 1.0.0 11 | 12 | 4.0.0 13 | com.microsoft.azure.sdk.iot.provisioning 14 | provisioning 15 | Provisioning Client 16 | 1.0.0 17 | pom 18 | The Microsoft Azure IoT Provisioning Client SDK for Java 19 | http://azure.github.io/azure-iot-sdk-java/ 20 | 21 | provisioning-device-client 22 | provisioning-service-client 23 | security 24 | provisioning-device-client-samples 25 | provisioning-service-client-samples 26 | provisioning-tools 27 | 28 | 29 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client-samples/provisioning-X509-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /provisioning/provisioning-device-client-samples/provisioning-symmetrickey-group-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /provisioning/provisioning-device-client-samples/provisioning-symmetrickey-individual-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /provisioning/provisioning-device-client-samples/provisioning-tpm-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/AdditionalData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device; 9 | 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | 13 | public class AdditionalData 14 | { 15 | /** 16 | * The custom provisioning provisioningPayload to send to DPS during the registration process. 17 | */ 18 | @Getter 19 | @Setter 20 | private String provisioningPayload; 21 | } 22 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/ProvisioningDeviceClientRegistrationCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device; 9 | 10 | public interface ProvisioningDeviceClientRegistrationCallback 11 | { 12 | /** 13 | * Callback user to provide registration results such as iothub uri, device id or any exception thrown during the process of registration 14 | * @param provisioningDeviceClientRegistrationResult An object that holds information about the registration result 15 | * @param e Exception thrown during the process of registration. Can be {@code null}. 16 | * @param context Context for this callback 17 | */ 18 | void run(ProvisioningDeviceClientRegistrationResult provisioningDeviceClientRegistrationResult, Exception e, Object context); 19 | } 20 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/ProvisioningDeviceClientRegistrationResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device; 9 | 10 | import lombok.Getter; 11 | import lombok.NoArgsConstructor; 12 | 13 | @NoArgsConstructor 14 | public class ProvisioningDeviceClientRegistrationResult 15 | { 16 | @Getter 17 | protected String iothubUri; 18 | 19 | @Getter 20 | protected String registrationId; 21 | 22 | @Getter 23 | protected String createdDateTimeUtc; 24 | 25 | @Getter 26 | protected String status; 27 | 28 | @Getter 29 | protected ProvisioningDeviceClientSubstatus substatus; 30 | 31 | @Getter 32 | protected String eTag; 33 | 34 | @Getter 35 | protected String lastUpdatesDateTimeUtc; 36 | 37 | @Getter 38 | protected String deviceId; 39 | 40 | @Getter 41 | protected ProvisioningDeviceClientStatus provisioningDeviceClientStatus; 42 | 43 | @Getter 44 | protected String provisioningPayload; 45 | } 46 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/ProvisioningDeviceClientStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device; 9 | 10 | public enum ProvisioningDeviceClientStatus 11 | { 12 | PROVISIONING_DEVICE_STATUS_ERROR, 13 | PROVISIONING_DEVICE_STATUS_DISABLED, 14 | PROVISIONING_DEVICE_STATUS_FAILED, 15 | PROVISIONING_DEVICE_STATUS_ASSIGNED, 16 | } 17 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/ProvisioningDeviceClientTransportProtocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device; 9 | 10 | public enum ProvisioningDeviceClientTransportProtocol 11 | { 12 | HTTPS, 13 | MQTT, 14 | MQTT_WS, 15 | AMQPS, 16 | AMQPS_WS 17 | } 18 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/ObjectLock.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.device.internal; 5 | 6 | /** This class enables mocking of the base class wait and notify functions 7 | */ 8 | public class ObjectLock 9 | { 10 | public void waitLock(long timeout) throws InterruptedException 11 | { 12 | this.wait(timeout); 13 | } 14 | 15 | public void notifyLock() 16 | { 17 | this.notify(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/contract/ResponseCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.contract; 9 | 10 | import com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions.ProvisioningDeviceClientException; 11 | import com.microsoft.azure.sdk.iot.provisioning.device.internal.task.ResponseData; 12 | 13 | public interface ResponseCallback 14 | { 15 | void run(ResponseData responseData, Object context) throws ProvisioningDeviceClientException; 16 | } 17 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/exceptions/ProvisioningDeviceClientAuthenticationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions; 9 | 10 | public class ProvisioningDeviceClientAuthenticationException extends ProvisioningDeviceClientException 11 | { 12 | public ProvisioningDeviceClientAuthenticationException(String message) 13 | { 14 | super(message); 15 | } 16 | 17 | public ProvisioningDeviceClientAuthenticationException(String message, Throwable cause) 18 | { 19 | super(message, cause); 20 | } 21 | 22 | public ProvisioningDeviceClientAuthenticationException(Throwable cause) 23 | { 24 | super(cause); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/exceptions/ProvisioningDeviceClientException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions; 9 | 10 | public class ProvisioningDeviceClientException extends Exception 11 | { 12 | public ProvisioningDeviceClientException(String message) 13 | { 14 | super(message); 15 | } 16 | 17 | public ProvisioningDeviceClientException(String message, Throwable cause) 18 | { 19 | super(message, cause); 20 | } 21 | 22 | public ProvisioningDeviceClientException(Throwable cause) 23 | { 24 | super(cause); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/exceptions/ProvisioningDeviceConnectionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions; 9 | 10 | public class ProvisioningDeviceConnectionException extends ProvisioningDeviceTransportException 11 | { 12 | public ProvisioningDeviceConnectionException(String message, Throwable cause) 13 | { 14 | super(message, cause); 15 | } 16 | 17 | public ProvisioningDeviceConnectionException(Throwable cause) 18 | { 19 | super(cause); 20 | } 21 | 22 | public ProvisioningDeviceConnectionException(String message) 23 | { 24 | super(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/exceptions/ProvisioningDeviceHubException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions; 9 | 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | 13 | public class ProvisioningDeviceHubException extends ProvisioningDeviceClientException 14 | { 15 | public ProvisioningDeviceHubException(String message) 16 | { 17 | super(message); 18 | } 19 | 20 | public ProvisioningDeviceHubException(String message, Throwable cause) 21 | { 22 | super(message, cause); 23 | } 24 | 25 | public ProvisioningDeviceHubException(Throwable cause) 26 | { 27 | super(cause); 28 | } 29 | 30 | /** 31 | * The error code sent from the service to clarify what exception occurred. 32 | */ 33 | @Getter 34 | @Setter 35 | private int errorCode; 36 | } 37 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/exceptions/ProvisioningDeviceSecurityException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions; 9 | 10 | public class ProvisioningDeviceSecurityException extends ProvisioningDeviceClientException 11 | { 12 | public ProvisioningDeviceSecurityException(String message) 13 | { 14 | super(message); 15 | } 16 | 17 | public ProvisioningDeviceSecurityException(String message, Throwable cause) 18 | { 19 | super(message, cause); 20 | } 21 | 22 | public ProvisioningDeviceSecurityException(Throwable cause) 23 | { 24 | super(cause); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/exceptions/ProvisioningDeviceTransportException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions; 9 | 10 | public class ProvisioningDeviceTransportException extends ProvisioningDeviceClientException 11 | { 12 | public ProvisioningDeviceTransportException(String message) 13 | { 14 | super(message); 15 | } 16 | 17 | public ProvisioningDeviceTransportException(String message, Throwable cause) 18 | { 19 | super(message, cause); 20 | } 21 | 22 | public ProvisioningDeviceTransportException(Throwable cause) 23 | { 24 | super(cause); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/task/Authorization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.task; 9 | 10 | import lombok.AccessLevel; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | 14 | import javax.net.ssl.SSLContext; 15 | 16 | public class Authorization 17 | { 18 | @Getter(AccessLevel.PACKAGE) 19 | @Setter(AccessLevel.PACKAGE) 20 | private String sasToken; 21 | 22 | @Getter(AccessLevel.PACKAGE) 23 | @Setter(AccessLevel.PACKAGE) 24 | private SSLContext sslContext; 25 | 26 | /** 27 | * Constructor to create {@code null} SSLContext and SasToken 28 | */ 29 | Authorization() 30 | { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/task/ContractState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.task; 9 | 10 | public enum ContractState 11 | { 12 | DPS_REGISTRATION_RECEIVED, 13 | DPS_REGISTRATION_UNKNOWN 14 | } 15 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/transport/amqp/AmqpListener.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.device.transport.amqp; 5 | 6 | public interface AmqpListener 7 | { 8 | void messageReceived(AmqpMessage message); 9 | 10 | void messageSendFailed(String exceptionMessage); 11 | } 12 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/transport/https/HttpMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.device.transport.https; 7 | 8 | /** 9 | * An HTTPS message. An HTTPS message is distinguished from a plain IoT Hub 10 | * message by its property names, which are prefixed with 'iothub-app-'; 11 | * and by the explicit specification of a content-type. 12 | */ 13 | public interface HttpMessage 14 | { 15 | /** 16 | * Gets the message body. 17 | * @return The message body. 18 | */ 19 | byte[] getBody(); 20 | 21 | /** 22 | * Gets the content type string. 23 | * @return The message content-type. 24 | */ 25 | String getContentType(); 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/transport/https/HttpMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.device.transport.https; 7 | 8 | /** The HTTPS request method (i.e. GET). */ 9 | public enum HttpMethod 10 | { 11 | GET, POST, PUT, DELETE, PATCH 12 | } 13 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/transport/mqtt/MqttListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.device.transport.mqtt; 7 | 8 | public interface MqttListener 9 | { 10 | /** 11 | * Called when the message gets received by PAHO 12 | * @param message the received Mqtt message 13 | */ 14 | void messageReceived(MqttMessage message); 15 | 16 | /** 17 | * Called by PAHO when the connection is lost 18 | * @param throwable the disconnection reason. 19 | */ 20 | void connectionLost(Throwable throwable); 21 | } 22 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/transport/mqtt/MqttQos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.device.transport.mqtt; 7 | 8 | public enum MqttQos 9 | { 10 | DELIVER_AT_MOST_ONCE, 11 | DELIVER_AT_LEAST_ONCE, 12 | DELIVER_EXACTLY_ONCE, 13 | DELIVER_FAILURE, 14 | DELIVER_UNKNOWN 15 | } 16 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/main/resources/provisioning-device-client.properties: -------------------------------------------------------------------------------- 1 | artifactId=${project.artifactId} 2 | groupId=${project.groupId} 3 | version=${project.version} 4 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/test/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/parser/DeviceRegistrationResultParserTest.java: -------------------------------------------------------------------------------- 1 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.parser; 2 | 3 | public class DeviceRegistrationResultParserTest 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/test/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/task/RegistrationInfoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.device.internal.task; 9 | 10 | public class RegistrationInfoTest 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /provisioning/provisioning-device-client/src/test/java/com/microsoft/azure/sdk/iot/provisioning/device/transport/amqp/ErrorLoggingBaseHandlerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.device.transport.amqp; 7 | 8 | import mockit.Expectations; 9 | import mockit.Mocked; 10 | import org.apache.qpid.proton.engine.Event; 11 | import org.junit.Test; 12 | 13 | public class ErrorLoggingBaseHandlerTest 14 | { 15 | @Mocked Event mockEvent; 16 | 17 | @Mocked 18 | ProtonJExceptionParser mockProtonJExceptionParser; 19 | 20 | @Test 21 | public void onTransportErrorParsesError() 22 | { 23 | new Expectations() 24 | { 25 | { 26 | new ProtonJExceptionParser(mockEvent); 27 | result = mockProtonJExceptionParser; 28 | 29 | mockProtonJExceptionParser.getError(); 30 | result = "amqp:io"; 31 | } 32 | }; 33 | 34 | ErrorLoggingBaseHandler errorLoggingBaseHandler = new ErrorLoggingBaseHandler(); 35 | errorLoggingBaseHandler.onTransportError(mockEvent); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client-samples/service-bulkoperation-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /provisioning/provisioning-service-client-samples/service-enrollment-group-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /provisioning/provisioning-service-client-samples/service-enrollment-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /provisioning/provisioning-service-client-samples/service-update-enrollment-sample/src/main/resources/log4j2.properties: -------------------------------------------------------------------------------- 1 | status = error 2 | name = Log4j2PropertiesConfig 3 | 4 | appenders = console 5 | 6 | appender.console.type = Console 7 | appender.console.name = LogToConsole 8 | appender.console.layout.type = PatternLayout 9 | appender.console.layout.pattern = %d %p (%t) [%c] - %m%n 10 | 11 | rootLogger.level = debug 12 | rootLogger.appenderRefs = stdout 13 | rootLogger.appenderRef.stdout.ref = LogToConsole -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/Tools.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service; 7 | 8 | /** 9 | * Collection of static helper functions 10 | */ 11 | class Tools 12 | { 13 | /** 14 | * Helper function to check if the input string is null or empty 15 | * 16 | * @param value The string to check 17 | * @return The value true if the input string is empty or null 18 | */ 19 | static Boolean isNullOrEmpty(String value) 20 | { 21 | boolean retVal; 22 | 23 | if (value == null) 24 | retVal = true; 25 | else 26 | retVal = value.length() == 0; 27 | 28 | return retVal; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/configs/AllocationPolicy.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.service.configs; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * The Device Provisioning Service enrollment level allocation policies. 12 | * 13 | * @see 14 | * Provision devices across load-balanced IoT hubs 15 | */ 16 | public enum AllocationPolicy implements Serializable 17 | { 18 | @SerializedName("hashed") 19 | HASHED, 20 | 21 | @SerializedName("geoLatency") 22 | GEOLATENCY, 23 | 24 | @SerializedName("static") 25 | STATIC, 26 | 27 | @SerializedName("custom") 28 | CUSTOM 29 | } 30 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/configs/Attestation.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.service.configs; 5 | 6 | /** 7 | * This is the abstract class that unifies all possible types of attestation that Device Provisioning Service supports. 8 | * 9 | *

For now, the provisioning service supports {@link TpmAttestation} or {@link X509Attestation}. 10 | * 11 | * @see Device Enrollment 12 | */ 13 | public abstract class Attestation 14 | { 15 | // Abstract class fully implemented by the child. 16 | } 17 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/configs/AttestationMechanismType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.service.configs; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * Type of Device Provisioning Service attestation mechanism. 10 | * 11 | * @see Device Enrollment 12 | */ 13 | public enum AttestationMechanismType 14 | { 15 | @SerializedName("none") // There is no valid scenario for `NONE` Attestation Mechanism Type. 16 | NONE, 17 | 18 | @SerializedName("tpm") 19 | TPM, 20 | 21 | @SerializedName("x509") 22 | X509, 23 | 24 | @SerializedName("symmetricKey") 25 | SYMMETRIC_KEY, 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/configs/BulkOperationMode.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.service.configs; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * The Device Provisioning Service bulk operation modes. 10 | * 11 | * @see Device Enrollment 12 | */ 13 | @SuppressWarnings("unused") // used by reflection during json serialization/deserialization 14 | public enum BulkOperationMode 15 | { 16 | @SerializedName("create") 17 | CREATE, 18 | 19 | @SerializedName("update") 20 | UPDATE, 21 | 22 | @SerializedName("updateIfMatchETag") 23 | UPDATE_IF_MATCH_ETAG, 24 | 25 | @SerializedName("delete") 26 | DELETE 27 | } 28 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/configs/CustomAllocationDefinition.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.service.configs; 5 | 6 | import com.google.gson.annotations.Expose; 7 | import com.google.gson.annotations.SerializedName; 8 | import lombok.Getter; 9 | import lombok.Setter; 10 | 11 | import java.io.Serializable; 12 | 13 | public class CustomAllocationDefinition implements Serializable 14 | { 15 | // the webhook url for allocation requests 16 | private static final String WEBHOOK_URL_TAG = "webhookUrl"; 17 | @Expose 18 | @SerializedName(WEBHOOK_URL_TAG) 19 | @Getter 20 | @Setter 21 | private String webhookUrl; 22 | 23 | // the API version of the provisioning service types (such as IndividualEnrollment) sent in the custom allocation request. 24 | private static final String API_VERSION_TAG = "apiVersion"; 25 | @Expose 26 | @SerializedName(API_VERSION_TAG) 27 | @Getter 28 | @Setter 29 | private String apiVersion; 30 | } 31 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/configs/EnrollmentStatus.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.service.configs; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * The Device Provisioning Service enrollment status. 12 | * 13 | * @see Device Enrollment 14 | */ 15 | public enum EnrollmentStatus implements Serializable 16 | { 17 | @SerializedName("unassigned") 18 | UNASSIGNED, 19 | 20 | @SerializedName("assigning") 21 | ASSIGNING, 22 | 23 | @SerializedName("assigned") 24 | ASSIGNED, 25 | 26 | @SerializedName("failed") 27 | FAILED, 28 | 29 | @SerializedName("disabled") 30 | DISABLED, 31 | } 32 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/configs/ProvisioningStatus.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | package com.microsoft.azure.sdk.iot.provisioning.service.configs; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * The Device Provisioning Service provisioning status. 12 | * 13 | * @see Device Enrollment 14 | */ 15 | public enum ProvisioningStatus implements Serializable 16 | { 17 | @SerializedName("enabled") 18 | ENABLED, 19 | 20 | @SerializedName("disabled") 21 | DISABLED, 22 | } 23 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/exceptions/ProvisioningServiceClientBadFormatException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.exceptions; 7 | 8 | /** 9 | * Create bad message format exception 10 | * 11 | *

The body of the Http request is not valid; for example, it cannot be parsed, or the object cannot be validated. 12 | *

HTTP status code 400. 13 | */ 14 | public class ProvisioningServiceClientBadFormatException extends ProvisioningServiceClientBadUsageException 15 | { 16 | public ProvisioningServiceClientBadFormatException() 17 | { 18 | super(); 19 | } 20 | 21 | public ProvisioningServiceClientBadFormatException(String message) 22 | { 23 | super("Bad message format!" + (((message == null) || message.isEmpty()) ? "" : " " + message)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/exceptions/ProvisioningServiceClientInternalServerErrorException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.exceptions; 7 | 8 | /** 9 | * Create internal server error exception 10 | * 11 | *

An internal error occurred. 12 | *

HTTP status code 500. 13 | */ 14 | public class ProvisioningServiceClientInternalServerErrorException extends ProvisioningServiceClientTransientException 15 | { 16 | public ProvisioningServiceClientInternalServerErrorException() 17 | { 18 | super(); 19 | } 20 | 21 | public ProvisioningServiceClientInternalServerErrorException(String message) 22 | { 23 | super("Internal server error!" + (((message == null) || message.isEmpty()) ? "" : " " + message)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/exceptions/ProvisioningServiceClientNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.exceptions; 7 | 8 | /** 9 | * Create Device Provisioning Service not found exception 10 | * 11 | *

The Device Provisioning Service instance, or a resource (e.g. an enrollment) does not exist. 12 | *

HTTP status code 404. 13 | */ 14 | public class ProvisioningServiceClientNotFoundException extends ProvisioningServiceClientBadUsageException 15 | { 16 | public ProvisioningServiceClientNotFoundException() 17 | { 18 | super(); 19 | } 20 | 21 | public ProvisioningServiceClientNotFoundException(String message) 22 | { 23 | super("Device Provisioning Service not found!" + (((message == null) || message.isEmpty()) ? "" : " " + message)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/exceptions/ProvisioningServiceClientPreconditionFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.exceptions; 7 | 8 | /** 9 | * Create precondition failed exception 10 | * 11 | *

The ETag in the request does not match the ETag of the existing resource, as per RFC7232. 12 | *

HTTP status code 412. 13 | */ 14 | public class ProvisioningServiceClientPreconditionFailedException extends ProvisioningServiceClientBadUsageException 15 | { 16 | public ProvisioningServiceClientPreconditionFailedException() 17 | { 18 | super(); 19 | } 20 | 21 | public ProvisioningServiceClientPreconditionFailedException(String message) 22 | { 23 | super("Precondition failed!" + (((message == null) || message.isEmpty()) ? "" : " " + message)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/exceptions/ProvisioningServiceClientServiceException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.exceptions; 7 | 8 | /** 9 | * This is the subset of the Device Provisioning Service exceptions for the exceptions reported by the Service. 10 | */ 11 | public class ProvisioningServiceClientServiceException extends ProvisioningServiceClientException 12 | { 13 | public ProvisioningServiceClientServiceException() 14 | { 15 | super(); 16 | } 17 | 18 | public ProvisioningServiceClientServiceException(String message) 19 | { 20 | super(((message == null) || message.isEmpty()) ? "Device Provisioning Service error!" : message); 21 | } 22 | 23 | public ProvisioningServiceClientServiceException(String message, Throwable cause) 24 | { 25 | super((((message == null) || message.isEmpty()) ? "Device Provisioning Service error!" : message), cause); 26 | } 27 | 28 | public ProvisioningServiceClientServiceException(Throwable cause) 29 | { 30 | super(cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/exceptions/ProvisioningServiceClientTooManyRequestsException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.exceptions; 7 | 8 | /** 9 | * Create too many requests exception 10 | * 11 | *

Operations are being throttled by the service. For specific service limits, see IoT Hub Device Provisioning 12 | * Service limits. 13 | *

HTTP status code 429. 14 | */ 15 | public class ProvisioningServiceClientTooManyRequestsException extends ProvisioningServiceClientBadUsageException 16 | { 17 | public ProvisioningServiceClientTooManyRequestsException() 18 | { 19 | super(); 20 | } 21 | 22 | public ProvisioningServiceClientTooManyRequestsException(String message) 23 | { 24 | super("Too many requests (throttled)!" + (((message == null) || message.isEmpty()) ? "" : " " + message)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/exceptions/ProvisioningServiceClientTransportException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.exceptions; 7 | 8 | /** 9 | * Create transport exception 10 | */ 11 | public class ProvisioningServiceClientTransportException extends ProvisioningServiceClientException 12 | { 13 | public ProvisioningServiceClientTransportException() 14 | { 15 | super(); 16 | } 17 | 18 | public ProvisioningServiceClientTransportException(String message) 19 | { 20 | super(message); 21 | } 22 | 23 | public ProvisioningServiceClientTransportException(String message, Throwable cause) 24 | { 25 | super(message, cause); 26 | } 27 | 28 | public ProvisioningServiceClientTransportException(Throwable cause) 29 | { 30 | super(cause); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/exceptions/ProvisioningServiceClientUnathorizedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.exceptions; 7 | 8 | /** 9 | * Create unauthorized exception 10 | * 11 | *

The authorization token cannot be validated; for example, it is expired or does not apply to the 12 | * request’s URI. This error code is also returned to devices as part of the TPM attestation flow. 13 | *

HTTP status code 401 14 | */ 15 | public class ProvisioningServiceClientUnathorizedException extends ProvisioningServiceClientBadUsageException 16 | { 17 | public ProvisioningServiceClientUnathorizedException() 18 | { 19 | super(); 20 | } 21 | 22 | public ProvisioningServiceClientUnathorizedException(String message) 23 | { 24 | super("Unauthorized!" + (((message == null) || message.isEmpty()) ? "" : " " + message)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/transport/https/HttpMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.transport.https; 7 | 8 | /** 9 | * An HTTPS message. An HTTPS message is distinguished from a plain IoT Hub 10 | * message by its property names, which are prefixed with 'iothub-app-'; 11 | * and by the explicit specification of a content-type. 12 | */ 13 | public interface HttpMessage 14 | { 15 | /** 16 | * Gets the message body. 17 | * @return The message body. 18 | */ 19 | byte[] getBody(); 20 | 21 | /** 22 | * Gets the content type string. 23 | * @return The message content-type. 24 | */ 25 | String getContentType(); 26 | } 27 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/service/transport/https/HttpMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft. All rights reserved. 3 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 4 | */ 5 | 6 | package com.microsoft.azure.sdk.iot.provisioning.service.transport.https; 7 | 8 | /** The HTTPS request method (i.e. GET). */ 9 | public enum HttpMethod 10 | { 11 | GET, POST, PUT, DELETE, PATCH 12 | } 13 | -------------------------------------------------------------------------------- /provisioning/provisioning-service-client/src/main/resources/provisioning-service-client.properties: -------------------------------------------------------------------------------- 1 | artifactId=${project.artifactId} 2 | groupId=${project.groupId} 3 | version=${project.version} 4 | -------------------------------------------------------------------------------- /provisioning/provisioning-tools/tpm-simulator/Microsoft.Devices.Tpm.TcpEmulator.0.0.1.nuspec: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Microsoft.Devices.Tpm.TcpEmulator 5 | 0.0.1 6 | Tcp Emulator for Tpm 2.0 7 | Microsoft Corp 8 | false 9 | Tcp Emulator for Tpm 2.0 10 | Microsoft Corporation 2017 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /provisioning/provisioning-tools/tpm-simulator/NVChip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/provisioning/provisioning-tools/tpm-simulator/NVChip -------------------------------------------------------------------------------- /provisioning/provisioning-tools/tpm-simulator/Simulator.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/provisioning/provisioning-tools/tpm-simulator/Simulator.exe -------------------------------------------------------------------------------- /provisioning/provisioning-tools/tpm-simulator/Tpm.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-iot-sdk-java/5e8e39b8068058f28718c04022bb39361544f6ba/provisioning/provisioning-tools/tpm-simulator/Tpm.dll -------------------------------------------------------------------------------- /provisioning/provisioning-tools/tpm-simulator/build/Microsoft.Devices.Tpm.TcpEmulator.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TpmSimulator\Simulator.exe 6 | PreserveNewest 7 | 8 | 9 | TpmSimulator\Tpm.dll 10 | PreserveNewest 11 | 12 | 13 | -------------------------------------------------------------------------------- /provisioning/security/security-provider/src/main/java/com/microsoft/azure/sdk/iot/provisioning/security/exceptions/SecurityProviderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) Microsoft. All rights reserved. 4 | * Licensed under the MIT license. See LICENSE file in the project root for full license information. 5 | * 6 | */ 7 | 8 | package com.microsoft.azure.sdk.iot.provisioning.security.exceptions; 9 | 10 | public class SecurityProviderException extends Exception 11 | { 12 | public SecurityProviderException(Throwable e) 13 | { 14 | super(e); 15 | } 16 | 17 | public SecurityProviderException(String message, Throwable e) 18 | { 19 | super(message, e); 20 | } 21 | 22 | public SecurityProviderException(String message) 23 | { 24 | super(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /versions.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "version": "2.2.0" 4 | }, 5 | { 6 | "version": "1.34.3", 7 | "eol": "2023-03-30" 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /vsts/CredScanSuppressions.json: -------------------------------------------------------------------------------- 1 | { 2 | "tool": "Credential Scanner", 3 | "suppressions": [ 4 | { 5 | "file": "SamplesArguments.java", 6 | "_justification": "File uses the phrase \"Secret\" in a few places, but no credentials are present in the file" 7 | }, 8 | { 9 | "file": "ToolsTest.java", 10 | "_justification": "Fake credentials for test purposes" 11 | }, 12 | { 13 | "placeholder": "1234567890abcdefghijklmnopqrstvwxyz=", 14 | "_justification": "Fake credential for test purposes" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /vsts/TsaUploadConfigFile.json: -------------------------------------------------------------------------------- 1 | { 2 | "codebaseName": "Azure-Iot-SDK-Java-Master", 3 | "notificationAliases": [ 4 | "AzIoTEdMgdSdk@microsoft.com" 5 | ], 6 | "codebaseAdmins": [ 7 | "REDMOND\\andykwong", 8 | "REDMOND\\drwill", 9 | "REDMOND\\timtay", 10 | "REDMOND\\abmisr" 11 | ], 12 | "instanceUrl": "https://msazure.visualstudio.com/defaultcollection", 13 | "projectName": "One", 14 | "areaPath": "One\\IoT\\Platform and Devices\\IoT Devices\\SDKs\\Managed", 15 | "iterationPath": "One\\Custom\\IoT\\Backlog", 16 | "allTools": true 17 | } -------------------------------------------------------------------------------- /vsts/build_e2e_tests.ps1: -------------------------------------------------------------------------------- 1 | mvn `-Dmaven.javadoc.skip=true --projects :iot-e2e-common ` 2 | --also-make clean install `-DskipTests --batch-mode `-q -------------------------------------------------------------------------------- /vsts/echo_versions.ps1: -------------------------------------------------------------------------------- 1 | if (($env:JAVA_VERSION).equals("8")) 2 | { 3 | $env:JAVA_HOME=$env:JAVA_HOME_8_X64 4 | } 5 | elseif (($env:JAVA_VERSION).equals("11")) 6 | { 7 | $env:JAVA_HOME=$env:JAVA_HOME_11_X64 8 | } 9 | 10 | mvn -v -------------------------------------------------------------------------------- /vsts/horton-e2e.yaml: -------------------------------------------------------------------------------- 1 | variables: 2 | Horton.FrameworkRoot: $(Agent.BuildDirectory)/e2e-fx 3 | Horton.FrameworkRef: master 4 | Horton.Language: java 5 | Horton.Repo: $(Build.Repository.Uri) 6 | Horton.Commit: $(Build.SourceBranch) 7 | Horton.ForcedImage: '' 8 | 9 | resources: 10 | repositories: 11 | - repository: e2e_fx 12 | type: github 13 | name: Azure/iot-sdks-e2e-fx 14 | ref: refs/heads/master 15 | endpoint: 'GitHub OAuth - az-iot-builder-01' 16 | 17 | jobs: 18 | - template: vsts/templates/jobs-gate-java.yaml@e2e_fx 19 | 20 | 21 | -------------------------------------------------------------------------------- /vsts/spotbugs.ps1: -------------------------------------------------------------------------------- 1 | mvn install -DskipTests -T 2C 2 | mvn spotbugs:check -T 2C -------------------------------------------------------------------------------- /vsts/start_tpm_windows.ps1: -------------------------------------------------------------------------------- 1 | #Note this script only works for windows. Linux builds must use the docker container instead 2 | Start provisioning\provisioning-tools\tpm-simulator\Simulator.exe --------------------------------------------------------------------------------