Search in sources :

Example 86 with UriInfo

use of javax.ws.rs.core.UriInfo in project ddf by codice.

the class AuthenticationEndpointTest method setup.

@Before
public void setup() throws SecurityServiceException, URISyntaxException {
    HttpSessionFactory sessionFactory = mock(HttpSessionFactory.class);
    HttpSession session = mock(HttpSession.class);
    when(session.getAttribute(SecurityConstants.SAML_ASSERTION)).thenReturn(mock(SecurityTokenHolder.class));
    when(sessionFactory.getOrCreateSession(any())).thenReturn(session);
    policyManager = mock(ContextPolicyManager.class);
    securityManager = mock(SecurityManager.class);
    authEndpoint = new AuthenticationEndpoint(policyManager, securityManager, sessionFactory);
    UriInfo uriInfo = mock(UriInfo.class);
    UriBuilder uriBuilder = mock(UriBuilder.class);
    when(uriInfo.getBaseUriBuilder()).thenReturn(uriBuilder);
    when(uriBuilder.replacePath(anyString())).thenReturn(uriBuilder);
    when(uriBuilder.build()).thenReturn(new URI(URL));
    authEndpoint.uriInfo = uriInfo;
    mockUser(USER_NAME, PASSWORD, REALM);
}
Also used : SecurityTokenHolder(ddf.security.common.SecurityTokenHolder) SecurityManager(ddf.security.service.SecurityManager) HttpSession(javax.servlet.http.HttpSession) HttpSessionFactory(ddf.security.http.impl.HttpSessionFactory) UriBuilder(javax.ws.rs.core.UriBuilder) URI(java.net.URI) UriInfo(javax.ws.rs.core.UriInfo) ContextPolicyManager(org.codice.ddf.security.policy.context.ContextPolicyManager) Before(org.junit.Before)

Aggregations

UriInfo (javax.ws.rs.core.UriInfo)86 Response (javax.ws.rs.core.Response)44 Test (org.junit.Test)43 URI (java.net.URI)31 Test (org.testng.annotations.Test)21 Request (org.apache.atlas.catalog.Request)12 ResourceProvider (org.apache.atlas.catalog.ResourceProvider)12 TaxonomyResourceProvider (org.apache.atlas.catalog.TaxonomyResourceProvider)12 MetadataService (org.apache.atlas.services.MetadataService)12 AtlasTypeDefStore (org.apache.atlas.store.AtlasTypeDefStore)12 HttpServletRequest (javax.servlet.http.HttpServletRequest)11 ArrayList (java.util.ArrayList)10 Map (java.util.Map)10 MediaType (javax.ws.rs.core.MediaType)10 Api (io.swagger.annotations.Api)8 ApiOperation (io.swagger.annotations.ApiOperation)8 ApiParam (io.swagger.annotations.ApiParam)8 ApiResponse (io.swagger.annotations.ApiResponse)8 ApiResponses (io.swagger.annotations.ApiResponses)8 InputStream (java.io.InputStream)8