Search in sources :

Example 1 with EventData

use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.

the class PropertyCurrentValueFilterTest method should_testFalse_when_eventWithoutPropertiesIsSent.

@Test
public void should_testFalse_when_eventWithoutPropertiesIsSent() {
    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 = propertyCurrentValueFilter.test((RepoEvent<DataAttributes<Resource>>) repoEvent);
    assertThat(result).isFalse();
}
Also used : NodeResource(org.alfresco.event.sdk.model.v1.model.NodeResource) DataAttributes(org.alfresco.event.sdk.model.v1.model.DataAttributes) EventData(org.alfresco.event.sdk.model.v1.model.EventData) Test(org.junit.Test)

Example 2 with EventData

use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.

the class PropertyCurrentValueFilterTest method should_testFalse_when_eventWithCorrespondingPropertyWithNotAcceptedValueIsSent.

@Test
public void should_testFalse_when_eventWithCorrespondingPropertyWithNotAcceptedValueIsSent() {
    final Map<String, Serializable> properties = new HashMap<>();
    properties.put(TEST_PROPERTY, "other");
    final NodeResource nodeResource = NodeResource.builder().setProperties(properties).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 = propertyCurrentValueFilter.test((RepoEvent<DataAttributes<Resource>>) repoEvent);
    assertThat(result).isFalse();
}
Also used : NodeResource(org.alfresco.event.sdk.model.v1.model.NodeResource) Serializable(java.io.Serializable) DataAttributes(org.alfresco.event.sdk.model.v1.model.DataAttributes) HashMap(java.util.HashMap) EventData(org.alfresco.event.sdk.model.v1.model.EventData) Test(org.junit.Test)

Example 3 with EventData

use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.

the class PropertyCurrentValueFilterTest method should_testTrue_when_eventWithCorrespondingPropertyAndValueIsSent.

@Test
public void should_testTrue_when_eventWithCorrespondingPropertyAndValueIsSent() {
    final Map<String, Serializable> properties = new HashMap<>();
    properties.put(TEST_PROPERTY, TEST_VALUE);
    final NodeResource nodeResource = NodeResource.builder().setProperties(properties).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 = propertyCurrentValueFilter.test((RepoEvent<DataAttributes<Resource>>) repoEvent);
    assertThat(result).isTrue();
}
Also used : NodeResource(org.alfresco.event.sdk.model.v1.model.NodeResource) Serializable(java.io.Serializable) DataAttributes(org.alfresco.event.sdk.model.v1.model.DataAttributes) HashMap(java.util.HashMap) EventData(org.alfresco.event.sdk.model.v1.model.EventData) Test(org.junit.Test)

Example 4 with EventData

use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.

the class PropertyCurrentValueFilterTest method should_testFalse_when_eventWithoutCorrespondingPropertyIsSent.

@Test
public void should_testFalse_when_eventWithoutCorrespondingPropertyIsSent() {
    final Map<String, Serializable> properties = new HashMap<>();
    properties.put("test:other", TEST_VALUE);
    final NodeResource nodeResource = NodeResource.builder().setProperties(properties).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 = propertyCurrentValueFilter.test((RepoEvent<DataAttributes<Resource>>) repoEvent);
    assertThat(result).isFalse();
}
Also used : NodeResource(org.alfresco.event.sdk.model.v1.model.NodeResource) Serializable(java.io.Serializable) DataAttributes(org.alfresco.event.sdk.model.v1.model.DataAttributes) HashMap(java.util.HashMap) EventData(org.alfresco.event.sdk.model.v1.model.EventData) Test(org.junit.Test)

Example 5 with EventData

use of com.ibm.watson.discovery.v1.model.EventData in project alfresco-java-sdk by Alfresco.

the class PropertyPreviousValueFilterTest method should_testTrue_when_eventWithCorrespondingPropertyAndPreviousValueIsSent.

@Test
public void should_testTrue_when_eventWithCorrespondingPropertyAndPreviousValueIsSent() {
    final Map<String, Serializable> properties = new HashMap<>();
    properties.put(TEST_PROPERTY, TEST_VALUE);
    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).isTrue();
}
Also used : NodeResource(org.alfresco.event.sdk.model.v1.model.NodeResource) Serializable(java.io.Serializable) DataAttributes(org.alfresco.event.sdk.model.v1.model.DataAttributes) HashMap(java.util.HashMap) EventData(org.alfresco.event.sdk.model.v1.model.EventData) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)79 EventData (org.alfresco.event.sdk.model.v1.model.EventData)54 DataAttributes (org.alfresco.event.sdk.model.v1.model.DataAttributes)52 NodeResource (org.alfresco.event.sdk.model.v1.model.NodeResource)51 EventData (org.alfresco.repo.event.v1.model.EventData)25 NodeRef (org.alfresco.service.cmr.repository.NodeRef)25 RepoEvent (org.alfresco.repo.event.v1.model.RepoEvent)12 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)12 ChildAssociationResource (org.alfresco.repo.event.v1.model.ChildAssociationResource)11 NodeResource (org.alfresco.repo.event.v1.model.NodeResource)8 Serializable (java.io.Serializable)6 HashMap (java.util.HashMap)6 AssociationRef (org.alfresco.service.cmr.repository.AssociationRef)5 PeerAssociationResource (org.alfresco.repo.event.v1.model.PeerAssociationResource)4 ContentInfo (org.alfresco.event.sdk.model.v1.model.ContentInfo)3 PeerAssociationResource (org.alfresco.event.sdk.model.v1.model.PeerAssociationResource)3 CreateEventOptions (com.ibm.watson.discovery.v1.model.CreateEventOptions)2 CreateEventResponse (com.ibm.watson.discovery.v1.model.CreateEventResponse)2 EventData (com.ibm.watson.discovery.v1.model.EventData)2 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)2