You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by du...@apache.org on 2017/12/04 16:43:22 UTC

[sling-org-apache-sling-testing-clients] branch master updated: releng: Fixed javadoc

This is an automated email from the ASF dual-hosted git repository.

dulvac pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new 0715c6b  releng: Fixed javadoc
0715c6b is described below

commit 0715c6b4b493064e92afd16121b40b76401a5dad
Author: Andrei Dulvac <ad...@adobe.com>
AuthorDate: Mon Dec 4 17:39:07 2017 +0100

    releng: Fixed javadoc
---
 .../sling/testing/clients/SlingHttpResponse.java   |  8 +++--
 .../testing/clients/osgi/BundlesInstaller.java     |  3 ++
 .../testing/clients/osgi/OsgiConsoleClient.java    | 40 ++++++++++++++--------
 .../testing/clients/osgi/OsgiInstanceConfig.java   |  1 +
 .../clients/util/config/InstanceConfig.java        |  2 ++
 .../sling/testing/clients/util/poller/Polling.java |  4 +--
 .../sling/testing/timeouts/TimeoutsProvider.java   | 27 ++++++++++++---
 7 files changed, 62 insertions(+), 23 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/clients/SlingHttpResponse.java b/src/main/java/org/apache/sling/testing/clients/SlingHttpResponse.java
