use of co.cask.cdap.internal.app.runtime.artifact.ArtifactDescriptor in project cdap by caskdata.
the class AppFabricTestHelper method deployApplicationWithManager.
public static ApplicationWithPrograms deployApplicationWithManager(Id.Namespace namespace, Class<?> appClass, Supplier<File> folderSupplier, Config config) throws Exception {
ensureNamespaceExists(namespace.toEntityId());
Location deployedJar = createAppJar(appClass, folderSupplier);
ArtifactVersion artifactVersion = new ArtifactVersion(String.format("1.0.%d", System.currentTimeMillis()));
ArtifactId artifactId = new ArtifactId(appClass.getSimpleName(), artifactVersion, ArtifactScope.USER);
ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(artifactId, deployedJar);
ArtifactRepository artifactRepository = getInjector().getInstance(ArtifactRepository.class);
artifactRepository.addArtifact(Artifacts.toArtifactId(namespace.toEntityId(), artifactId).toId(), new File(deployedJar.toURI()));
AppDeploymentInfo info = new AppDeploymentInfo(artifactDescriptor, namespace.toEntityId(), appClass.getName(), null, null, config == null ? null : new Gson().toJson(config));
return getLocalManager().deploy(info).get();
}
Aggregations