@Test public void testMultipleSClassesFail() throws Exception { command.classNames = Lists.newArrayList( "org.kitesdk.cli.example.User", "org.kitesdk.data.Format"); 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 public int run() throws IOException { Preconditions.checkArgument(classNames != null && !classNames.isEmpty(), "Java class name is required"); Preconditions.checkArgument(classNames.size() == 1, "Only one java class name can be given"); ClassLoader loader = loaderFor(jars, libs); String className = classNames.get(0); Class<?> recordClass; try { recordClass = loader.loadClass(className); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find class: " + className, e); } DatasetDescriptor descriptor = new DatasetDescriptor.Builder() .schema(recordClass) .build(); String schema = descriptor.getSchema().toString(!minimize); output(schema, console, outputPath); return 0; }
ObjectSchemaCommand extends BaseCommand { @Override public int run() throws IOException { Preconditions.checkArgument(classNames != null && !classNames.isEmpty(), "Java class name is required"); Preconditions.checkArgument(classNames.size() == 1, "Only one java class name can be given"); ClassLoader loader = loaderFor(jars, libs); String className = classNames.get(0); Class<?> recordClass; try { recordClass = loader.loadClass(className); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find class: " + className, e); } DatasetDescriptor descriptor = new DatasetDescriptor.Builder() .schema(recordClass) .build(); String schema = descriptor.getSchema().toString(!minimize); output(schema, console, outputPath); return 0; } }
ObjectSchemaCommand extends BaseCommand { @Override public int run() throws IOException { Preconditions.checkArgument(classNames != null && !classNames.isEmpty(), "Java class name is required"); Preconditions.checkArgument(classNames.size() == 1, "Only one java class name can be given"); ClassLoader loader = loaderFor(jars, libs); String className = classNames.get(0); Class<?> recordClass; try { recordClass = loader.loadClass(className); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find class: " + className, e); } DatasetDescriptor descriptor = new DatasetDescriptor.Builder() .schema(recordClass) .build(); String schema = descriptor.getSchema().toString(!minimize); output(schema, console, outputPath); return 0; } ObjectSchemaCommand(Logger console); }
ObjectSchemaCommand extends BaseCommand { @Override public int run() throws IOException { Preconditions.checkArgument(classNames != null && !classNames.isEmpty(), "Java class name is required"); Preconditions.checkArgument(classNames.size() == 1, "Only one java class name can be given"); ClassLoader loader = loaderFor(jars, libs); String className = classNames.get(0); Class<?> recordClass; try { recordClass = loader.loadClass(className); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find class: " + className, e); } DatasetDescriptor descriptor = new DatasetDescriptor.Builder() .schema(recordClass) .build(); String schema = descriptor.getSchema().toString(!minimize); output(schema, console, outputPath); return 0; } ObjectSchemaCommand(Logger console); @Override int run(); @Override List<String> getExamples(); }
ObjectSchemaCommand extends BaseCommand { @Override public int run() throws IOException { Preconditions.checkArgument(classNames != null && !classNames.isEmpty(), "Java class name is required"); Preconditions.checkArgument(classNames.size() == 1, "Only one java class name can be given"); ClassLoader loader = loaderFor(jars, libs); String className = classNames.get(0); Class<?> recordClass; try { recordClass = loader.loadClass(className); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Cannot find class: " + className, e); } DatasetDescriptor descriptor = new DatasetDescriptor.Builder() .schema(recordClass) .build(); String schema = descriptor.getSchema().toString(!minimize); output(schema, console, outputPath); return 0; } ObjectSchemaCommand(Logger console); @Override int run(); @Override List<String> getExamples();  }