vivekshresta commented on a change in pull request #16:
URL: https://github.com/apache/airavata-mft/pull/16#discussion_r418995684
##########
File path:
services/resource-service/server/src/test/java/org/apache/airavata/mft/resource/server/backend/file/TestFileBasedResourceBackend.java
##########
@@ -0,0 +1,272 @@
+package org.apache.airavata.mft.resource.server.backend.file;
+
+import org.apache.airavata.mft.resource.service.*;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import java.util.Optional;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class TestFileBasedResourceBackend {
+ static FileBasedResourceBackend fileBasedResourceBackend;
+
+ @BeforeAll
+ public static void beforeClass() {
+ fileBasedResourceBackend = new FileBasedResourceBackend();
+ fileBasedResourceBackend.setResourceFile("resources.json");
+ }
+
+ @Test
+ public void testGetFtpResource_WithProperResourceId() {
+ String resourceId = "ftp-resource";
+ FTPResourceGetRequest resourceGetRequest =
Mockito.mock(FTPResourceGetRequest.class);
+
Mockito.when(resourceGetRequest.getResourceId()).thenReturn(resourceId);
+
+ try {
+ Optional<FTPResource> ftpResourceOptional =
fileBasedResourceBackend.getFTPResource(resourceGetRequest);
+ assertTrue(ftpResourceOptional.isPresent());
+
+ FTPResource ftpResource = ftpResourceOptional.get();
+ assertEquals(resourceId, ftpResource.getResourceId());
+ assertNotNull(ftpResource.getResourcePath());
Review comment:
asserting that they are not null since the values might change, but the
parameters should never change and never be null.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]