Search in sources :

Example 11 with WebhookEntity

use of org.orcid.persistence.jpa.entities.WebhookEntity in project ORCID-Source by ORCID.

the class WebhookDaoTest method testFindWebhooksReadyToProcess.

@Test
@Rollback(true)
public void testFindWebhooksReadyToProcess() {
    Date now = new Date();
    List<WebhookEntity> results = webhookDao.findWebhooksReadyToProcess(now, 5, 10);
    assertNotNull(results);
    assertEquals(1, results.size());
    Set<String> orcids = new HashSet<>();
    for (WebhookEntity result : results) {
        orcids.add(result.getProfile().getId());
    }
    assertTrue(orcids.contains("4444-4444-4444-4443"));
}
Also used : WebhookEntity(org.orcid.persistence.jpa.entities.WebhookEntity) Date(java.util.Date) HashSet(java.util.HashSet) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback)

Aggregations

WebhookEntity (org.orcid.persistence.jpa.entities.WebhookEntity)11 Test (org.junit.Test)8 Date (java.util.Date)5 WebhookEntityPk (org.orcid.persistence.jpa.entities.keys.WebhookEntityPk)5 BaseTest (org.orcid.core.BaseTest)4 DBUnitTest (org.orcid.test.DBUnitTest)4 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)3 Rollback (org.springframework.test.annotation.Rollback)3 HashMap (java.util.HashMap)2 OrcidNotFoundException (org.orcid.core.exception.OrcidNotFoundException)2 AccessControl (org.orcid.core.security.visibility.aop.AccessControl)2 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)2 Authentication (org.springframework.security.core.Authentication)2 OAuth2Authentication (org.springframework.security.oauth2.provider.OAuth2Authentication)2 OAuth2Request (org.springframework.security.oauth2.provider.OAuth2Request)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1