Commit 2439a480 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Allowed external http and https targets for LinkNodes

parent 0b93e662
......@@ -346,7 +346,7 @@ public class UriService {
public enum ProtocolType {
// Please keep the URIs in this enum UNIQUE!
// will add a unit test to check this
// added a unit test to check this
HTTPGET("ivo://ivoa.net/vospace/core#httpget", "http"),
HTTPSGET("ivo://ivoa.net/vospace/core#httpsget", "https"),
HTTPPUT("ivo://ivoa.net/vospace/core#httpput", "http"),
......
......@@ -7,6 +7,7 @@ package it.inaf.oats.vospace;
import it.inaf.ia2.aa.ServletRapClient;
import it.inaf.ia2.aa.data.User;
import it.inaf.oats.vospace.UriService.ProtocolType;
import it.inaf.oats.vospace.datamodel.NodeProperties;
import it.inaf.oats.vospace.datamodel.NodeUtils;
import it.inaf.oats.vospace.datamodel.Views;
......@@ -20,7 +21,9 @@ 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.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import net.ivoa.xml.uws.v1.JobSummary;
import net.ivoa.xml.vospace.v2.ContainerNode;
......@@ -671,4 +674,14 @@ public class UriServiceTest {
return job;
}
@Test
public void testProtocolType() {
List<ProtocolType> pts = List.of(ProtocolType.values());
int distinctUris =
pts.stream().map(pt -> pt.getUri()).distinct().collect(Collectors.toList()).size();
assertEquals(pts.size(), distinctUris);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment