Search in sources :

Example 26 with HttpContext

use of org.forgerock.json.resource.http.HttpContext in project OpenAM by OpenRock.

the class RequestValuesBaseURLProviderTest method testGetBaseURLFromHTTPContextWithContextPath.

@Test
public void testGetBaseURLFromHTTPContextWithContextPath() throws Exception {
    // Given
    HttpContext httpContext = new HttpContext(json(object(field(BaseURLConstants.ATTR_HEADERS, Collections.emptyMap()), field(BaseURLConstants.ATTR_PARAMETERS, Collections.emptyMap()), field("path", "http://fred:8080/toto"))), null);
    provider.setContextPath("/openam");
    // When
    String url = provider.getRootURL(httpContext);
    // Then
    assertThat(url).isEqualTo("http://fred:8080/openam");
}
Also used : HttpContext(org.forgerock.json.resource.http.HttpContext) Test(org.testng.annotations.Test)

Aggregations

HttpContext (org.forgerock.json.resource.http.HttpContext)26 Test (org.testng.annotations.Test)8 SSOException (com.iplanet.sso.SSOException)7 List (java.util.List)6 ResourceException (org.forgerock.json.resource.ResourceException)6 SMSException (com.sun.identity.sm.SMSException)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)5 HashMap (java.util.HashMap)5 JsonValue (org.forgerock.json.JsonValue)5 NotFoundException (org.forgerock.json.resource.NotFoundException)5 NotSupportedException (org.forgerock.json.resource.NotSupportedException)5 SSOToken (com.iplanet.sso.SSOToken)4 ISLocaleContext (com.sun.identity.common.ISLocaleContext)4 IdRepoException (com.sun.identity.idm.IdRepoException)4 ServiceNotFoundException (com.sun.identity.sm.ServiceNotFoundException)4 MessagingException (javax.mail.MessagingException)4 Subject (javax.security.auth.Subject)4 BadRequestException (org.forgerock.json.resource.BadRequestException)4 ConflictException (org.forgerock.json.resource.ConflictException)4 ForbiddenException (org.forgerock.json.resource.ForbiddenException)4