Search in sources :

Example 46 with StreamlineEvent

use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.

the class StreamlineEventImplTest method testRemoveIterator.

@Test(expected = UnsupportedOperationException.class)
public void testRemoveIterator() throws Exception {
    Map<String, Object> map = new HashMap<>();
    map.put("foo", "bar");
    StreamlineEvent event = StreamlineEventImpl.builder().fieldsAndValues(map).build();
    Iterator<Map.Entry<String, Object>> it = event.entrySet().iterator();
    while (it.hasNext()) {
        it.next();
        it.remove();
    }
}
Also used : HashMap(java.util.HashMap) StreamlineEvent(com.hortonworks.streamline.streams.StreamlineEvent) Test(org.junit.Test)

Example 47 with StreamlineEvent

use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.

the class StreamlineEventImplTest method testGetFieldsAndValues.

@Test
public void testGetFieldsAndValues() throws Exception {
    Map<String, Object> map = new HashMap<>();
    map.put("a", "aval");
    map.put("b", "bval");
    StreamlineEvent event = StreamlineEventImpl.builder().fieldsAndValues(map).build();
    assertEquals(map, event);
}
Also used : HashMap(java.util.HashMap) StreamlineEvent(com.hortonworks.streamline.streams.StreamlineEvent) Test(org.junit.Test)

Example 48 with StreamlineEvent

use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.

the class StreamlineEventImplTest method testGetSourceStream.

@Test
public void testGetSourceStream() throws Exception {
    String sourceStream = "stream";
    StreamlineEvent event = StreamlineEventImpl.builder().fieldsAndValues(Collections.emptyMap()).dataSourceId("1").build();
    assertEquals(StreamlineEventImpl.DEFAULT_SOURCE_STREAM, event.getSourceStream());
    event = StreamlineEventImpl.builder().fieldsAndValues(Collections.emptyMap()).dataSourceId("1").sourceStream(sourceStream).build();
    assertEquals(sourceStream, event.getSourceStream());
}
Also used : StreamlineEvent(com.hortonworks.streamline.streams.StreamlineEvent) Test(org.junit.Test)

Example 49 with StreamlineEvent

use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.

the class StreamlineEventImplTest method testPutAll.

@Test(expected = UnsupportedOperationException.class)
public void testPutAll() throws Exception {
    Map<String, Object> map = new HashMap<>();
    map.put("foo", "bar");
    StreamlineEvent event = StreamlineEventImpl.builder().fieldsAndValues(Collections.emptyMap()).build();
    event.putAll(map);
}
Also used : HashMap(java.util.HashMap) StreamlineEvent(com.hortonworks.streamline.streams.StreamlineEvent) Test(org.junit.Test)

Example 50 with StreamlineEvent

use of com.hortonworks.streamline.streams.StreamlineEvent in project streamline by hortonworks.

the class StreamlineEventImplTest method testRemove.

@Test(expected = UnsupportedOperationException.class)
public void testRemove() throws Exception {
    Map<String, Object> map = new HashMap<>();
    map.put("foo", "bar");
    StreamlineEvent event = StreamlineEventImpl.builder().fieldsAndValues(Collections.emptyMap()).build();
    event.remove("foo");
}
Also used : HashMap(java.util.HashMap) StreamlineEvent(com.hortonworks.streamline.streams.StreamlineEvent) Test(org.junit.Test)

Aggregations

StreamlineEvent (com.hortonworks.streamline.streams.StreamlineEvent)97 Test (org.junit.Test)47 HashMap (java.util.HashMap)41 Values (org.apache.storm.tuple.Values)25 ArrayList (java.util.ArrayList)19 Tuple (org.apache.storm.tuple.Tuple)14 Result (com.hortonworks.streamline.streams.Result)13 Expectations (mockit.Expectations)9 TupleImpl (org.apache.storm.tuple.TupleImpl)9 Map (java.util.Map)8 Verifications (mockit.Verifications)8 TransformRuntime (com.hortonworks.streamline.streams.runtime.TransformRuntime)7 ProcessingException (com.hortonworks.streamline.streams.exception.ProcessingException)6 StormSqlExpression (com.hortonworks.streamline.streams.runtime.rule.condition.expression.StormSqlExpression)6 List (java.util.List)5 IdPreservedStreamlineEvent (com.hortonworks.streamline.streams.common.IdPreservedStreamlineEvent)4 StreamlineEventImpl (com.hortonworks.streamline.streams.common.StreamlineEventImpl)4 Fields (org.apache.storm.tuple.Fields)4 EventCorrelationInjector (com.hortonworks.streamline.streams.common.event.correlation.EventCorrelationInjector)3 MergeTransform (com.hortonworks.streamline.streams.layout.component.rule.action.transform.MergeTransform)3