test_class.declarator: collector
test_class.modifier: @Mock
  	private
test_class.original_string: @Mock
  	private OutputCollector collector;
test_class.type: OutputCollector
test_class.var_name: collector
test_class.declarator: tuple
test_class.modifier: @Mock
  	private
test_class.original_string: @Mock
  	private Tuple tuple;
test_class.type: Tuple
test_class.var_name: tuple
test_class.file: hendrix-storm/src/test/java/io/symcpe/hendrix/storm/bolts/TestEventToLMMSerializerBolt.java
test_class.identifier: TestEventToLMMSerializerBolt
test_case.body: @Test
  	public void testExecute() {
  		EventToLMMSerializerBolt bolt = new EventToLMMSerializerBolt();
  		Event event = new UnifiedFactory().buildEvent();
  
  		final AtomicReference<Values> outputTuple = new AtomicReference<Values>(null);
  		OutputCollector mockCollector = MockTupleHelpers.mockCollector(new Answer<Object>() {
  
  			@Override
  			public Object answer(InvocationOnMock invocation) throws Throwable {
  				Object newEvent = invocation.getArguments()[1];
  				outputTuple.set((Values) newEvent);
  				return new ArrayList<>();
  			}
  		});
  
  		Calendar instance = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
  		instance.setTimeInMillis(1478736000000L);
  		System.out.println("Input date:"+instance.getTime().getTime());
  		long ts = instance.getTimeInMillis();
  		String fakeTenant = UUID.randomUUID().toString().replace("-", "");
  
  		event.getHeaders().put(Constants.FIELD_TIMESTAMP, ts);
  		event.getHeaders().put(Constants.FIELD_RULE_GROUP, fakeTenant);
  		when(tuple.getValueByField(Constants.FIELD_EVENT)).thenReturn(event);
  
  		Map<String, String> conf = new HashMap<>();
  		bolt.prepare(conf, null, mockCollector);
  		bolt.execute(tuple);
  
  		verify(mockCollector, times(1)).ack(tuple);
  		Values values = outputTuple.get();
  
  		assertEquals(fakeTenant, values.get(0));
  		JsonObject json = new Gson().fromJson((String) values.get(1), JsonObject.class);
  
  		assertEquals("2016-11-10T00:00:00.000Z", json.get(EventToLMMSerializerBolt.TIMESTAMP).getAsString());
  		assertEquals(fakeTenant, json.get(EventToLMMSerializerBolt.TENANT_ID).getAsString());
  
  		mockCollector = MockTupleHelpers.mockCollector(new Answer<Object>() {
  
  			@Override
  			public Object answer(InvocationOnMock invocation) throws Throwable {
  				Object newEvent = invocation.getArguments()[1];
  				outputTuple.set((Values) newEvent);
  				return new ArrayList<>();
  			}
  		});
  
  		when(tuple.getString(0)).thenReturn((String) values.get(1));
  		InterceptionBolt interceptor = new InterceptionBolt();
  		interceptor.prepare(conf, null, mockCollector);
  		interceptor.execute(tuple);
  		verify(mockCollector, times(1)).ack(tuple);
  		json = new Gson().fromJson((String) outputTuple.get().get(0), JsonObject.class);
  		System.out.println(outputTuple.get().get(0));
  		assertEquals(ts, json.get("@timestamp").getAsLong());
  	}
