use of org.apache.twill.filesystem.LocalLocationFactory in project cdap by caskdata.
the class CLIMainTest method createAppJarFile.
private static File createAppJarFile(Class<?> cls) throws IOException {
File tmpFolder = TMP_FOLDER.newFolder();
LocationFactory locationFactory = new LocalLocationFactory(tmpFolder);
Location deploymentJar = AppJarHelper.createDeploymentJar(locationFactory, cls);
File appJarFile = new File(tmpFolder, String.format("%s-1.0.%d.jar", cls.getSimpleName(), System.currentTimeMillis()));
Files.copy(Locations.newInputSupplier(deploymentJar), appJarFile);
return appJarFile;
}
use of org.apache.twill.filesystem.LocalLocationFactory in project cdap by caskdata.
the class ServiceClientTestRun method addArtifact.
/**
* Add AppReturnsArgs artifact
*/
private void addArtifact() throws Exception {
LocalLocationFactory locationFactory = new LocalLocationFactory(TMP_FOLDER.newFolder());
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(ManifestFields.BUNDLE_VERSION, "1.0.0");
final Location appJarLoc = AppJarHelper.createDeploymentJar(locationFactory, AppReturnsArgs.class, manifest);
InputSupplier<InputStream> inputSupplier = new InputSupplier<InputStream>() {
@Override
public InputStream getInput() throws IOException {
return appJarLoc.getInputStream();
}
};
artifactClient.add(NamespaceId.DEFAULT, artifactId.getArtifact(), inputSupplier, artifactId.getVersion());
appJarLoc.delete();
}
use of org.apache.twill.filesystem.LocalLocationFactory in project cdap by caskdata.
the class DatasetServiceAuthorizationTest method setup.
@BeforeClass
public static void setup() throws Exception {
locationFactory = new LocalLocationFactory(TMP_FOLDER.newFolder());
initializeAndStartService(createCConf());
authorizer = injector.getInstance(AuthorizerInstantiator.class).get();
}
use of org.apache.twill.filesystem.LocalLocationFactory in project cdap by caskdata.
the class EntityExistenceTest method setup.
@BeforeClass
public static void setup() throws Exception {
CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.INSTANCE_NAME, EXISTS);
Injector injector = AppFabricTestHelper.getInjector(cConf);
NamespaceStore nsStore = injector.getInstance(NamespaceStore.class);
ArtifactRepository artifactRepository = injector.getInstance(ArtifactRepository.class);
cConf = injector.getInstance(CConfiguration.class);
nsStore.create(new NamespaceMeta.Builder().setName(EXISTS).build());
existenceVerifier = injector.getInstance(EntityExistenceVerifier.class);
LocalLocationFactory lf = new LocalLocationFactory(TEMPORARY_FOLDER.newFolder());
File artifactFile = new File(AppJarHelper.createDeploymentJar(lf, AllProgramsApp.class).toURI());
artifactRepository.addArtifact(ARTIFACT.toId(), artifactFile);
AppFabricTestHelper.deployApplication(NAMESPACE.toId(), AllProgramsApp.class, null, cConf);
StreamAdmin streamAdmin = injector.getInstance(StreamAdmin.class);
streamAdmin.createOrUpdateView(VIEW, new ViewSpecification(new FormatSpecification("csv", null)));
}
use of org.apache.twill.filesystem.LocalLocationFactory in project cdap by caskdata.
the class SystemArtifactsAuthorizationTest method createAppJar.
private static File createAppJar(Class<?> cls, File destFile, Manifest manifest) throws IOException {
Location deploymentJar = AppJarHelper.createDeploymentJar(new LocalLocationFactory(TMP_FOLDER.newFolder()), cls, manifest);
DirUtils.mkdirs(destFile.getParentFile());
Files.copy(Locations.newInputSupplier(deploymentJar), destFile);
return destFile;
}
Aggregations