@Test public void testSchemaStdout() throws Exception { command.datasets = Lists.newArrayList("users"); int rc = command.run(); Assert.assertEquals("Should return success code", 0, rc); verify(console).info(argThat(TestUtil.matchesSchema(schema))); verify(console).trace(contains("repo:hive")); verifyNoMoreInteractions(console); }
@Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value={"NP_GUARANTEED_DEREF", "NP_NULL_ON_SOME_PATH"}, justification="Null case checked by precondition") public int run() throws IOException { Preconditions.checkArgument( datasets != null && !datasets.isEmpty(), "Missing dataset name"); if (merge || datasets.size() == 1) { Schema mergedSchema = null; for (String uriOrPath : datasets) { mergedSchema = merge(mergedSchema, schema(uriOrPath)); } Preconditions.checkNotNull(mergedSchema, "No valid schema found"); output(mergedSchema.toString(!minimize), console, outputPath); } else { Preconditions.checkArgument(outputPath == null, "Cannot output multiple schemas to one file"); for (String name : datasets) { console.info("Dataset \"{}\" schema: {}", name, schema(name).toString(!minimize)); } } return 0; }
SchemaCommand extends BaseDatasetCommand { @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value={"NP_GUARANTEED_DEREF", "NP_NULL_ON_SOME_PATH"}, justification="Null case checked by precondition") public int run() throws IOException { Preconditions.checkArgument( datasets != null && !datasets.isEmpty(), "Missing dataset name"); if (merge || datasets.size() == 1) { Schema mergedSchema = null; for (String uriOrPath : datasets) { mergedSchema = merge(mergedSchema, schema(uriOrPath)); } Preconditions.checkNotNull(mergedSchema, "No valid schema found"); output(mergedSchema.toString(!minimize), console, outputPath); } else { Preconditions.checkArgument(outputPath == null, "Cannot output multiple schemas to one file"); for (String name : datasets) { console.info("Dataset \"{}\" schema: {}", name, schema(name).toString(!minimize)); } } return 0; } }
SchemaCommand extends BaseDatasetCommand { @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value={"NP_GUARANTEED_DEREF", "NP_NULL_ON_SOME_PATH"}, justification="Null case checked by precondition") public int run() throws IOException { Preconditions.checkArgument( datasets != null && !datasets.isEmpty(), "Missing dataset name"); if (merge || datasets.size() == 1) { Schema mergedSchema = null; for (String uriOrPath : datasets) { mergedSchema = merge(mergedSchema, schema(uriOrPath)); } Preconditions.checkNotNull(mergedSchema, "No valid schema found"); output(mergedSchema.toString(!minimize), console, outputPath); } else { Preconditions.checkArgument(outputPath == null, "Cannot output multiple schemas to one file"); for (String name : datasets) { console.info("Dataset \"{}\" schema: {}", name, schema(name).toString(!minimize)); } } return 0; } SchemaCommand(Logger console); }
SchemaCommand extends BaseDatasetCommand { @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value={"NP_GUARANTEED_DEREF", "NP_NULL_ON_SOME_PATH"}, justification="Null case checked by precondition") public int run() throws IOException { Preconditions.checkArgument( datasets != null && !datasets.isEmpty(), "Missing dataset name"); if (merge || datasets.size() == 1) { Schema mergedSchema = null; for (String uriOrPath : datasets) { mergedSchema = merge(mergedSchema, schema(uriOrPath)); } Preconditions.checkNotNull(mergedSchema, "No valid schema found"); output(mergedSchema.toString(!minimize), console, outputPath); } else { Preconditions.checkArgument(outputPath == null, "Cannot output multiple schemas to one file"); for (String name : datasets) { console.info("Dataset \"{}\" schema: {}", name, schema(name).toString(!minimize)); } } return 0; } SchemaCommand(Logger console); @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value={"NP_GUARANTEED_DEREF", "NP_NULL_ON_SOME_PATH"}, justification="Null case checked by precondition") int run(); @Override List<String> getExamples(); }
SchemaCommand extends BaseDatasetCommand { @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value={"NP_GUARANTEED_DEREF", "NP_NULL_ON_SOME_PATH"}, justification="Null case checked by precondition") public int run() throws IOException { Preconditions.checkArgument( datasets != null && !datasets.isEmpty(), "Missing dataset name"); if (merge || datasets.size() == 1) { Schema mergedSchema = null; for (String uriOrPath : datasets) { mergedSchema = merge(mergedSchema, schema(uriOrPath)); } Preconditions.checkNotNull(mergedSchema, "No valid schema found"); output(mergedSchema.toString(!minimize), console, outputPath); } else { Preconditions.checkArgument(outputPath == null, "Cannot output multiple schemas to one file"); for (String name : datasets) { console.info("Dataset \"{}\" schema: {}", name, schema(name).toString(!minimize)); } } return 0; } SchemaCommand(Logger console); @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings( value={"NP_GUARANTEED_DEREF", "NP_NULL_ON_SOME_PATH"}, justification="Null case checked by precondition") int run(); @Override List<String> getExamples();  }