use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class LinkImplTest method force_secure_URI_from_insecure_link.
@Test
public void force_secure_URI_from_insecure_link() {
Response response = mockResponse();
BaseURLSource baseURLSource = mockBaseURLSource();
train_getBaseURL(baseURLSource, true, SECURE_BASE_URL);
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();
}
use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class LinkImplTest method url_with_anchor.
@Test
public void url_with_anchor() {
Response response = mockResponse();
String url = "/foo/bar";
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();
}
use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class LinkImplTest method simple_redirect.
@Test
public void simple_redirect() {
Response response = mockResponse();
String URI = "/base/context/" + RAW_PATH;
train_encodeRedirectURL(response, URI, ENCODED);
replay();
Link link = new LinkImpl(URI, false, LinkSecurity.INSECURE, response, null, null);
assertEquals(link.toRedirectURI(), ENCODED);
verify();
}
use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class LinkImplTest method remove_parameter.
@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");
}
use of org.apache.tapestry5.http.Link in project tapestry-5 by apache.
the class LinkImplTest method absolute_URI_for_default_insecure_link.
@Test
public void absolute_URI_for_default_insecure_link() {
Response response = mockResponse();
BaseURLSource baseURLSource = mockBaseURLSource();
train_getBaseURL(baseURLSource, false, INSECURE_BASE_URL);
train_encodeURL(response, INSECURE_BASE_URL + BASE_PATH, ENCODED);
replay();
Link link = new LinkImpl(BASE_PATH, false, LinkSecurity.INSECURE, response, null, baseURLSource);
assertEquals(link.toAbsoluteURI(), ENCODED);
verify();
}
Aggregations