Revision 49580
Added by Sandro La Bruzzo over 6 years ago
DLIParserTest.java | ||
---|---|---|
28 | 28 |
import org.junit.Before; |
29 | 29 |
import org.junit.Ignore; |
30 | 30 |
import org.junit.Test; |
31 |
import org.junit.runner.RunWith; |
|
31 | 32 |
import org.mockito.Mock; |
32 | 33 |
import org.mockito.Mockito; |
33 | 34 |
import org.springframework.beans.factory.annotation.Autowired; |
35 |
import org.springframework.test.context.ContextConfiguration; |
|
36 |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|
34 | 37 |
|
35 | 38 |
import static org.mockito.Mockito.when; |
36 | 39 |
|
... | ... | |
39 | 42 |
*/ |
40 | 43 |
|
41 | 44 |
|
42 |
//@RunWith(SpringJUnit4ClassRunner.class) |
|
43 |
//@ContextConfiguration(classes = { ConfigurationTestConfig.class, ConfigurationResolverStoreTestConfig.class }) |
|
45 |
@RunWith(SpringJUnit4ClassRunner.class) |
|
46 |
@ContextConfiguration(classes = { ConfigurationTestConfig.class}) |
|
47 |
public class DLIParserTest extends DLIAbstractTest{ |
|
44 | 48 |
|
45 |
@Ignore |
|
46 |
public class DLIParserTest { |
|
47 |
|
|
48 | 49 |
private static final Log log = LogFactory.getLog(DLIParserTest.class); |
49 | 50 |
|
50 |
@Mock |
|
51 |
private DLIUtils dliUtilsInstance; |
|
52 |
|
|
53 |
|
|
54 |
@Mock |
|
55 |
private UniqueServiceLocator uniqueServiceLocator; |
|
56 |
|
|
57 |
@Mock |
|
58 |
private ISLookUpService isLookUpServiceMock; |
|
59 |
|
|
60 | 51 |
@Autowired |
61 | 52 |
private DLIResolverSerializer serializer; |
62 | 53 |
|
63 |
|
|
64 |
@Before |
|
65 |
public void initialize() throws ISLookUpException, IOException { |
|
66 |
|
|
67 |
final String query = "for $x in collection('/db/DRIVER/RepositoryServiceResources/RepositoryServiceResourceType') " |
|
68 |
+ "return concat($x//FIELD[./key='NamespacePrefix']/value/text(),'@--@',$x//FIELD[./key='DataSourceId']/value/text(),'@--@',$x//ENGLISH_NAME )"; |
|
69 |
dliUtilsInstance = Mockito.mock(DLIUtils.class); |
|
70 |
|
|
71 |
uniqueServiceLocator = Mockito.mock(UniqueServiceLocator.class); |
|
72 |
isLookUpServiceMock = Mockito.mock(ISLookUpService.class); |
|
73 |
dliUtilsInstance.setServiceLocator(uniqueServiceLocator); |
|
74 |
DLIUtils.setInstance(dliUtilsInstance); |
|
75 |
when(dliUtilsInstance.getServiceLocator()).thenReturn(uniqueServiceLocator); |
|
76 |
when(uniqueServiceLocator.getService(ISLookUpService.class)).thenReturn(isLookUpServiceMock); |
|
77 |
List<String> resutlDS = Arrays.asList( |
|
78 |
"r3d100010255@--@dli_________::r3d100010255@--@icpsr", |
|
79 |
"datacite____@--@dli_________::datacite____@--@Datasets in Datacite", |
|
80 |
"r3d100010134@--@dli_________::r3d100010134@--@pangaea", |
|
81 |
"r3d100010527@--@dli_________::r3d100010527@--@European Nucleotide Archive" |
|
82 |
|
|
83 |
); |
|
84 |
when(isLookUpServiceMock.quickSearchProfile(query)).thenReturn(resutlDS); |
|
85 |
DLIUtils.ontologies = OntologyLoader.loadOntologiesFromCp(); |
|
86 |
|
|
87 |
|
|
88 |
} |
|
89 |
|
|
90 | 54 |
@Test |
91 | 55 |
public void testDMFParser() throws IOException { |
92 | 56 |
final InputStream resourceAsStream = getClass().getResourceAsStream("/eu/dnetlib/dli/parser/InputRecordDMF.xml"); |
Also available in: Unified diff
Changed Crossref to use dump on mongoDB