use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.
the class PropertyPreviousValueFilterTest method should_testFalse_when_eventWithCorrespondingPropertyWithNotAcceptedPreviousValueIsSent.
@Test
public void should_testFalse_when_eventWithCorrespondingPropertyWithNotAcceptedPreviousValueIsSent() {
final Map<String, Serializable> properties = new HashMap<>();
properties.put(TEST_PROPERTY, "other");
final NodeResource nodeResourceBefore = NodeResource.builder().setProperties(properties).build();
final NodeResource nodeResource = NodeResource.builder().build();
final EventData<NodeResource> eventData = EventData.<NodeResource>builder().setResourceBefore(nodeResourceBefore).setResource(nodeResource).build();
final RepoEvent<? extends DataAttributes<? extends Resource>> repoEvent = RepoEvent.<EventData<NodeResource>>builder().setData(eventData).build();
final boolean result = propertyPreviousValueFilter.test((RepoEvent<DataAttributes<Resource>>) repoEvent);
assertThat(result).isFalse();
}
use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.
the class PropertyPreviousValueFilterTest method should_testFalse_when_eventWithoutPropertiesIsSent.
@Test
public void should_testFalse_when_eventWithoutPropertiesIsSent() {
final NodeResource nodeResourceBefore = NodeResource.builder().build();
final NodeResource nodeResource = NodeResource.builder().build();
final EventData<NodeResource> eventData = EventData.<NodeResource>builder().setResourceBefore(nodeResourceBefore).setResource(nodeResource).build();
final RepoEvent<? extends DataAttributes<? extends Resource>> repoEvent = RepoEvent.<EventData<NodeResource>>builder().setData(eventData).build();
final boolean result = propertyPreviousValueFilter.test((RepoEvent<DataAttributes<Resource>>) repoEvent);
assertThat(result).isFalse();
}
use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.
the class PropertyRemovedFilterTest method should_testFalse_when_eventWithoutResourceBeforeIsSent.
@Test
public void should_testFalse_when_eventWithoutResourceBeforeIsSent() {
final NodeResource nodeResource = NodeResource.builder().build();
final EventData<NodeResource> eventData = EventData.<NodeResource>builder().setResource(nodeResource).build();
final RepoEvent<? extends DataAttributes<? extends Resource>> repoEvent = RepoEvent.<EventData<NodeResource>>builder().setData(eventData).build();
final boolean result = propertyRemovedFilter.test((RepoEvent<DataAttributes<Resource>>) repoEvent);
assertThat(result).isFalse();
}
use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.
the class PropertyRemovedFilterTest method should_testTrue_when_propertyRemovedEventIsSent.
@Test
public void should_testTrue_when_propertyRemovedEventIsSent() {
final NodeResource nodeResource = NodeResource.builder().setProperties(Collections.EMPTY_MAP).build();
final NodeResource nodeBeforeResource = NodeResource.builder().setProperties(Map.of(TEST_PROPERTY, TEST_VALUE)).build();
final EventData<NodeResource> eventData = EventData.<NodeResource>builder().setResource(nodeResource).setResourceBefore(nodeBeforeResource).build();
final RepoEvent<? extends DataAttributes<? extends Resource>> repoEvent = RepoEvent.<EventData<NodeResource>>builder().setData(eventData).build();
final boolean result = propertyRemovedFilter.test((RepoEvent<DataAttributes<Resource>>) repoEvent);
assertThat(result).isTrue();
}
use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.
the class IntegrationEventFilterTest method should_testFalse_when_eventNotFulfillingWrappedEventFilterIsSent.
@Test
public void should_testFalse_when_eventNotFulfillingWrappedEventFilterIsSent() {
final NodeResource nodeResource = NodeResource.builder().setAspectNames(Set.of("test:other")).build();
final EventData<NodeResource> eventData = EventData.<NodeResource>builder().setResource(nodeResource).build();
final RepoEvent<? extends DataAttributes<? extends Resource>> repoEvent = RepoEvent.<EventData<NodeResource>>builder().setData(eventData).build();
final boolean result = IntegrationEventFilter.of(NodeAspectFilter.of(TEST_ASPECT)).accept(new GenericMessage(repoEvent));
assertThat(result).isFalse();
}
Aggregations