Search in sources :

Example 1 with NotificationRegistrationStatusUpdateResponse

use of org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse in project herd by FINRAOS.

the class NotificationRegistrationStatusServiceTest method testUpdateNotificationRegistrationStatusAssertUpdateSuccessTrim.

@Test
public void testUpdateNotificationRegistrationStatusAssertUpdateSuccessTrim() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKey, 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);
    NotificationRegistrationStatusUpdateResponse response = notificationRegistrationStatusService.updateNotificationRegistrationStatus(addWhitespace(NAMESPACE), addWhitespace(NOTIFICATION_NAME), new NotificationRegistrationStatusUpdateRequest(addWhitespace(NotificationRegistrationStatusEntity.DISABLED)));
    assertEquals(new NotificationRegistrationStatusUpdateResponse(notificationRegistrationKey, NotificationRegistrationStatusEntity.DISABLED), response);
}
Also used : NotificationRegistrationStatusUpdateRequest(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateRequest) NotificationRegistrationStatusUpdateResponse(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 2 with NotificationRegistrationStatusUpdateResponse

use of org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse in project herd by FINRAOS.

the class NotificationRegistrationStatusServiceTest method testUpdateNotificationRegistrationStatusAssertUpdateSuccessCaseInsensitive.

@Test
public void testUpdateNotificationRegistrationStatusAssertUpdateSuccessCaseInsensitive() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKey, 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);
    NotificationRegistrationStatusUpdateResponse response = notificationRegistrationStatusService.updateNotificationRegistrationStatus(NAMESPACE, NOTIFICATION_NAME, new NotificationRegistrationStatusUpdateRequest(NotificationRegistrationStatusEntity.DISABLED.toLowerCase()));
    assertEquals(new NotificationRegistrationStatusUpdateResponse(notificationRegistrationKey, NotificationRegistrationStatusEntity.DISABLED), response);
}
Also used : NotificationRegistrationStatusUpdateRequest(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateRequest) NotificationRegistrationStatusUpdateResponse(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 3 with NotificationRegistrationStatusUpdateResponse

use of org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse in project herd by FINRAOS.

the class NotificationRegistrationStatusRestControllerTest method testUpdateNotificationRegistrationStatusAssertSuccess.

@Test
public void testUpdateNotificationRegistrationStatusAssertSuccess() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    NotificationRegistrationStatusUpdateRequest request = new NotificationRegistrationStatusUpdateRequest(NotificationRegistrationStatusEntity.DISABLED);
    NotificationRegistrationStatusUpdateResponse response = new NotificationRegistrationStatusUpdateResponse(notificationRegistrationKey, NotificationRegistrationStatusEntity.DISABLED);
    when(notificationRegistrationStatusService.updateNotificationRegistrationStatus(NAMESPACE, NOTIFICATION_NAME, request)).thenReturn(response);
    NotificationRegistrationStatusUpdateResponse resultResponse = notificationRegistrationStatusRestController.updateNotificationRegistrationStatus(NAMESPACE, NOTIFICATION_NAME, request);
    // Verify the external calls.
    verify(notificationRegistrationStatusService).updateNotificationRegistrationStatus(NAMESPACE, NOTIFICATION_NAME, request);
    verifyNoMoreInteractions(notificationRegistrationStatusService);
    // Validate the returned object.
    assertEquals(response, resultResponse);
}
Also used : NotificationRegistrationStatusUpdateRequest(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateRequest) NotificationRegistrationStatusUpdateResponse(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 4 with NotificationRegistrationStatusUpdateResponse

use of org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse in project herd by FINRAOS.

the class NotificationRegistrationStatusServiceTest method testUpdateNotificationRegistrationStatusAssertUpdateSuccess.

@Test
public void testUpdateNotificationRegistrationStatusAssertUpdateSuccess() {
    NotificationRegistrationKey notificationRegistrationKey = new NotificationRegistrationKey(NAMESPACE, NOTIFICATION_NAME);
    notificationRegistrationDaoTestHelper.createBusinessObjectDataNotificationRegistrationEntity(notificationRegistrationKey, 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);
    NotificationRegistrationStatusUpdateResponse response = notificationRegistrationStatusService.updateNotificationRegistrationStatus(NAMESPACE, NOTIFICATION_NAME, new NotificationRegistrationStatusUpdateRequest(NotificationRegistrationStatusEntity.DISABLED));
    assertEquals(new NotificationRegistrationStatusUpdateResponse(notificationRegistrationKey, NotificationRegistrationStatusEntity.DISABLED), response);
}
Also used : NotificationRegistrationStatusUpdateRequest(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateRequest) NotificationRegistrationStatusUpdateResponse(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) Test(org.junit.Test)

Example 5 with NotificationRegistrationStatusUpdateResponse

use of org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse in project herd by FINRAOS.

the class NotificationRegistrationStatusServiceImpl method updateNotificationRegistrationStatus.

@NamespacePermission(fields = "#namespace", permissions = NamespacePermissionEnum.WRITE)
@Override
public NotificationRegistrationStatusUpdateResponse updateNotificationRegistrationStatus(String namespace, String notificationName, NotificationRegistrationStatusUpdateRequest notificationRegistrationStatusUpdateRequest) {
    Assert.hasText(namespace, "The namespace must be specified");
    Assert.hasText(notificationName, "The notification name must be specified");
    String notificationRegistrationStatus = notificationRegistrationStatusUpdateRequest.getNotificationRegistrationStatus();
    Assert.hasText(notificationRegistrationStatus, "The notification registration status must be specified");
    NotificationRegistrationEntity notificationRegistration = notificationRegistrationDaoHelper.getNotificationRegistration(namespace.trim(), notificationName.trim());
    NotificationRegistrationStatusEntity notificationRegistrationStatusEntity = notificationRegistrationStatusDaoHelper.getNotificationRegistrationStatusEntity(notificationRegistrationStatus.trim());
    notificationRegistration.setNotificationRegistrationStatus(notificationRegistrationStatusEntity);
    NotificationRegistrationStatusUpdateResponse notificationRegistrationStatusUpdateResponse = new NotificationRegistrationStatusUpdateResponse();
    notificationRegistrationStatusUpdateResponse.setNotificationRegistrationKey(new NotificationRegistrationKey(notificationRegistration.getNamespace().getCode(), notificationRegistration.getName()));
    notificationRegistrationStatusUpdateResponse.setNotificationRegistrationStatus(notificationRegistrationStatusEntity.getCode());
    return notificationRegistrationStatusUpdateResponse;
}
Also used : NotificationRegistrationStatusEntity(org.finra.herd.model.jpa.NotificationRegistrationStatusEntity) NotificationRegistrationStatusUpdateResponse(org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse) NotificationRegistrationEntity(org.finra.herd.model.jpa.NotificationRegistrationEntity) NotificationRegistrationKey(org.finra.herd.model.api.xml.NotificationRegistrationKey) NamespacePermission(org.finra.herd.model.annotation.NamespacePermission)

Aggregations

NotificationRegistrationKey (org.finra.herd.model.api.xml.NotificationRegistrationKey)5 NotificationRegistrationStatusUpdateResponse (org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateResponse)5 NotificationRegistrationStatusUpdateRequest (org.finra.herd.model.api.xml.NotificationRegistrationStatusUpdateRequest)4 Test (org.junit.Test)4 NamespacePermission (org.finra.herd.model.annotation.NamespacePermission)1 NotificationRegistrationEntity (org.finra.herd.model.jpa.NotificationRegistrationEntity)1 NotificationRegistrationStatusEntity (org.finra.herd.model.jpa.NotificationRegistrationStatusEntity)1