Skip to content

Commit

Permalink
Fix some doc-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
cdr-chakotay committed Nov 25, 2024
1 parent c2d3fc5 commit 92aea9f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
11 changes: 7 additions & 4 deletions src/main/java/com/transloadit/sdk/Assembly.java
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,9 @@ protected void setRunnableAssemblyListener(AssemblyListener runnableAssemblyList
this.runnableAssemblyListener = runnableAssemblyListener;
}

/**
* This Method is used to pause running parallel File uploads.
/***
* This Method is used to pause parallel File uploads.
* @throws LocalOperationException - If the pause operation fails inside the upload runnable.
*/
public void pauseUploads() throws LocalOperationException {
for (TusUploadRunnable thread : threadList) {
Expand All @@ -673,8 +674,10 @@ public void pauseUploads() throws LocalOperationException {
}
}

/**
* This Method is used to pause parallel File uploads.
/***
* This Method is used to resume parallel File uploads.
* @throws LocalOperationException - If the resume operation fails inside the upload runnable.
* @throws RequestException - If the resume operation fails on the server side.
*/
public void resumeUploads() throws LocalOperationException, RequestException {
for (TusUploadRunnable thread : threadList) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/transloadit/sdk/TusUploadRunnable.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ protected void makeAttempt() throws ProtocolException, IOException {
/**
* Sets {@link #isPaused} {@code = true}.
* This results in pausing the thread after uploading the current chunk.
* @throws LocalOperationException - If resuming has been disabled.
*/
public void setPaused() throws LocalOperationException {
if (!tusClient.resumingEnabled()) {
Expand All @@ -143,6 +144,8 @@ public void setPaused() throws LocalOperationException {
/**
* Sets {@link #isPaused} {@code = false}.
* This results in resuming the upload with the next chunk.
* @throws LocalOperationException - If resuming has been disabled or the upload has not been started.
* @throws RequestException - If the upload could not be resumed due to a request error
*/
public void setUnPaused() throws LocalOperationException, RequestException {
if (uploadHasBeenStarted && !isFinishedPermanently) { // prohibits an attempt of resuming a finished upload.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public void setUp() throws Exception {
}
/**
* Saves a multithreaded upload and verifies that the requests are sent.
* @throws IOException
* @throws LocalOperationException
* @throws RequestException
* @throws IOException - Thrown if an I/O error occurs while loading test resources.
* @throws LocalOperationException - If a local non-http operation fails.
* @throws RequestException - If a request to Transloadit server fails.
*/
@Test
public void saveMultiThreadedUpload() throws IOException, LocalOperationException, RequestException {
Expand Down Expand Up @@ -261,9 +261,9 @@ public void onAssemblyResultFinished(JSONArray result) {
/**
* Verifies, that {@link Assembly#abortUploads()} gets called in case of an upload error.
* And if the {@link AssemblyListener} gets notified.
* @throws LocalOperationException
* @throws RequestException
* @throws IOException
* @throws IOException - Thrown if an I/O error occurs while loading test resources.
* @throws LocalOperationException - If a local non-http operation fails.
* @throws RequestException - If a request to Transloadit server fails.
*/
@Test
public void abortUploads() throws LocalOperationException, RequestException, IOException, InterruptedException {
Expand Down Expand Up @@ -300,9 +300,9 @@ public void abortUploads() throws LocalOperationException, RequestException, IOE

/**
* Checks, if uploading threads are getting paused by {@link Assembly#pauseUploads()}.
* @throws IOException
* @throws LocalOperationException
* @throws RequestException
* @throws IOException - Thrown if an I/O error occurs while loading test resources.
* @throws LocalOperationException - If a local non-http operation fails.
* @throws RequestException - If a request to Transloadit server fails.
*/
@Test
public void pauseUploads() throws IOException, LocalOperationException, RequestException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ public class MockProtocolExceptionAssembly extends Assembly {

/**
* Mocks an {@link Assembly} but causes always a {@link ProtocolException} if tus files are getting uploaded.
* @param transloadit
* @param transloadit The {@link Transloadit} client.
*/
public MockProtocolExceptionAssembly(Transloadit transloadit) {
super(transloadit);
}

/**
* Mocks tus file handling and upload.
* @throws IOException
* @throws ProtocolException
* @throws IOException - Thrown if an I/O error occurs while uploading the files. (e.g. file not found)
* @throws ProtocolException - Thrown if an error occurs while uploading the files. (e.g. aborted upload)
*/
@Override
protected void uploadTusFiles() throws IOException, ProtocolException {
Expand Down Expand Up @@ -93,7 +93,7 @@ public void onAssemblyResultFinished(JSONArray result) {
}
uploadSize = getUploadSize();
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(maxParallelUploads);
while (uploads.size() > 0) {
while (!uploads.isEmpty()) {
final TusUpload tusUpload = uploads.remove(0);
MockTusUploadRunnable tusUploadRunnable = new MockTusUploadRunnable(
tusClient, tusUpload, uploadChunkSize, this);
Expand Down
6 changes: 0 additions & 6 deletions src/test/java/com/transloadit/sdk/MockTusAssembly.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;

/**
* This class serves as a Mock to {@link Assembly}, which can be used to test.
*/
public class MockTusAssembly extends Assembly {
/**
* Stores emitted information.
*/
Map<String, Object> emitted;

/**
* Constructs a new instance of {@link MockTusAssembly}.
* @param transloadit The {@link Transloadit} client.
Expand Down

0 comments on commit 92aea9f

Please sign in to comment.