1 | package eu.clarin.cmdi.vlo.pages; |
---|
2 | |
---|
3 | import eu.clarin.cmdi.vlo.FacetConstants; |
---|
4 | import eu.clarin.cmdi.vlo.VloWebApplication; |
---|
5 | import eu.clarin.cmdi.vlo.config.VloConfig; |
---|
6 | import org.apache.wicket.util.tester.WicketTester; |
---|
7 | import org.junit.Before; |
---|
8 | import org.junit.Assert; |
---|
9 | import org.junit.Test; |
---|
10 | |
---|
11 | |
---|
12 | public class ResourceLinkPanelTest { |
---|
13 | |
---|
14 | static VloConfig testConfig; |
---|
15 | |
---|
16 | public static final String _SAME_STRING = "http://blabla"; |
---|
17 | public static final String _RESOLVE_STRING = "hdl:1839/00-0000-0000-0004-3357-F"; |
---|
18 | public static final String _RESOLVE_OUT = "http://corpus1.mpi.nl/qfs1/media-archive/dobes_data/Marquesan/North_Marquesas/Nuku_Hiva/narratives/Media/Expl-Anc-Et-NH.m4a"; |
---|
19 | @Before |
---|
20 | public void setUp() { |
---|
21 | |
---|
22 | WicketTester wicketTester; |
---|
23 | |
---|
24 | String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); |
---|
25 | |
---|
26 | testConfig = VloConfig.readTestConfig(fileName); |
---|
27 | |
---|
28 | // optionally, modify the test configuration here |
---|
29 | |
---|
30 | wicketTester = new WicketTester(new VloWebApplication(testConfig)); |
---|
31 | } |
---|
32 | |
---|
33 | @Test |
---|
34 | public void getNameFromLinkTest(){ |
---|
35 | ResourceLinkPanel totest = new ResourceLinkPanel("a", FacetConstants.RESOURCE_TYPE_AUDIO, "a"); |
---|
36 | String uit = totest.getNameFromLink(_SAME_STRING); |
---|
37 | Assert.assertTrue("Returns the same string if it does not start with the handle-prefix",uit.equals(_SAME_STRING)); |
---|
38 | |
---|
39 | uit = totest.getNameFromLink(_RESOLVE_STRING); |
---|
40 | Assert.assertTrue("Returns the resolved url of the handle pid", uit.equals(_RESOLVE_OUT)); |
---|
41 | } |
---|
42 | } |
---|