@Test public void testMissingDataset() throws Exception { command.datasets = Lists.newArrayList("notadataset"); TestHelpers.assertThrows("Should complain about missing dataset", DatasetNotFoundException.class, new Callable() { @Override public Object call() throws Exception { command.run(); return null; } } ); verify(console).trace(contains("repo:file:target/data")); verifyNoMoreInteractions(console); }
@Override @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="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"); Preconditions.checkArgument(datasets.size() == 1, "Only one dataset name can be given"); View<Object> dataset = load(datasets.get(0), Object.class); DatasetReader<Object> reader = null; boolean threw = true; try { reader = dataset.newReader(); int i = 0; for (Object record : reader) { if (i >= numRecords) { break; } console.info(record.toString()); i += 1; } threw = false; } finally { Closeables.close(reader, threw); } return 0; }
ShowRecordsCommand extends BaseDatasetCommand { @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="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"); Preconditions.checkArgument(datasets.size() == 1, "Only one dataset name can be given"); View<Object> dataset = load(datasets.get(0), Object.class); DatasetReader<Object> reader = null; boolean threw = true; try { reader = dataset.newReader(); int i = 0; for (Object record : reader) { if (i >= numRecords) { break; } console.info(record.toString()); i += 1; } threw = false; } finally { Closeables.close(reader, threw); } return 0; } }
ShowRecordsCommand extends BaseDatasetCommand { @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="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"); Preconditions.checkArgument(datasets.size() == 1, "Only one dataset name can be given"); View<Object> dataset = load(datasets.get(0), Object.class); DatasetReader<Object> reader = null; boolean threw = true; try { reader = dataset.newReader(); int i = 0; for (Object record : reader) { if (i >= numRecords) { break; } console.info(record.toString()); i += 1; } threw = false; } finally { Closeables.close(reader, threw); } return 0; } ShowRecordsCommand(Logger console); }
ShowRecordsCommand extends BaseDatasetCommand { @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="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"); Preconditions.checkArgument(datasets.size() == 1, "Only one dataset name can be given"); View<Object> dataset = load(datasets.get(0), Object.class); DatasetReader<Object> reader = null; boolean threw = true; try { reader = dataset.newReader(); int i = 0; for (Object record : reader) { if (i >= numRecords) { break; } console.info(record.toString()); i += 1; } threw = false; } finally { Closeables.close(reader, threw); } return 0; } ShowRecordsCommand(Logger console); @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_ON_SOME_PATH", justification="Null case checked by precondition") int run(); @Override List<String> getExamples(); }
ShowRecordsCommand extends BaseDatasetCommand { @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="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"); Preconditions.checkArgument(datasets.size() == 1, "Only one dataset name can be given"); View<Object> dataset = load(datasets.get(0), Object.class); DatasetReader<Object> reader = null; boolean threw = true; try { reader = dataset.newReader(); int i = 0; for (Object record : reader) { if (i >= numRecords) { break; } console.info(record.toString()); i += 1; } threw = false; } finally { Closeables.close(reader, threw); } return 0; } ShowRecordsCommand(Logger console); @Override @edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_ON_SOME_PATH", justification="Null case checked by precondition") int run(); @Override List<String> getExamples();  }