Fix load from record url
This commit is contained in:
parent
ca660cf8b6
commit
5d6aa5a4d1
|
@ -126,8 +126,9 @@ public class SingleISResourceUCDProvider extends AbstractScopedMap<ProfileMap> {
|
|||
try {
|
||||
log.debug("Loading UCD From {} ", record);
|
||||
String json = new Scanner(
|
||||
new URL("http://www.google.com").openStream(),
|
||||
"UTF-8").next();
|
||||
new URL(record.getUcdUrl()).openStream(),
|
||||
"UTF-8").useDelimiter("\\A").next();
|
||||
log.trace("JSON IS {} ",json);
|
||||
UseCaseDescriptor ucd = Serialization.read(json, UseCaseDescriptor.class);
|
||||
toReturn.put(ucd.getId(), ucd);
|
||||
}catch (Throwable t){
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.application.geoportal.service.engine.providers.ucd;
|
|||
|
||||
import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader;
|
||||
import org.gcube.application.cms.tests.TokenSetter;
|
||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -11,6 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class UCDLoadingTest {
|
||||
|
@ -33,9 +35,13 @@ public class UCDLoadingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLoading(){
|
||||
public void testLoading() throws ConfigurationException {
|
||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
TokenSetter.set(GCubeTest.getContext());
|
||||
// SingleISResourceUCDProvider provider =
|
||||
SingleISResourceUCDProvider provider = new SingleISResourceUCDProvider();
|
||||
ProfileMap map = provider.getObject();
|
||||
System.out.println("loaded "+map.size()+" ucds");
|
||||
assertTrue(map.size()>0);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue