Loading src/main/java/it/inaf/oats/vospace/UriService.java +2 −25 Original line number Diff line number Diff line Loading @@ -22,11 +22,6 @@ import it.inaf.oats.vospace.exception.NodeBusyException; import it.inaf.oats.vospace.parent.persistence.LinkedServiceDAO; import it.inaf.oats.vospace.persistence.LocationDAO; import it.inaf.oats.vospace.persistence.NodeDAO; import it.inaf.oats.vospace.persistence.model.Location; import it.inaf.oats.vospace.persistence.model.LocationType; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Objects; Loading @@ -42,7 +37,6 @@ import net.ivoa.xml.vospace.v2.Transfer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @Service public class UriService { Loading @@ -59,9 +53,6 @@ public class UriService { @Autowired private LinkService linkService; @Autowired private LocationDAO locationDAO; @Autowired private LinkedServiceDAO linkedServiceDAO; Loading Loading @@ -232,21 +223,7 @@ public class UriService { } } else { /* Location location = locationDAO.getNodeLocation(relativePath).orElse(null); if (location != null && location.getType() == LocationType.PORTAL) { String fileName = nodeDao.getNodeOsName(relativePath); endpoint = "http://" + location.getSource().getHostname() + location.getSource().getBaseUrl(); if (!endpoint.endsWith("/")) { endpoint += "/"; } endpoint += fileName; } else {*/ endpoint = fileServiceUrl + urlEncodePath(relativePath); //} endpoint += "?jobId=" + job.getJobId(); if (!"true".equals(NodeProperties.getNodePropertyByURI(node, NodeProperties.PUBLIC_READ_URI))) { Loading src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +0 −13 Original line number Diff line number Diff line Loading @@ -523,19 +523,6 @@ public class NodeDAO { return jdbcTemplate.queryForObject(sql, args, types, Integer.class); } /* public String getNodeOsName(String vosPath) { String sql = "SELECT \n" + "COALESCE(os_name, name) AS os_name\n" + "FROM node n\n" + "WHERE node_id = id_from_vos_path(?)"; Object[] args = {vosPath}; int[] types = {Types.VARCHAR}; return jdbcTemplate.queryForObject(sql, args, types, String.class); }*/ public void setNodeLocation(String vosPath, int locationId) { String sql = "UPDATE node SET location_id = ? WHERE node_id = id_from_vos_path(?)"; Loading src/main/java/it/inaf/oats/vospace/persistence/model/LocationType.java +0 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ package it.inaf.oats.vospace.persistence.model; public enum LocationType { ASYNC("async"), PORTAL("portal"), USER("user"); private final String name; Loading src/main/java/it/inaf/oats/vospace/persistence/model/StorageType.java +1 −2 Original line number Diff line number Diff line Loading @@ -9,8 +9,7 @@ public enum StorageType { COLD("cold"), HOT("hot"), LOCAL("local"), PORTAL("portal"); LOCAL("local"); private final String name; Loading src/test/java/it/inaf/oats/vospace/TransferControllerTest.java +3 −26 Original line number Diff line number Diff line Loading @@ -91,15 +91,6 @@ public class TransferControllerTest { asyncLocation.setType(LocationType.ASYNC); asyncLocation.setId(1); when(locationDao.getNodeLocation(eq("/mynode"))).thenReturn(Optional.of(asyncLocation)); Location portalLocation = new Location(); portalLocation.setType(LocationType.PORTAL); portalLocation.setId(2); Storage portalStorage = new Storage(); portalStorage.setHostname("archive.lbto.org"); portalStorage.setBaseUrl("/files"); portalLocation.setSource(portalStorage); when(locationDao.getNodeLocation(eq("/portalnode"))).thenReturn(Optional.of(portalLocation)); } @Test Loading Loading @@ -145,20 +136,6 @@ public class TransferControllerTest { verify(jobDao, times(2)).updateJob(argThat(j -> ExecutionPhase.QUEUED == j.getPhase()), any()); } /* @Test public void testPullToVoSpacePortal() throws Exception { when(nodeDao.getNodeOsName(eq("/portalnode"))).thenReturn("file.fits"); String endpoint = testAsyncTransferNegotiation("/portalnode", getResourceFileContent("pullToVoSpace-portal.xml"), ExecutionPhase.COMPLETED); assertTrue(endpoint.startsWith("http://archive.lbto.org")); verify(nodeDao, times(1)).setNodeLocation(eq("/portalnode"), eq(2), eq("lbcr.20130512.060722.fits.gz")); }*/ @Test public void testPushToVoSpace() throws Exception { // job completion will be set by file service Loading Loading
src/main/java/it/inaf/oats/vospace/UriService.java +2 −25 Original line number Diff line number Diff line Loading @@ -22,11 +22,6 @@ import it.inaf.oats.vospace.exception.NodeBusyException; import it.inaf.oats.vospace.parent.persistence.LinkedServiceDAO; import it.inaf.oats.vospace.persistence.LocationDAO; import it.inaf.oats.vospace.persistence.NodeDAO; import it.inaf.oats.vospace.persistence.model.Location; import it.inaf.oats.vospace.persistence.model.LocationType; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Objects; Loading @@ -42,7 +37,6 @@ import net.ivoa.xml.vospace.v2.Transfer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; @Service public class UriService { Loading @@ -59,9 +53,6 @@ public class UriService { @Autowired private LinkService linkService; @Autowired private LocationDAO locationDAO; @Autowired private LinkedServiceDAO linkedServiceDAO; Loading Loading @@ -232,21 +223,7 @@ public class UriService { } } else { /* Location location = locationDAO.getNodeLocation(relativePath).orElse(null); if (location != null && location.getType() == LocationType.PORTAL) { String fileName = nodeDao.getNodeOsName(relativePath); endpoint = "http://" + location.getSource().getHostname() + location.getSource().getBaseUrl(); if (!endpoint.endsWith("/")) { endpoint += "/"; } endpoint += fileName; } else {*/ endpoint = fileServiceUrl + urlEncodePath(relativePath); //} endpoint += "?jobId=" + job.getJobId(); if (!"true".equals(NodeProperties.getNodePropertyByURI(node, NodeProperties.PUBLIC_READ_URI))) { Loading
src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +0 −13 Original line number Diff line number Diff line Loading @@ -523,19 +523,6 @@ public class NodeDAO { return jdbcTemplate.queryForObject(sql, args, types, Integer.class); } /* public String getNodeOsName(String vosPath) { String sql = "SELECT \n" + "COALESCE(os_name, name) AS os_name\n" + "FROM node n\n" + "WHERE node_id = id_from_vos_path(?)"; Object[] args = {vosPath}; int[] types = {Types.VARCHAR}; return jdbcTemplate.queryForObject(sql, args, types, String.class); }*/ public void setNodeLocation(String vosPath, int locationId) { String sql = "UPDATE node SET location_id = ? WHERE node_id = id_from_vos_path(?)"; Loading
src/main/java/it/inaf/oats/vospace/persistence/model/LocationType.java +0 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,6 @@ package it.inaf.oats.vospace.persistence.model; public enum LocationType { ASYNC("async"), PORTAL("portal"), USER("user"); private final String name; Loading
src/main/java/it/inaf/oats/vospace/persistence/model/StorageType.java +1 −2 Original line number Diff line number Diff line Loading @@ -9,8 +9,7 @@ public enum StorageType { COLD("cold"), HOT("hot"), LOCAL("local"), PORTAL("portal"); LOCAL("local"); private final String name; Loading
src/test/java/it/inaf/oats/vospace/TransferControllerTest.java +3 −26 Original line number Diff line number Diff line Loading @@ -91,15 +91,6 @@ public class TransferControllerTest { asyncLocation.setType(LocationType.ASYNC); asyncLocation.setId(1); when(locationDao.getNodeLocation(eq("/mynode"))).thenReturn(Optional.of(asyncLocation)); Location portalLocation = new Location(); portalLocation.setType(LocationType.PORTAL); portalLocation.setId(2); Storage portalStorage = new Storage(); portalStorage.setHostname("archive.lbto.org"); portalStorage.setBaseUrl("/files"); portalLocation.setSource(portalStorage); when(locationDao.getNodeLocation(eq("/portalnode"))).thenReturn(Optional.of(portalLocation)); } @Test Loading Loading @@ -145,20 +136,6 @@ public class TransferControllerTest { verify(jobDao, times(2)).updateJob(argThat(j -> ExecutionPhase.QUEUED == j.getPhase()), any()); } /* @Test public void testPullToVoSpacePortal() throws Exception { when(nodeDao.getNodeOsName(eq("/portalnode"))).thenReturn("file.fits"); String endpoint = testAsyncTransferNegotiation("/portalnode", getResourceFileContent("pullToVoSpace-portal.xml"), ExecutionPhase.COMPLETED); assertTrue(endpoint.startsWith("http://archive.lbto.org")); verify(nodeDao, times(1)).setNodeLocation(eq("/portalnode"), eq(2), eq("lbcr.20130512.060722.fits.gz")); }*/ @Test public void testPushToVoSpace() throws Exception { // job completion will be set by file service Loading