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

Cleaned commented parts

parent a626fb14
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......@@ -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 {
......@@ -59,9 +53,6 @@ public class UriService {
@Autowired
private LinkService linkService;
@Autowired
private LocationDAO locationDAO;
@Autowired
private LinkedServiceDAO linkedServiceDAO;
......@@ -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))) {
......
......@@ -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(?)";
......
......@@ -8,7 +8,6 @@ package it.inaf.oats.vospace.persistence.model;
public enum LocationType {
ASYNC("async"),
PORTAL("portal"),
USER("user");
private final String name;
......
......@@ -9,8 +9,7 @@ public enum StorageType {
COLD("cold"),
HOT("hot"),
LOCAL("local"),
PORTAL("portal");
LOCAL("local");
private final String name;
......
......@@ -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
......@@ -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
......
<vos:transfer xmlns:vos="http://www.ivoa.net/xml/VOSpace/v2.0" version="2.1">
<vos:target>vos://example.com!vospace/portalnode</vos:target>
<vos:direction>pullToVoSpace</vos:direction>
<vos:protocol uri="ivo://ivoa.net/vospace/core#httpget">
<vos:endpoint>http://archive.lbto.org/files/lbcr.20130512.060722.fits.gz</vos:endpoint>
</vos:protocol>
</vos:transfer>
\ No newline at end of file
......@@ -4,12 +4,10 @@ INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('cold'
INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('hot', '/mnt/hot_storage/users', NULL, 'server');
INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('local', '/home', NULL, 'localhost');
INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('local', '/home/vospace/upload', NULL, 'localhost');
INSERT INTO storage (storage_type, base_path, base_url, hostname) VALUES ('portal', NULL, '/files/lbt', 'archive.lbto.org');
INSERT INTO location (location_type, storage_src_id, storage_dest_id) VALUES ('async', 1, 3);
INSERT INTO location (location_type, storage_src_id, storage_dest_id) VALUES ('async', 2, 3);
INSERT INTO location (location_type, storage_src_id, storage_dest_id) VALUES ('user', 4, 4);
INSERT INTO location (location_type, storage_src_id, storage_dest_id) VALUES ('portal', 5, 5);
DELETE FROM node;
ALTER SEQUENCE node_node_id_seq RESTART WITH 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment