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);
}
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 + "\"");
}
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());
}
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());
}
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());
}
Aggregations