Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(device, e2e, prov-dev, service, samples): Fix javadoc issues #622

Merged
merged 4 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public void LogWarn(String message, Object...params)
}

/**
* @param message
* @param params
* @param message The message to log
* @param params The parameters to be put into the message
* @deprecated Since the switch from Log4j to slf4j there is no fatal log level anymore. Mapped to error level
*/
public void LogFatal(String message, Object...params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ public DeviceClient setMessageCallback(MessageCallback callback, Object context)
* @param deviceId The id for the device to use
* @param securityProvider The security provider for the device
* @param protocol The protocol the device shall use for communication to the IoT Hub
* @return The created device client instance
* @throws URISyntaxException If the provided connString could not be parsed.
* @throws IOException If the SecurityProvider throws any exception while authenticating
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ else if (e instanceof UnauthorizedException || e instanceof MqttUnauthorizedExce

/**
* Creates a new iotHubTransportConnection instance, sets this object as its listener, and opens that connection
* @throws TransportException
* @throws TransportException if any exception is thrown while opening the connection
*/
private void openConnection() throws TransportException
{
Expand Down Expand Up @@ -713,7 +713,7 @@ private void openConnection() throws TransportException

/**
* Attempts to reconnect. By the end of this call, the state of this object shall be either CONNECTED or DISCONNECTED
* @param transportException
* @param transportException the exception that caused the disconnection
*/
private void handleDisconnection(TransportException transportException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ void closeLinks()
/**
* Delegate the link initialization call to device operation objects.
*
* @param link the link ti initialize.
* @throws TransportException throw if Proton operation throws.
* @throws IllegalArgumentException throw if the link parameter is null.
* @param link the link that was initialized
*/
void initLink(Link link)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ protected void subscribeDeviceToMessageType(MessageType messageType, String devi
* Open the session and the links.
*
* @param connection the Proton connection object to work with.
* @return true if connection is ready, otherwise false to indicate authentication links open in progress
*/
void onConnectionInit(Connection connection) throws TransportException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ else if (status == IotHubConnectionStatus.CONNECTED)
* Receives method calls from IotHub. Default protocol is to use
* use MQTT transport.
*
* @param args
* @param args The connection string and the selected protocol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to mention about the exceptions here instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

* @throws Exception if any exception is encountered
*/
public static void main(String[] args) throws IOException, URISyntaxException, ModuleClientException
public static void main(String[] args) throws Exception
{
System.out.println("Starting...");
System.out.println("Beginning setup.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,15 @@ public void execute(IotHubConnectionStatus status, IotHubConnectionStatusChangeR
*
* @param client the client to send the messages from
* @param protocol the protocol the client is using
* @param numberOfMessages the number of messages to send
* @param breathPeriod time to sleep between checks of message callback arrival
* @param timeoutMilliseconds time to wait for any message to have its callback fired before the test times out
* @param authType the authentication type used is this test
*/
public static void sendMessagesExpectingSASTokenExpiration(DeviceClient client,
String protocol,
int numberOfMessages,
long retryMilliseconds,
long breathPeriod,
long timeoutMilliseconds,
AuthenticationType authType)
{
Expand All @@ -182,7 +186,7 @@ public static void sendMessagesExpectingSASTokenExpiration(DeviceClient client,
long startTime = System.currentTimeMillis();
while(!messageSent.wasCallbackFired() || !statusUpdated.getResult())
{
Thread.sleep(retryMilliseconds);
Thread.sleep(breathPeriod);
if (System.currentTimeMillis() - startTime > timeoutMilliseconds)
{
Assert.fail(buildExceptionMessage(protocol + ", " + authType + ": Sending message over " + protocol + " protocol failed: " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public class SSLContextBuilder

/**
* Create an SSLContext instance with the provided public and private keys that also trusts the base iot hub certificates
* @param publicKeyCertificateString the public key to use for x509 authentication. Does not need to include the default
* Iot Hub trusted certificate as it will be added automatically
* @param privateKeyString The private key to use for x509 authentication
* @return The created SSLContext that uses the provided public key and private key
* @throws GeneralSecurityException If the certificate creation fails, or if the SSLContext creation using those certificates fails
* @throws IOException If the certificates cannot be read
*/
public static SSLContext buildSSLContext(String publicKeyCertificateString, String privateKeyString) throws GeneralSecurityException, IOException
{
Expand Down Expand Up @@ -61,6 +67,12 @@ public static SSLContext buildSSLContext(String publicKeyCertificateString, Stri

/**
* Build the default SSLContext. Trusts the iot hub base certificates, but can only be used for sas auth
* @return the default SSLContext
* @throws NoSuchAlgorithmException If the SSLContext cannot be created because of a missing algorithm
* @throws KeyManagementException If the SSLContext cannot be initiated
* @throws CertificateException If certificate creation fails
* @throws KeyStoreException If the keystore operations fail
* @throws IOException If the default certificate fails to be read
*/
public static SSLContext buildSSLContext() throws NoSuchAlgorithmException, KeyManagementException, CertificateException, KeyStoreException, IOException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public static boolean isCause(Class<? extends Throwable> possibleExceptionCause,
* @param registryManager the registry manager to use. Will not be closed after this call
* @param identitiesToDispose the list of modules and or devices to be removed from the iot hub using the provided
* registry manager
* @throws IOException if deleting the identity fails
* @throws IotHubException if deleting the identity fails
*/
public static void removeDevicesAndModules(RegistryManager registryManager, Collection<BaseDevice> identitiesToDispose)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public X509CertificateGenerator()
/**
* Constructor that generates a new self signed x509 certificate. Public certificate, private key, thumbprint, and the complete
* certificate can be accessed by getters. The created certificate will have the provided common name.
* @param commonName the common name to use for the created certs
*/
public X509CertificateGenerator(String commonName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ public static void stopProxy()
* Amqps/Amqps_ws : Expect the cbs link to send a new sas token before the old token expires
* Mqtt/Mqtt_ws : Expect the connection to be lost briefly, but re-established with a new sas token
* Http : No connection status callback, but should be able to send a message after the first generated sas token has expired
* @throws Exception if the test fails in any way
*/
@Test
public void tokenRenewalWorks() throws URISyntaxException, ModuleClientException, IotHubException, IOException, InterruptedException
public void tokenRenewalWorks() throws Exception
{
final long SECONDS_FOR_SAS_TOKEN_TO_LIVE_BEFORE_RENEWAL = 60;
final long EXPIRED_SAS_TOKEN_GRACE_PERIOD_SECONDS = 600;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ public void individualEnrollmentWithCustomAllocationPolicy() throws Exception
* The custom allocation policy has a webhook to an Azure function, and that function will always dictate to provision
* the device to the hub with the longest host name. This test verifies that an enrollment with a custom allocation policy
* pointing to that Azure function will always enroll to the hub with the longest name
* @param enrollmentType
* @param enrollmentType The type of the enrollment to test
* @throws Exception if an exception occurs during provisioning or while creating the security provider
*/
protected void customAllocationFlow(EnrollmentType enrollmentType) throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public synchronized void getRegistrationStatus(RequestData requestData, Response

/**
* Requests hub to provide a device key to begin authentication over MQTT (Only for TPM)
* @param responseCallback A non {@code null} value for the callback
* @param requestData the request data to be used while requesting nonce for TPM
* @param responseCallback A non {@code null} value for the callback
* @param authorizationCallbackContext An object for context. Can be {@code null}
* @throws ProvisioningDeviceClientException If any of the parameters are invalid ({@code null} or empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ public class ConfigurationManangerSample

/**
* A simple sample for doing CRUD operations
* @param args
* @throws IOException
* @throws URISyntaxException
* @param args unused
* @throws Exception If any exception is thrown
*/
public static void main(String[] args) throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ public class DeviceManagerSample
{
/**
* A simple sample for doing CRUD operations
* @param args
* @throws IOException
* @throws URISyntaxException
* @param args unused
* @throws Exception if any exception is thrown
*/
public static void main(String[] args) throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ public class DeviceManagerX509Sample

/**
* A simple sample for doing CRUD operations involving X509 authenticated devices
* @param args
* @throws IOException
* @throws URISyntaxException
* @param args unused
* @throws Exception if any exception occurs
*/
public static void main(String[] args) throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public class ModuleManagerSample
{
/**
* A simple sample for doing CRUD operations
* @param args
* @throws IOException
* @throws URISyntaxException
* @param args unused
* @throws Exception if any exception is thrown
*/
public static void main(String[] args) throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ public class ServiceClientSample
private static final int RECEIVER_TIMEOUT = 10000; // Timeout in ms

/**
* @param args
* @throws IOException
* @throws URISyntaxException
* @param args Unused
* @throws Exception if any exception occurs
*/
public static void main(String[] args) throws IOException, URISyntaxException, Exception
public static void main(String[] args) throws Exception
{
System.out.println("********* Starting ServiceClient sample...");

Expand Down