1
|
package eu.dnetlib.grid.process.utils;
|
2
|
|
3
|
import java.io.FileInputStream;
|
4
|
import java.io.FileNotFoundException;
|
5
|
import java.io.InputStream;
|
6
|
import java.util.HashSet;
|
7
|
import java.util.Set;
|
8
|
import java.util.stream.Collectors;
|
9
|
|
10
|
import org.junit.Before;
|
11
|
import org.junit.Ignore;
|
12
|
import org.junit.Test;
|
13
|
|
14
|
import eu.dnetlib.grid.process.model.GridOrganization;
|
15
|
|
16
|
@Ignore
|
17
|
public class GridUtilsTest {
|
18
|
|
19
|
@Before
|
20
|
public void setUp() throws Exception {}
|
21
|
|
22
|
@Test
|
23
|
public void test() throws FileNotFoundException {
|
24
|
// final InputStream is = getClass().getResourceAsStream("grid_example.json");
|
25
|
final InputStream is = new FileInputStream("/Users/michele/Desktop/grid.json");
|
26
|
int i = 0;
|
27
|
final Set<String> s = new HashSet<>();
|
28
|
for (final GridOrganization o : GridUtils.getOrganizations(is)) {
|
29
|
System.out.println(++i + " " + o.getId());
|
30
|
o.getAddresses().forEach(a -> s.add(a.getCountry_code()));
|
31
|
}
|
32
|
System.out.println(s.stream().collect(Collectors.joining(", ")));
|
33
|
|
34
|
}
|
35
|
|
36
|
}
|