final Supplier<File> folderSupplier)
throws Exception {
Location deployedJar = createAppJar(appClass);
try {
ApplicationWithPrograms appWithPrograms = getLocalManager().deploy(DefaultId.ACCOUNT, null, deployedJar).get();
// Transform program to get loadable, as the one created in deploy pipeline is not loadable.
List<Program> programs = ImmutableList.copyOf(Iterables.transform(appWithPrograms.getPrograms(),
new Function<Program, Program>() {
@Override
public Program apply(Program program) {
try {
return Programs.createWithUnpack(program.getJarLocation(), folderSupplier.get());
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
}
));
return new ApplicationWithPrograms(appWithPrograms.getAppSpecLoc(), programs);
} finally {
deployedJar.delete(true);
}
}