index 9a54df6..a8baca3 100644
--- a/src/main/java/org/apache/sling/testing/clients/SlingHttpResponse.java
+++ b/src/main/java/org/apache/sling/testing/clients/SlingHttpResponse.java
@@ -70,7 +70,7 @@ public class SlingHttpResponse implements CloseableHttpResponse {
      * <p>Assert that response matches supplied status</p>
      *
      * @param expected the expected http status
-     * @throws AssertionError if the response does not match the expected
+     * @throws ClientException if the response does not match the expected
      */
     public void checkStatus(int expected) throws ClientException {
         if (this.getStatusLine().getStatusCode() != expected) {
@@ -83,7 +83,7 @@ public class SlingHttpResponse implements CloseableHttpResponse {
      * <p>Assert that response matches supplied content type (from Content-Type header)</p>
      *
      * @param expected the expected content type
-     * @throws AssertionError if the response content type does not match the expected
+     * @throws ClientException if the response content type does not match the expected
      */
     public void checkContentType(String expected) throws ClientException {
         // Remove whatever follows semicolon in content-type
@@ -103,7 +103,7 @@ public class SlingHttpResponse implements CloseableHttpResponse {
      * <p>The regular expressions are automatically prefixed and suffixed with .* it order to partial-match the lines</p>
      *
      * @param regexp list of regular expressions
-     * @throws AssertionError if the response content does not match one of the regexp
+     * @throws ClientException if the response content does not match one of the regexp
      */
     public void checkContentRegexp(String... regexp) throws ClientException {
         for(String expr : regexp) {
@@ -128,6 +128,7 @@ public class SlingHttpResponse implements CloseableHttpResponse {
      * <p>Assert that all the provided {@code Strings} are contained in the response</p>
      *
      * @param expected list of expected strings
+     * @throws ClientException @throws ClientException if the response content does not match one of the strings
      */
     public void checkContentContains(String... expected) throws ClientException {
         for (String s : expected) {
@@ -151,6 +152,7 @@ public class SlingHttpResponse implements CloseableHttpResponse {
      * Get status from Sling Response as integer
      *
      * @return Sling Status
+     * @throws NumberFormatException if sling status can't be parsed as a number
      */
     public int getSlingStatusAsInt() throws NumberFormatException {
         String strStatus = getSlingStatus();
diff --git a/src/main/java/org/apache/sling/testing/clients/osgi/BundlesInstaller.java b/src/main/java/org/apache/sling/testing/clients/osgi/BundlesInstaller.java
index fcfd6c5..bf342a6 100644
--- a/src/main/java/org/apache/sling/testing/clients/osgi/BundlesInstaller.java
+++ b/src/main/java/org/apache/sling/testing/clients/osgi/BundlesInstaller.java
@@ -88,6 +88,7 @@ public class BundlesInstaller {
      * @param toInstall list ob bundles to install
      * @param startBundles whether to start the bundles
      * @throws ClientException if an error occurs during installation
+     * @throws IOException if reading the file fails
      */
     public void installBundles(List<File> toInstall, boolean startBundles) throws ClientException, IOException {
         for(File f : toInstall) {
@@ -143,6 +144,8 @@ public class BundlesInstaller {
      * @deprecated use {@link #waitBundlesInstalled(List, long)}
      * @param symbolicNames the list of names for the bundles
      * @param timeoutSeconds how many seconds to wait
+     * @throws ClientException if something went wrong
+     * @throws InterruptedException if interrupted
      * @return true if all the bundles were installed
      */
     @Deprecated
diff --git a/src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java b/src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java
index a6df552..55bdb25 100644
--- a/src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java
+++ b/src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java
@@ -374,7 +374,7 @@ public class OsgiConsoleClient extends SlingClient {
      * Uninstall a bundle
      * @param symbolicName bundle symbolic name
      * @return the sling response
-     * @throws ClientException
+     * @throws ClientException if something went wrong with the request
      */
     public SlingHttpResponse uninstallBundle(String symbolicName) throws ClientException {
         final long bundleId = getBundleId(symbolicName);
@@ -389,7 +389,7 @@ public class OsgiConsoleClient extends SlingClient {
      * @param f the bundle file
      * @param startBundle whether to start the bundle or not
      * @return the sling response
-     * @throws ClientException
+     * @throws ClientException if the request failed
      */
     public SlingHttpResponse installBundle(File f, boolean startBundle) throws ClientException {
         return installBundle(f, startBundle, 0);
@@ -430,7 +430,7 @@ public class OsgiConsoleClient extends SlingClient {
      * @param waitTime How many milliseconds to wait between retries
      * @param retries the number of retries
      * @return true if the bundle was installed until the retries stop, false otherwise
-     * @throws InterruptedException
+     * @throws InterruptedException if interrupted
      */
     @Deprecated
     public boolean checkBundleInstalled(String symbolicName, int waitTime, int retries) throws InterruptedException {
@@ -447,7 +447,8 @@ public class OsgiConsoleClient extends SlingClient {
      * @param waitTime how long to wait between retries of checking the bundle
      * @param retries how many times to check for the bundle to be installed, until giving up
      * @return true if the bundle was successfully installed, false otherwise
-     * @throws ClientException
+     * @throws ClientException if the request failed
+     * @throws InterruptedException if interrupted
      */
     @Deprecated
     public boolean installBundleWithRetry(File f, boolean startBundle, int startLevel, int waitTime, int retries)
@@ -467,9 +468,9 @@ public class OsgiConsoleClient extends SlingClient {
      * @param startLevel the start level of the bundle. negative values mean default start level
      * @param timeout how much to wait for the bundle to be installed before throwing a {@code TimeoutException}
      * @param delay time to wait between checks of the state
-     * @throws ClientException
+     * @throws ClientException if the request failed
      * @throws TimeoutException if the bundle did not install before timeout was reached
-     * @throws InterruptedException
+     * @throws InterruptedException if interrupted
      */
     public void waitInstallBundle(File f, boolean startBundle, int startLevel, long timeout, long delay)
             throws ClientException, InterruptedException, TimeoutException {
@@ -482,6 +483,14 @@ public class OsgiConsoleClient extends SlingClient {
         }
     }
 
+    /**
+     * Wait until the bundle is installed
+     * @param symbolicName symbolic name of bundle
+     * @param timeout how much to wait for the bundle to be installed before throwing a {@code TimeoutException}
+     * @param delay time to wait between checks of the state
+     * @throws TimeoutException if the bundle did not install before timeout was reached
+     * @throws InterruptedException if interrupted
+     */
     public void waitBundleInstalled(final String symbolicName, final long timeout, final long delay)
             throws TimeoutException, InterruptedException {
 
@@ -522,7 +531,7 @@ public class OsgiConsoleClient extends SlingClient {
      * Get the version of the bundle
      * @param symbolicName bundle symbolic name
      * @return bundle version
-     * @throws ClientException
+     * @throws ClientException if the version is not retrieved
      */
     public String getBundleVersion(String symbolicName) throws ClientException {
         final JsonNode bundle = getBundleData(symbolicName);
@@ -555,7 +564,7 @@ public class OsgiConsoleClient extends SlingClient {
     /**
      * Starts a bundle
      * @param symbolicName the name of the bundle
-     * @throws ClientException
+     * @throws ClientException if the request failed
      */
     public void startBundle(String symbolicName) throws ClientException {
         // To start the bundle we POST action=start to its URL
@@ -567,7 +576,7 @@ public class OsgiConsoleClient extends SlingClient {
     /**
      * Stop a bundle
      * @param symbolicName the name of the bundle
-     * @throws ClientException
+     * @throws ClientException if the request failed
      */
     public void stopBundle(String symbolicName) throws ClientException {
         // To stop the bundle we POST action=stop to its URL
@@ -583,7 +592,8 @@ public class OsgiConsoleClient extends SlingClient {
      * @param symbolicName the name of the bundle
      * @param waitTime How many milliseconds to wait between retries
      * @param retries the number of retries
-     * @throws ClientException, InterruptedException
+     * @throws ClientException if the request failed
+     * @throws InterruptedException if interrupted
      */
     @Deprecated
     public void startBundlewithWait(String symbolicName, int waitTime, int retries)
@@ -599,7 +609,9 @@ public class OsgiConsoleClient extends SlingClient {
      * @param symbolicName the name of the bundle
      * @param timeout max time to wait for the bundle to start, in ms
      * @param delay time to wait between status checks, in ms
-     * @throws ClientException, InterruptedException, TimeoutException
+     * @throws ClientException if the request failed
+     * @throws InterruptedException if interrupted
+     * @throws TimeoutException if starting timed out
      */
     public void waitStartBundle(String symbolicName, long timeout, long delay)
             throws ClientException, InterruptedException, TimeoutException {
@@ -610,7 +622,7 @@ public class OsgiConsoleClient extends SlingClient {
 
     /**
      * Calls PackageAdmin.refreshPackages to force re-wiring of all the bundles.
-     * @throws ClientException
+     * @throws ClientException if the request failed
      */
     public void refreshPackages() throws ClientException {
         LOG.info("Refreshing packages.");
@@ -680,7 +692,7 @@ public class OsgiConsoleClient extends SlingClient {
      * Get the symbolic name from a bundle file by looking at the manifest
      * @param bundleFile bundle file
      * @return the name extracted from the manifest
-     * @throws IOException
+     * @throws IOException if reading the jar failed
      */
     public static String getBundleSymbolicName(File bundleFile) throws IOException {
         String name = null;
@@ -701,7 +713,7 @@ public class OsgiConsoleClient extends SlingClient {
      * Get the version form a bundle file by looking at the manifest
      * @param bundleFile bundle file
      * @return the version
-     * @throws IOException
+     * @throws IOException if reading the bundle jar failed
      */
     public static String getBundleVersionFromFile(File bundleFile) throws IOException {
         String version = null;
diff --git a/src/main/java/org/apache/sling/testing/clients/osgi/OsgiInstanceConfig.java b/src/main/java/org/apache/sling/testing/clients/osgi/OsgiInstanceConfig.java
index 9f9c4bd..af345f4 100644
--- a/src/main/java/org/apache/sling/testing/clients/osgi/OsgiInstanceConfig.java
+++ b/src/main/java/org/apache/sling/testing/clients/osgi/OsgiInstanceConfig.java
@@ -52,6 +52,7 @@ public class OsgiInstanceConfig implements InstanceConfig {
      * @param <T> The type of the Granite Client
      * @throws ClientException if the client cannot be initialized
      * @throws InstanceConfigException if the config cannot be saved
+     * @throws InterruptedException if interrupted
      */
     public <T extends SlingClient> OsgiInstanceConfig(T client, String configPID)
             throws ClientException, InstanceConfigException, InterruptedException {
diff --git a/src/main/java/org/apache/sling/testing/clients/util/config/InstanceConfig.java b/src/main/java/org/apache/sling/testing/clients/util/config/InstanceConfig.java
index b545a7b..89ac056 100644
--- a/src/main/java/org/apache/sling/testing/clients/util/config/InstanceConfig.java
+++ b/src/main/java/org/apache/sling/testing/clients/util/config/InstanceConfig.java
@@ -27,6 +27,7 @@ public interface InstanceConfig {
      *
      * @return this
      * @throws InstanceConfigException if saving the configuration fails
+     * @throws InterruptedException if interrupted
      */
     public InstanceConfig save() throws InstanceConfigException, InterruptedException;
 
@@ -35,6 +36,7 @@ public interface InstanceConfig {
      *
      * @return this
      * @throws InstanceConfigException if restoring the configuration fails
+     * @throws InterruptedException if interrupted
      */
     public InstanceConfig restore() throws InstanceConfigException, InterruptedException;
 }
diff --git a/src/main/java/org/apache/sling/testing/clients/util/poller/Polling.java b/src/main/java/org/apache/sling/testing/clients/util/poller/Polling.java
index faef6b2..c57018d 100644
--- a/src/main/java/org/apache/sling/testing/clients/util/poller/Polling.java
+++ b/src/main/java/org/apache/sling/testing/clients/util/poller/Polling.java
@@ -63,9 +63,9 @@ public class Polling implements Callable<Boolean> {
 
     /**
      * <p>Method to be called by {@link #poll(long timeout, long delay)}, potentially multiple times,
-     * until it returns true or timeout is reached.<br/>
+     * until it returns true or timeout is reached.<br>
      * Subclasses can override it to change the check accordingly. The method should return true
-     * only when the call was successful.<br/>
+     * only when the call was successful.<br>
      * It can return false or throw any {@code Exception} to make the poller try again later.</p>
      *
      * <p>The default implementation delegates the call to the {@code Callable c} instance.</p>
diff --git a/src/main/java/org/apache/sling/testing/timeouts/TimeoutsProvider.java b/src/main/java/org/apache/sling/testing/timeouts/TimeoutsProvider.java
index 9fe0086..73bb94b 100644
--- a/src/main/java/org/apache/sling/testing/timeouts/TimeoutsProvider.java
+++ b/src/main/java/org/apache/sling/testing/timeouts/TimeoutsProvider.java
@@ -45,7 +45,11 @@ public class TimeoutsProvider {
             }
         }
     }
-    
+
+    /**
+     *
+     * @return the instance of the singleton
+     */
     public static TimeoutsProvider getInstance() {
         if(INSTANCE == null) {
             synchronized (TimeoutsProvider.class) {
@@ -54,18 +58,33 @@ public class TimeoutsProvider {
         }
         return INSTANCE;
     }
-    
+
+    /**
+     *
+     * @param nomimalValue base number to be multiplied internally with the factor
+     * @return the new timeout
+     */
     public long getTimeout(long nomimalValue) {
         final long result = (long)(nomimalValue * timeoutFactor);
         return result;
     }
-    
+
+    /**
+     *
+     * @param nomimalValue base number to be multiplied internally with the factor
+     * @return the new timeout
+     */
     public int getTimeout(int nomimalValue) {
         final int result = (int)(nomimalValue * timeoutFactor);
         return result;
     }
     
-    /** Get timeout from a system property, with default value */
+    /**
+     * Get timeout from a system property, with default value
+     * @param systemPropertyName the name of the system prop from which to get the timeout
+     * @param defaultNominalValue default value in case the property does not exist
+     * @return the timeout
+     */
     public int getTimeout(String systemPropertyName, int defaultNominalValue) {
         int result = defaultNominalValue;
         final String str = System.getProperty(systemPropertyName);

-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].