Search in sources :

Example 6 with ClientSummary

use of org.orcid.jaxb.model.client_v2.ClientSummary in project ORCID-Source by ORCID.

the class ClientManagerReadOnlyTest method getClientSummary.

private ClientSummary getClientSummary(String randomString) {
    ClientSummary summary = new ClientSummary();
    summary.setDescription("description " + randomString);
    summary.setName("client-name " + randomString);
    return summary;
}
Also used : ClientSummary(org.orcid.jaxb.model.client_v2.ClientSummary)

Example 7 with ClientSummary

use of org.orcid.jaxb.model.client_v2.ClientSummary in project ORCID-Source by ORCID.

the class ClientManagerReadOnlyTest method getSummaryTest.

@Test
public void getSummaryTest() {
    String seed = RandomStringUtils.randomAlphanumeric(30);
    when(daoMock.findByClientId(anyString(), anyLong())).thenReturn(getClientDetailsEntity(seed));
    ClientSummary summary = clientManagerReadOnly.getSummary(seed);
    assertEquals(getClientSummary(seed), summary);
}
Also used : ClientSummary(org.orcid.jaxb.model.client_v2.ClientSummary) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 8 with ClientSummary

use of org.orcid.jaxb.model.client_v2.ClientSummary in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testViewClient.

@Test
public void testViewClient() {
    Response response = serviceDelegator.viewClient("APP-6666666666666666");
    assertNotNull(response.getEntity());
    assertTrue(response.getEntity() instanceof ClientSummary);
    ClientSummary client = (ClientSummary) response.getEntity();
    assertEquals("Source Client 2", client.getName());
    assertEquals("A test source client", client.getDescription());
}
Also used : Response(javax.ws.rs.core.Response) ClientSummary(org.orcid.jaxb.model.client_v2.ClientSummary) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 9 with ClientSummary

use of org.orcid.jaxb.model.client_v2.ClientSummary in project ORCID-Source by ORCID.

the class PublicV2ApiServiceVersionedDelegatorTest method testViewClient.

@Test
public void testViewClient() {
    Response response = serviceDelegator.viewClient("APP-6666666666666666");
    assertNotNull(response.getEntity());
    assertTrue(response.getEntity() instanceof ClientSummary);
    ClientSummary client = (ClientSummary) response.getEntity();
    assertEquals("Source Client 2", client.getName());
    assertEquals("A test source client", client.getDescription());
}
Also used : Response(javax.ws.rs.core.Response) ClientSummary(org.orcid.jaxb.model.client_v2.ClientSummary) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 10 with ClientSummary

use of org.orcid.jaxb.model.client_v2.ClientSummary in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method viewClient.

@Override
public Response viewClient(String clientId) {
    orcidSecurityManager.checkScopes(ScopePathType.READ_PUBLIC);
    ClientSummary client = clientManagerReadOnly.getSummary(clientId);
    return Response.ok(client).build();
}
Also used : ClientSummary(org.orcid.jaxb.model.client_v2.ClientSummary)

Aggregations

ClientSummary (org.orcid.jaxb.model.client_v2.ClientSummary)10 Test (org.junit.Test)6 Response (javax.ws.rs.core.Response)4 DBUnitTest (org.orcid.test.DBUnitTest)4 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 MapperFactory (ma.glasnost.orika.MapperFactory)1 MappingContext (ma.glasnost.orika.MappingContext)1 DefaultMapperFactory (ma.glasnost.orika.impl.DefaultMapperFactory)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 Client (org.orcid.jaxb.model.client_v2.Client)1 ClientRedirectUri (org.orcid.jaxb.model.client_v2.ClientRedirectUri)1 FuzzyDate (org.orcid.jaxb.model.common_v2.FuzzyDate)1 PublicationDate (org.orcid.jaxb.model.common_v2.PublicationDate)1 ClientRedirectUriEntity (org.orcid.persistence.jpa.entities.ClientRedirectUriEntity)1 ClientSecretEntity (org.orcid.persistence.jpa.entities.ClientSecretEntity)1