use of org.apache.metron.common.configuration.profiler.ProfilerConfig in project metron by apache.
the class ProfileSplitterBoltTest method testResolveEntityName.
/**
* The entity associated with a profile is defined with a Stellar expression. That expression
* can refer to any field within the message.
*
* In this case the entity is defined as 'ip_src_addr' which is resolved to '10.0.0.1' based on
* the data contained within the message.
*/
@Test
public void testResolveEntityName() throws Exception {
ProfilerConfig config = toProfilerConfig(profileWithOnlyIfTrue);
ProfileSplitterBolt bolt = createBolt(config);
bolt.execute(tuple);
// expected values
String expectedEntity = "10.0.0.1";
ProfileConfig expectedConfig = config.getProfiles().get(0);
Values expected = new Values(message, timestamp, expectedEntity, expectedConfig);
// a tuple should be emitted for the downstream profile builder
verify(outputCollector, times(1)).emit(eq(tuple), eq(expected));
// the original tuple should be ack'd
verify(outputCollector, times(1)).ack(eq(tuple));
}
use of org.apache.metron.common.configuration.profiler.ProfilerConfig in project metron by apache.
the class ProfileSplitterBoltTest method testOnlyIfFalse.
/**
* What happens when a profile's 'onlyif' expression is false? The message
* should NOT be applied to the profile.
*/
@Test
public void testOnlyIfFalse() throws Exception {
ProfilerConfig config = toProfilerConfig(profileWithOnlyIfFalse);
ProfileSplitterBolt bolt = createBolt(config);
bolt.execute(tuple);
// a tuple should NOT be emitted for the downstream profile builder
verify(outputCollector, times(0)).emit(any());
// the original tuple should be ack'd
verify(outputCollector, times(1)).ack(eq(tuple));
}
use of org.apache.metron.common.configuration.profiler.ProfilerConfig in project metron by apache.
the class DefaultClockFactoryTest method testCreateProcessingTimeClock.
/**
* When a 'timestampField' is defined the factory should return a clock
* that deals with processing time.
*/
@Test
public void testCreateProcessingTimeClock() {
// the profiler uses processing time by default
ProfilerConfig config = new ProfilerConfig();
// the factory should return a clock that handles 'processing time'
Clock clock = clockFactory.createClock(config);
assertTrue(clock instanceof WallClock);
}
Aggregations