source: vlo/trunk/vlo_web_app/src/test/java/eu/clarin/cmdi/vlo/pages/ResourceLinkPanelTest.java @ 3362

Last change on this file since 3362 was 3362, checked in by teckart, 11 years ago

Fixed broken Handle resolution. New implementation is omiting requests to resource server (fixing ticket #290). Enables tests again that were disabled in commit r2949(fixing ticket #319)

File size: 1.5 KB
Line 
1package eu.clarin.cmdi.vlo.pages;
2
3import eu.clarin.cmdi.vlo.FacetConstants;
4import eu.clarin.cmdi.vlo.VloWebApplication;
5import eu.clarin.cmdi.vlo.config.VloConfig;
6import org.apache.wicket.util.tester.WicketTester;
7import org.junit.Assert;
8import org.junit.Before;
9import org.junit.Test;
10
11
12public class ResourceLinkPanelTest {
13
14    public static final String _SAME_STRING = "http://blabla";
15    public static final String _RESOLVE_STRING = "hdl:1839/00-0000-0000-0004-3357-F";
16    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";
17    @Before
18    public void setUp() {
19       
20        WicketTester wicketTester;
21
22        // read the configuration from the packaged configuration file
23        VloConfig.readPackagedConfig();
24
25        // optionally, modify the configuration here
26       
27        // run the web application outside a web server container context
28        wicketTester = new WicketTester(new VloWebApplication(false));
29    }
30
31    @Test
32    public void getNameFromLinkTest(){
33        ResourceLinkPanel totest = new ResourceLinkPanel("a", FacetConstants.RESOURCE_TYPE_AUDIO, "a");
34        String uit = totest.getNameFromLink(_SAME_STRING);
35        Assert.assertTrue("Returns the same string if it does not start with the handle-prefix",uit.equals(_SAME_STRING));
36
37        uit = totest.getNameFromLink(_RESOLVE_STRING);
38        Assert.assertTrue("Returns the resolved url of the handle pid", uit.equals(_RESOLVE_OUT));
39    }
40}
Note: See TracBrowser for help on using the repository browser.