Search in sources :

Example 1 with NotificationRegistrationEntity

use of org.finra.herd.model.jpa.NotificationRegistrationEntity in project herd by FINRAOS.

the class NotificationRegistrationDaoTest method testGetNotificationRegistrationAssertReturnNullWhenRegistrationDoesNotExist.

@Test
public void testGetNotificationRegistrationAssertReturnNullWhenRegistrationDoesNotExist() {
    NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(businessObjectDataNotificationRegistrationKey, NOTIFICATION_EVENT_TYPE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
    NotificationRegistrationEntity notificationRegistration = notificationRegistrationDao.getNotificationRegistration(businessObjectDataNotificationRegistrationKey.getNamespace(), "DOES_NOT_EXIST");
    assertNull(notificationRegistration);
}
Also used : NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) NotificationRegistrationEntity(org.finra.herd.model.jpa.NotificationRegistrationEntity) BusinessObjectDataNotificationRegistrationEntity(org.finra.herd.model.jpa.BusinessObjectDataNotificationRegistrationEntity) Test(org.junit.Test)

Example 2 with NotificationRegistrationEntity

use of org.finra.herd.model.jpa.NotificationRegistrationEntity in project herd by FINRAOS.

the class NotificationRegistrationDaoImpl method getNotificationRegistration.

@Override
public NotificationRegistrationEntity getNotificationRegistration(String namespace, String name) {
    CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
    CriteriaQuery<NotificationRegistrationEntity> criteriaQuery = criteriaBuilder.createQuery(NotificationRegistrationEntity.class);
    Root<NotificationRegistrationEntity> notificationRegistration = criteriaQuery.from(NotificationRegistrationEntity.class);
    Path<NamespaceEntity> namespacePath = notificationRegistration.get(NotificationRegistrationEntity_.namespace);
    return executeSingleResultQuery(criteriaQuery.select(notificationRegistration).where(criteriaBuilder.equal(criteriaBuilder.upper(namespacePath.get(NamespaceEntity_.code)), namespace.toUpperCase()), criteriaBuilder.equal(criteriaBuilder.upper(notificationRegistration.get(NotificationRegistrationEntity_.name)), name.toUpperCase())), "More than 1 notification registration was found with namespace \"" + namespace + "\" and name \"" + name + "\"");
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) NamespaceEntity(org.finra.herd.model.jpa.NamespaceEntity) NotificationRegistrationEntity(org.finra.herd.model.jpa.NotificationRegistrationEntity)

Example 3 with NotificationRegistrationEntity

use of org.finra.herd.model.jpa.NotificationRegistrationEntity in project herd by FINRAOS.

the class NotificationRegistrationDaoHelperTest method testGetNotificationRegistrationAssertReturnEntityWhenEntityExists.

@Test
public void testGetNotificationRegistrationAssertReturnEntityWhenEntityExists() {
    NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, BDEF_NAME);
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(businessObjectDataNotificationRegistrationKey, NotificationEventTypeEntity.EventTypesBdata.BUS_OBJCT_DATA_STTS_CHG.name(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
    NotificationRegistrationEntity notificationRegistrationEntity = notificationRegistrationDaoHelper.getNotificationRegistration(NAMESPACE, BDEF_NAME);
    assertNotNull(notificationRegistrationEntity);
    assertEquals(NAMESPACE, notificationRegistrationEntity.getNamespace().getCode());
    assertEquals(BDEF_NAME, notificationRegistrationEntity.getName());
}
Also used : NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) NotificationRegistrationEntity(org.finra.herd.model.jpa.NotificationRegistrationEntity) Test(org.junit.Test) AbstractServiceTest(org.finra.herd.service.AbstractServiceTest)

Example 4 with NotificationRegistrationEntity

use of org.finra.herd.model.jpa.NotificationRegistrationEntity in project herd by FINRAOS.

the class NotificationRegistrationDaoTest method testGetNotificationRegistrationAssertReturnEntityWhenRegistrationExist.

@Test
public void testGetNotificationRegistrationAssertReturnEntityWhenRegistrationExist() {
    NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(businessObjectDataNotificationRegistrationKey, NOTIFICATION_EVENT_TYPE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
    NotificationRegistrationEntity notificationRegistration = notificationRegistrationDao.getNotificationRegistration(businessObjectDataNotificationRegistrationKey.getNamespace(), businessObjectDataNotificationRegistrationKey.getNotificationName());
    assertNotNull(notificationRegistration);
    assertEquals(BusinessObjectDataNotificationRegistrationEntity.class, notificationRegistration.getClass());
}
Also used : NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) NotificationRegistrationEntity(org.finra.herd.model.jpa.NotificationRegistrationEntity) BusinessObjectDataNotificationRegistrationEntity(org.finra.herd.model.jpa.BusinessObjectDataNotificationRegistrationEntity) Test(org.junit.Test)

Example 5 with NotificationRegistrationEntity

use of org.finra.herd.model.jpa.NotificationRegistrationEntity in project herd by FINRAOS.

the class NotificationRegistrationDaoTest method testGetNotificationRegistrationAssertReturnEntityWhenRegistrationExistAndDifferentCase.

@Test
public void testGetNotificationRegistrationAssertReturnEntityWhenRegistrationExistAndDifferentCase() {
    NotificationRegistrationKey businessObjectDataNotificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE.toLowerCase(), NOTIFICATION_NAME.toLowerCase());
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(businessObjectDataNotificationRegistrationKey, NOTIFICATION_EVENT_TYPE, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, STORAGE_NAME, BDATA_STATUS, BDATA_STATUS, notificationRegistrationDaoTestHelper.getTestJobActions(), NotificationRegistrationStatusEntity.ENABLED);
    NotificationRegistrationEntity notificationRegistration = notificationRegistrationDao.getNotificationRegistration(businessObjectDataNotificationRegistrationKey.getNamespace(), businessObjectDataNotificationRegistrationKey.getNotificationName());
    assertNotNull(notificationRegistration);
    assertEquals(BusinessObjectDataNotificationRegistrationEntity.class, notificationRegistration.getClass());
}
Also used : NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) NotificationRegistrationEntity(org.finra.herd.model.jpa.NotificationRegistrationEntity) BusinessObjectDataNotificationRegistrationEntity(org.finra.herd.model.jpa.BusinessObjectDataNotificationRegistrationEntity) Test(org.junit.Test)

Aggregations

NotificationRegistrationEntity (org.finra.herd.model.jpa.NotificationRegistrationEntity)6 NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)5 Test (org.junit.Test)4 BusinessObjectDataNotificationRegistrationEntity (org.finra.herd.model.jpa.BusinessObjectDataNotificationRegistrationEntity)3 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1 NotificationRegistrationStatusUpdateResponse (org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse)1 NamespaceEntity (org.finra.herd.model.jpa.NamespaceEntity)1 NotificationRegistrationStatusEntity (org.finra.herd.model.jpa.NotificationRegistrationStatusEntity)1 AbstractServiceTest (org.finra.herd.service.AbstractServiceTest)1