TimelineSchemaCreator extends Configured implements Tool { @VisibleForTesting int createTimelineSchema(String[] args, Configuration conf) throws Exception { String schemaCreatorClassName = conf.get( YarnConfiguration.TIMELINE_SERVICE_SCHEMA_CREATOR_CLASS, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_SCHEMA_CREATOR_CLASS); LOG.info("Using {} for creating Timeline Service Schema ", schemaCreatorClassName); try { Class<?> schemaCreatorClass = Class.forName(schemaCreatorClassName); if (SchemaCreator.class.isAssignableFrom(schemaCreatorClass)) { SchemaCreator schemaCreator = (SchemaCreator) ReflectionUtils .newInstance(schemaCreatorClass, conf); schemaCreator.createTimelineSchema(args); return 0; } else { throw new YarnRuntimeException("Class: " + schemaCreatorClassName + " not instance of " + SchemaCreator.class.getCanonicalName()); } } catch (ClassNotFoundException e) { throw new YarnRuntimeException("Could not instantiate TimelineReader: " + schemaCreatorClassName, e); } }  static void main(String[] args); @Override int run(String[] args);  }
@Test public void testTimelineSchemaCreation() throws Exception { Configuration conf = new Configuration(); conf.set(YarnConfiguration.TIMELINE_SERVICE_SCHEMA_CREATOR_CLASS, "org.apache.hadoop.yarn.server.timelineservice.storage" + ".DummyTimelineSchemaCreator"); TimelineSchemaCreator timelineSchemaCreator = new TimelineSchemaCreator(); Assert.assertEquals(0, timelineSchemaCreator .createTimelineSchema(new String[]{}, conf)); }