Contains all of the informations concerning a given link. The content of the link is stored as if it were a text paragraph.
Standard properties include : none. @author Fromentin Xavier, Schnell Michaƫl, Dervin Cyrielle, Brabant Quentin @version 1.0
8081828384858687888990
train_encodeURL(response, SECURE_BASE_URL + BASE_PATH, ENCODED); replay(); Link link = new LinkImpl(BASE_PATH, false, LinkSecurity.SECURE, response, null, baseURLSource); assertEquals(link.toAbsoluteURI(), ENCODED); verify(); }
99100101102103104105106107108109
train_encodeURL(response, SECURE_BASE_URL + BASE_PATH, ENCODED); replay(); Link link = new LinkImpl(BASE_PATH, false, LinkSecurity.INSECURE, response, null, baseURLSource); assertEquals(link.toAbsoluteURI(true), ENCODED); verify(); }
118119120121122123124125126127128
train_encodeURL(response, INSECURE_BASE_URL + BASE_PATH, ENCODED); replay(); Link link = new LinkImpl(BASE_PATH, false, LinkSecurity.SECURE, response, null, baseURLSource); assertEquals(link.toAbsoluteURI(false), ENCODED); verify(); }
136137138139140141142143144145146147148
train_encodeURL(response, url, ENCODED); replay(); Link link = new LinkImpl(url, false, LinkSecurity.INSECURE, response, null, null); assertEquals(link.toString(), ENCODED); assertEquals(link.getBasePath(), url); verify(); }
152153154155156157158159160161162163164
{ Response response = mockResponse(); replay(); Link link = new LinkImpl("/foo/bar", false, null, response, null, null); link.addParameter("fred", "flintstone"); assertEquals(link.getParameterValue("fred"), "flintstone"); verify(); }
172173174175176177178179180181182183184185
train_encodeURL(response, url, ENCODED); replay(); Link link = new LinkImpl(url, false, LinkSecurity.INSECURE, response, null, null); link.setAnchor("wilma"); assertSame(link.getAnchor(), "wilma"); assertEquals(link.toURI(), ENCODED + "#" + "wilma"); verify(); }
192193194195196197198199200201202203
String expectedURI = "/ctx/foo?foo=bar&baz=barney"; train_encodeURL(response, expectedURI, expectedURI); replay(); Link link = new LinkImpl("/ctx/foo?foo=bar", false, LinkSecurity.INSECURE, response, null, null); link.addParameter("baz", "barney"); assertEquals(link.toURI(), expectedURI); verify(); }
213214215216217218219220221222223224225
String expectedURI = "/ctx/foo?bar=encoded"; train_encodeURL(response, expectedURI, expectedURI); replay(); Link link = new LinkImpl("/ctx/foo", false, LinkSecurity.INSECURE, response, encoder, null); assertSame(link.addParameterValue("bar", "plain"), link); assertEquals(link.toURI(), expectedURI); verify(); }
232233234235236237238239240241242243244245246
String expectedURI = "/ctx/baz?baz=barney"; train_encodeURL(response, expectedURI, expectedURI); replay(); Link link = new LinkImpl("/ctx/foo", false, LinkSecurity.INSECURE, response, null, null); link.addParameter("baz", "barney"); link.setAnchor("jacob"); Link copy = link.copyWithBasePath("/ctx/baz"); assertEquals(copy.toURI(), expectedURI + "#jacob"); verify(); }
246247248249250251252253254255256257258259260
} @Test public void remove_parameter() { Link link = new LinkImpl("/baseURI", false, null, null, null, null); link.addParameter("fred", "flintstone"); link.addParameter("barney", "rubble"); link.removeParameter("fred"); assertNull(link.getParameterValue("fred")); assertListsEquals(link.getParameterNames(), "barney"); }