Search in sources :

Example 11 with Client

use of org.orcid.pojo.ajaxForm.Client in project ORCID-Source by ORCID.

the class GroupAdministratorControllerTest method testInvalidName.

@Test
public void testInvalidName() {
    Client client = controller.getClient();
    client.setRedirectUris(new ArrayList<RedirectUri>());
    client.setDisplayName(Text.valueOf("This is a <a>invalid</a> name"));
    client.setShortDescription(Text.valueOf("This is a valid description"));
    client.setWebsite(Text.valueOf("http://www.orcid.org"));
    client = controller.createClient(client);
    assertNotNull(client);
    assertEquals(1, client.getErrors().size());
    assertEquals(controller.getMessage("manage.developer_tools.group.error.display_name.html"), client.getErrors().get(0));
}
Also used : RedirectUri(org.orcid.pojo.ajaxForm.RedirectUri) Client(org.orcid.pojo.ajaxForm.Client) Test(org.junit.Test) BaseControllerTest(org.orcid.frontend.web.util.BaseControllerTest)

Example 12 with Client

use of org.orcid.pojo.ajaxForm.Client in project ORCID-Source by ORCID.

the class GroupAdministratorControllerTest method emptyClientTest.

@Test
@Transactional("transactionManager")
@Rollback(true)
public void emptyClientTest() {
    Client client = controller.getClient();
    client = controller.createClient(client);
    assertNotNull(client);
    List<String> errors = client.getErrors();
    assertEquals(4, errors.size());
    assertTrue(errors.contains(controller.getMessage("manage.developer_tools.group.error.display_name.empty")));
    assertTrue(errors.contains(controller.getMessage("manage.developer_tools.group.error.website.empty")));
    assertTrue(errors.contains(controller.getMessage("manage.developer_tools.group.error.short_description.empty")));
    assertTrue(errors.contains(controller.getMessage("common.invalid_url")));
}
Also used : Client(org.orcid.pojo.ajaxForm.Client) Test(org.junit.Test) BaseControllerTest(org.orcid.frontend.web.util.BaseControllerTest) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Client (org.orcid.pojo.ajaxForm.Client)12 Test (org.junit.Test)8 RedirectUri (org.orcid.pojo.ajaxForm.RedirectUri)7 BaseControllerTest (org.orcid.frontend.web.util.BaseControllerTest)5 ArrayList (java.util.ArrayList)4 OrcidClient (org.orcid.jaxb.model.clientgroup.OrcidClient)3 DBUnitTest (org.orcid.test.DBUnitTest)3 Text (org.orcid.pojo.ajaxForm.Text)2 Rollback (org.springframework.test.annotation.Rollback)2 Transactional (org.springframework.transaction.annotation.Transactional)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Produces (javax.ws.rs.Produces)1 OrcidClientGroupManagementException (org.orcid.core.exception.OrcidClientGroupManagementException)1 OrcidClientGroup (org.orcid.jaxb.model.clientgroup.OrcidClientGroup)1 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)1 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)1 ClientSecretEntity (org.orcid.persistence.jpa.entities.ClientSecretEntity)1