AccumuloEventStorageBolt extends AccumuloBaseBolt { ColumnVisibility getColumnVisibility(LogRecord record) { if (StringUtils.isNotBlank(visibility)) { return new ColumnVisibility(visibility); } else if (StringUtils.isNotBlank(visibilityByField)) { return new ColumnVisibility(record.getValue(visibilityByField)); } else { return new ColumnVisibility(); } }  @Override void cleanup(); static final String EVENT_TABLE; static final String UUID_PREFIX; static final String UUID_PREFIX_DEFAULT; static final String VISIBILITY; static final String VISIBILITY_BY_FIELD; static final String SPLITS; static final int SPLITS_DEFAULT; }
@Test public void testGetColumnVisibility( @Injectable LogRecord record, @Mocked ColumnVisibility vis) { bolt.visibility = "visibility"; new Expectations() {{ new ColumnVisibility(bolt.visibility); result = vis; }}; assertThat(bolt.getColumnVisibility(record), is(vis)); }
@Test public void testGetColumnVisibilityByField( @Injectable LogRecord record, @Mocked ColumnVisibility vis, @Injectable String visibility) { bolt.visibility = null; bolt.visibilityByField = "visibility-field"; new Expectations() {{ record.getValue(bolt.visibilityByField); result = visibility; new ColumnVisibility(visibility); result = vis; }}; assertThat(bolt.getColumnVisibility(record), is(vis)); }
@Test public void testGetColumnVisibilityBlank( @Injectable LogRecord record, @Mocked ColumnVisibility vis) { bolt.visibility = null; bolt.visibilityByField = null; new Expectations() {{ new ColumnVisibility(); result = vis; }}; assertThat(bolt.getColumnVisibility(record), is(vis)); }