@Test public void migrations() throws IOException { MatcherAssert.assertThat( Collections.list( new IterableEnum<>( new MigrationFileAsset( RuntimeEnvironment.application.getAssets(), new File("files", "88.sql") ).migrations() ) ), Matchers.hasSize(2) ); }
public Iterable<Migration> migrations() throws IOException { final InputStream stream = assets.open(file.getPath()); try { return new MappedIterable<>( new SplitStatements( IOUtils.toString(stream) ), new MappedIterable.Map<String, Migration>() { @NonNull @Override public Migration apply(@NonNull final String statement) { return new Migration(statement); } } ); } finally { stream.close(); } }
MigrationFileAsset implements MigrationFile { public Iterable<Migration> migrations() throws IOException { final InputStream stream = assets.open(file.getPath()); try { return new MappedIterable<>( new SplitStatements( IOUtils.toString(stream) ), new MappedIterable.Map<String, Migration>() { @NonNull @Override public Migration apply(@NonNull final String statement) { return new Migration(statement); } } ); } finally { stream.close(); } } }
MigrationFileAsset implements MigrationFile { public Iterable<Migration> migrations() throws IOException { final InputStream stream = assets.open(file.getPath()); try { return new MappedIterable<>( new SplitStatements( IOUtils.toString(stream) ), new MappedIterable.Map<String, Migration>() { @NonNull @Override public Migration apply(@NonNull final String statement) { return new Migration(statement); } } ); } finally { stream.close(); } } MigrationFileAsset(@NonNull final AssetManager assets, @NonNull final File file); }
MigrationFileAsset implements MigrationFile { public Iterable<Migration> migrations() throws IOException { final InputStream stream = assets.open(file.getPath()); try { return new MappedIterable<>( new SplitStatements( IOUtils.toString(stream) ), new MappedIterable.Map<String, Migration>() { @NonNull @Override public Migration apply(@NonNull final String statement) { return new Migration(statement); } } ); } finally { stream.close(); } } MigrationFileAsset(@NonNull final AssetManager assets, @NonNull final File file); int version(); Iterable<Migration> migrations(); }
MigrationFileAsset implements MigrationFile { public Iterable<Migration> migrations() throws IOException { final InputStream stream = assets.open(file.getPath()); try { return new MappedIterable<>( new SplitStatements( IOUtils.toString(stream) ), new MappedIterable.Map<String, Migration>() { @NonNull @Override public Migration apply(@NonNull final String statement) { return new Migration(statement); } } ); } finally { stream.close(); } } MigrationFileAsset(@NonNull final AssetManager assets, @NonNull final File file); int version(); Iterable<Migration> migrations();  }