test_case.class_method_signature: TestEventToLMMSerializerBolt.testExecute()
test_case.full_signature: @Test public void testExecute()
test_case.identifier: testExecute
test_case.invocations: buildEvent mockCollector getArguments set getInstance getTimeZone setTimeInMillis println getTime getTime getTimeInMillis replace toString randomUUID put getHeaders put getHeaders thenReturn when getValueByField prepare execute ack verify times get assertEquals get fromJson get assertEquals getAsString get assertEquals getAsString get mockCollector getArguments set thenReturn when getString get prepare execute ack verify times fromJson get get println get get assertEquals getAsLong get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExecute()
focal_class.declarator: serialVersionUID = 1L
focal_class.modifier: private static final
focal_class.original_string: private static final long serialVersionUID = 1L;
focal_class.type: long
focal_class.var_name: serialVersionUID
focal_class.declarator: TIMESTAMP = "@timestamp"
focal_class.modifier: public static final
focal_class.original_string: public static final String TIMESTAMP = "@timestamp";
focal_class.type: String
focal_class.var_name: TIMESTAMP
focal_class.declarator: TENANT_ID = "tenant_id"
focal_class.modifier: public static final
focal_class.original_string: public static final String TENANT_ID = "tenant_id";
focal_class.type: String
focal_class.var_name: TENANT_ID
focal_class.declarator: gson
focal_class.modifier: private transient
focal_class.original_string: private transient Gson gson;
focal_class.type: Gson
focal_class.var_name: gson
focal_class.declarator: formatter
focal_class.modifier: private transient
focal_class.original_string: private transient SimpleDateFormat formatter;
focal_class.type: SimpleDateFormat
focal_class.var_name: formatter
focal_class.declarator: collector
focal_class.modifier: private transient
focal_class.original_string: private transient OutputCollector collector;
focal_class.type: OutputCollector
focal_class.var_name: collector
focal_class.declarator: calendar
focal_class.modifier: private transient
focal_class.original_string: private transient Calendar calendar;
focal_class.type: Calendar
focal_class.var_name: calendar
focal_class.file: hendrix-storm/src/main/java/io/symcpe/hendrix/storm/bolts/EventToLMMSerializerBolt.java
focal_class.identifier: EventToLMMSerializerBolt
focal_class.class_method_signature: EventToLMMSerializerBolt.prepare(Map stormConf, TopologyContext context, OutputCollector collector)
focal_class.full_signature: @SuppressWarnings("rawtypes") @Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector)
focal_class.identifier: prepare
focal_class.modifiers: @SuppressWarnings("rawtypes") @Override public
focal_class.parameters: (Map stormConf, TopologyContext context, OutputCollector collector)
focal_class.return: void
focal_class.signature: void prepare(Map stormConf, TopologyContext context, OutputCollector collector)
focal_class.class_method_signature: EventToLMMSerializerBolt.execute(Tuple tuple)
focal_class.full_signature: @Override public void execute(Tuple tuple)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (Tuple tuple)
focal_class.return: void
focal_class.signature: void execute(Tuple tuple)
focal_class.class_method_signature: EventToLMMSerializerBolt.declareOutputFields(OutputFieldsDeclarer declarer)
focal_class.full_signature: @Override public void declareOutputFields(OutputFieldsDeclarer declarer)
focal_class.identifier: declareOutputFields
focal_class.modifiers: @Override public
focal_class.parameters: (OutputFieldsDeclarer declarer)
focal_class.return: void
focal_class.signature: void declareOutputFields(OutputFieldsDeclarer declarer)
focal_class.class_method_signature: EventToLMMSerializerBolt.getGson()
focal_class.full_signature: protected Gson getGson()
focal_class.identifier: getGson
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: Gson
focal_class.signature: Gson getGson()
focal_class.class_method_signature: EventToLMMSerializerBolt.getFormatter()
focal_class.full_signature: protected SimpleDateFormat getFormatter()
focal_class.identifier: getFormatter
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: SimpleDateFormat
focal_class.signature: SimpleDateFormat getFormatter()
focal_class.class_method_signature: EventToLMMSerializerBolt.getCollector()
focal_class.full_signature: protected OutputCollector getCollector()
focal_class.identifier: getCollector
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: OutputCollector
focal_class.signature: OutputCollector getCollector()
focal_class.superclass: extends BaseRichBolt
focal_method.body: @Override
  	public void execute(Tuple tuple) {
  		Event event = (Event) tuple.getValueByField(Constants.FIELD_EVENT);
  		Long ts = (Long) event.getHeaders().get(Constants.FIELD_TIMESTAMP);
  		calendar.setTimeInMillis(ts);
  		event.getHeaders().put(TIMESTAMP, formatter.format(calendar.getTime()));
  		event.getHeaders().put(TENANT_ID, event.getHeaders().get(Constants.FIELD_RULE_GROUP));
  		String eventJson = gson.toJson(event.getHeaders());
  		collector.emit(tuple, new Values(event.getHeaders().get(TENANT_ID), eventJson));
  		collector.ack(tuple);
  	}
focal_method.class_method_signature: EventToLMMSerializerBolt.execute(Tuple tuple)
focal_method.full_signature: @Override public void execute(Tuple tuple)
focal_method.identifier: execute
focal_method.invocations: getValueByField get getHeaders setTimeInMillis put getHeaders format getTime put getHeaders get getHeaders toJson getHeaders emit get getHeaders ack
focal_method.modifiers: @Override public
focal_method.parameters: (Tuple tuple)
focal_method.return: void
focal_method.signature: void execute(Tuple tuple)