@Test public void testMultipleSchemasToFileFails() throws Exception { command.datasets = Lists.newArrayList("users", "users_2"); command.outputPath = "target/user_schemas.avsc"; TestHelpers.assertThrows("Should reject saving multiple schemas in a file", IllegalArgumentException.class, new Callable<Void>() { @Override public Void call() throws Exception { command.run(); return null; } }); 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();  }