Skip to content
Snippets Groups Projects
Commit 1907e7fb authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Minor fixes

parent 023b82fb
No related branches found
No related tags found
No related merge requests found
......@@ -329,8 +329,6 @@ public class UriService {
String linkTarget = linkNode.getTarget();
if (URIUtils.isURIInternal(linkTarget)) {
return linkNode;
} else {
String targetPath = URIUtils.returnVosPathFromNodeURI(linkTarget, authority);
Optional<Node> targetNodeOpt = nodeDao.listNode(targetPath);
......@@ -341,6 +339,8 @@ public class UriService {
} else {
return targetNode;
}
} else {
return linkNode;
}
}
......
......@@ -15,6 +15,7 @@ import it.inaf.oats.vospace.exception.InvalidArgumentException;
import it.inaf.oats.vospace.exception.NodeBusyException;
import it.inaf.oats.vospace.exception.PermissionDeniedException;
import it.inaf.oats.vospace.exception.ProtocolNotSupportedException;
import it.inaf.oats.vospace.persistence.LinkedServiceDAO;
import it.inaf.oats.vospace.persistence.LocationDAO;
import it.inaf.oats.vospace.persistence.NodeDAO;
import it.inaf.oats.vospace.persistence.model.Location;
......@@ -70,6 +71,9 @@ public class UriServiceTest {
@MockBean
private CreateNodeService createNodeService;
@MockBean
private LinkedServiceDAO linkedServiceDAO;
@MockBean
private FileServiceClient fileServiceClient;
......@@ -95,11 +99,14 @@ public class UriServiceTest {
}
}
public final static String PORTAL_URL = "http://portalurl.ia2.inaf.it/portal/files";
@BeforeEach
public void init() {
Location location = new Location();
location.setType(LocationType.ASYNC);
when(locationDAO.getNodeLocation(any())).thenReturn(Optional.of(location));
when(linkedServiceDAO.isLinkedServiceUrl(eq(PORTAL_URL))).thenReturn(Boolean.TRUE);
}
@Test
......@@ -382,13 +389,6 @@ public class UriServiceTest {
when(servletRequest.getUserPrincipal()).thenReturn(user);
when(rapClient.exchangeToken(argThat(req -> {
assertEquals("<token>", req.getSubjectToken());
assertEquals("http://file-service/mydummydata1", req.getResource());
return true;
}), any())).thenReturn("<new-token>");
JobSummary job = getPullFromVoSpaceJob(targetOfPull);
Transfer tr = uriService.getTransfer(job);
......@@ -590,8 +590,12 @@ public class UriServiceTest {
mockPublicNode("parent_dir/file1");
mockPublicNode("parent_dir/file2");
when(fileServiceClient.startArchiveJob(any(), any()))
.thenReturn("http://file-service/mockarchive");
uriService.getNegotiatedTransfer(job, transfer);
verify(fileServiceClient, times(1)).startArchiveJob(transfer, "archive-job-id");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment