Search in sources :

Example 41 with ContainerRequest

use of com.sun.jersey.spi.container.ContainerRequest in project ORCID-Source by ORCID.

the class APIEndpointParserTest method testAPIEndpointParserWithoutApiVersionWithOrcid.

@Test
public void testAPIEndpointParserWithoutApiVersionWithOrcid() {
    ContainerRequest request = getRequest("https://localhost:8443/orcid-api-web/1234-4321-1234-4321/orcid-bio");
    APIEndpointParser parser = new APIEndpointParser(request);
    assertNotNull(parser.getApiVersion());
    assertEquals("", parser.getApiVersion());
    assertEquals("orcid-bio", parser.getCategory());
    assertEquals("1234-4321-1234-4321", parser.getOrcidId());
}
Also used : ContainerRequest(com.sun.jersey.spi.container.ContainerRequest) Test(org.junit.Test)

Example 42 with ContainerRequest

use of com.sun.jersey.spi.container.ContainerRequest in project ORCID-Source by ORCID.

the class APIEndpointParserTest method testAPIEndpointParserWithoutApiVersionOrOrcid.

@Test
public void testAPIEndpointParserWithoutApiVersionOrOrcid() {
    ContainerRequest request = getRequest("https://localhost:8443/orcid-api-web/oauth/token");
    APIEndpointParser parser = new APIEndpointParser(request);
    assertNotNull(parser.getApiVersion());
    assertEquals("", parser.getApiVersion());
    assertEquals("oauth", parser.getCategory());
    assertNull(parser.getOrcidId());
}
Also used : ContainerRequest(com.sun.jersey.spi.container.ContainerRequest) Test(org.junit.Test)

Example 43 with ContainerRequest

use of com.sun.jersey.spi.container.ContainerRequest in project ORCID-Source by ORCID.

the class APIEndpointParserTest method testAPIEndpointParserWithApiVersionAndOrcid.

@Test
public void testAPIEndpointParserWithApiVersionAndOrcid() {
    ContainerRequest request = getRequest("https://localhost:8443/orcid-api-web/v2.0/1234-4321-1234-4321/works");
    APIEndpointParser parser = new APIEndpointParser(request);
    assertEquals("v2.0", parser.getApiVersion());
    assertEquals("works", parser.getCategory());
    assertEquals("1234-4321-1234-4321", parser.getOrcidId());
}
Also used : ContainerRequest(com.sun.jersey.spi.container.ContainerRequest) Test(org.junit.Test)

Aggregations

ContainerRequest (com.sun.jersey.spi.container.ContainerRequest)43 Test (org.junit.Test)37 InBoundHeaders (com.sun.jersey.core.header.InBoundHeaders)16 WebApplication (com.sun.jersey.spi.container.WebApplication)10 ByteArrayInputStream (java.io.ByteArrayInputStream)10 URI (java.net.URI)9 OrcidBadRequestException (org.orcid.core.exception.OrcidBadRequestException)9 SimbaCredentials (org.simbasecurity.dwclient.dropwizard.credentials.SimbaCredentials)6 ContainerResponse (com.sun.jersey.spi.container.ContainerResponse)5 THttpClient (org.apache.thrift.transport.THttpClient)5 Client (org.simbasecurity.api.service.thrift.AuthenticationFilterService.Client)5 RequestData (org.simbasecurity.api.service.thrift.RequestData)5 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 XForwardFilter (org.neo4j.server.web.XForwardFilter)4 ActionDescriptor (org.simbasecurity.api.service.thrift.ActionDescriptor)4 ContainerRequestBuilderForTests (org.simbasecurity.dwclient.test.dropwizard.matchers.ContainerRequestBuilderForTests)4 ActionDescriptorBuilderForTests (org.simbasecurity.dwclient.test.stub.simba.ActionDescriptorBuilderForTests)4 Before (org.junit.Before)3 SimbaCredentialsBuilderForTests (org.simbasecurity.dwclient.dropwizard.credentials.SimbaCredentialsBuilderForTests)3