Skip to content

Commit

Permalink
Implement changes on AssemblyListener
Browse files Browse the repository at this point in the history
  • Loading branch information
cdr-chakotay committed Nov 25, 2024
1 parent 6849072 commit 3f0cda4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 39 deletions.
70 changes: 36 additions & 34 deletions src/test/java/com/transloadit/sdk/AssemblyMultiThreadingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.transloadit.sdk.exceptions.LocalOperationException;
import com.transloadit.sdk.exceptions.RequestException;
import com.transloadit.sdk.response.AssemblyResponse;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -71,55 +72,55 @@ public void saveMultiThreadedUpload() throws IOException, LocalOperationExceptio
MockTusAssemblyMultiThreading assembly = new MockTusAssemblyMultiThreading(transloadit);
assembly.wipeAssemblyID();
assembly.setRunnableAssemblyListener(new AssemblyListener() {
@Override
public void onAssemblyFinished(AssemblyResponse response) {
@Override
public void onAssemblyFinished(AssemblyResponse response) {

}
}

@Override
public void onError(Exception error) {
@Override
public void onError(Exception error) {

}
}

@Override
public void onMetadataExtracted() {
@Override
public void onMetadataExtracted() {

}
}

@Override
public void onAssemblyUploadFinished() {
@Override
public void onAssemblyUploadFinished() {

}
}

@Override
public void onFileUploadFinished(String fileName, JSONObject uploadInformation) {
@Override
public void onFileUploadFinished(JSONObject uploadInformation) {

}
}

@Override
public void onFileUploadPaused(String name) {
@Override
public void onFileUploadPaused(String name) {

}
}

@Override
public void onFileUploadResumed(String name) {
@Override
public void onFileUploadResumed(String name) {

}
}

@Override
public void onFileUploadProgress(long uploadedBytes, long totalBytes) {
@Override
public void onFileUploadProgress(long uploadedBytes, long totalBytes) {

}
}

@Override
public void onAssemblyProgress(double combinedProgress, JSONObject progressPerOriginalFile) {
public void onAssemblyProgress(JSONObject progress) {

}

@Override
public void onAssemblyResultFinished(String stepName, JSONObject result) {
public void onAssemblyResultFinished(JSONArray result) {

}
}
});

assembly.addFile(new File("LICENSE"), "file_name1");
Expand Down Expand Up @@ -223,7 +224,7 @@ public void onAssemblyUploadFinished() {
}

@Override
public void onFileUploadFinished(String fileName, JSONObject uploadInformation) {
public void onFileUploadFinished(JSONObject uploadInformation) {

}

Expand All @@ -243,22 +244,23 @@ public void onFileUploadProgress(long uploadedBytes, long totalBytes) {
}

@Override
public void onAssemblyProgress(double combinedProgress, JSONObject progressPerOriginalFile) {
public void onAssemblyProgress(JSONObject progress) {

}

@Override
public void onAssemblyResultFinished(String stepName, JSONObject result) {
public void onAssemblyResultFinished(JSONArray result) {

}

};
assembly.setRunnableAssemblyListener(listener);
Assertions.assertEquals(listener, assembly.getRunnableAssemblyListener());
}

/**
* Verifies, that {@link Assembly#abortUploads()} gets called in case of an upload error.
* And if the {@link UploadProgressListener} gets notified.
* And if the {@link AssemblyListener} gets notified.
* @throws LocalOperationException
* @throws RequestException
* @throws IOException
Expand Down Expand Up @@ -399,7 +401,7 @@ public void onAssemblyUploadFinished() {
}

@Override
public void onFileUploadFinished(String fileName, JSONObject uploadInformation) {
public void onFileUploadFinished(JSONObject uploadInformation) {

}

Expand All @@ -419,12 +421,12 @@ public void onFileUploadProgress(long uploadedBytes, long totalBytes) {
}

@Override
public void onAssemblyProgress(double combinedProgress, JSONObject progressPerOriginalFile) {
public void onAssemblyProgress(JSONObject progress) {

}

@Override
public void onAssemblyResultFinished(String stepName, JSONObject result) {
public void onAssemblyResultFinished(JSONArray result) {

}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//CHECKSTYLE:OFF
import com.transloadit.sdk.exceptions.LocalOperationException; // needed for doc
import com.transloadit.sdk.exceptions.RequestException;
import org.json.JSONArray;
import org.json.JSONObject;
//CHECKSTYLE:ON

Expand Down Expand Up @@ -60,7 +61,7 @@ public void onAssemblyUploadFinished() {
}

@Override
public void onFileUploadFinished(String fileName, JSONObject uploadInformation) {
public void onFileUploadFinished(JSONObject uploadInformation) {

}

Expand All @@ -80,12 +81,12 @@ public void onFileUploadProgress(long uploadedBytes, long totalBytes) {
}

@Override
public void onAssemblyProgress(double combinedProgress, JSONObject progressPerOriginalFile) {
public void onAssemblyProgress(JSONObject progressPerOriginalFile) {

}

@Override
public void onAssemblyResultFinished(String stepName, JSONObject result) {
public void onAssemblyResultFinished(JSONArray result) {

}
};
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/com/transloadit/sdk/MockTusAssembly.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import java.util.Map;

/**
* This class serves as a Mock to {@link Assembly}, which can be used to test
* Assemblies with resumability enabled and provides a suitable {@link MockSocket}.
* This class serves as a Mock to {@link Assembly}, which can be used to test.
*/
public class MockTusAssembly extends Assembly {
/**
Expand Down

0 comments on commit 3f0cda4

Please sign in to comment.