Search in sources :

Example 1 with RemoteArtifactManager

use of co.cask.cdap.test.remote.RemoteArtifactManager in project cdap by caskdata.

the class IntegrationTestManager method addPluginArtifact.

@Override
public ArtifactManager addPluginArtifact(ArtifactId artifactId, ArtifactId parent, Class<?> pluginClass, Class<?>... pluginClasses) throws Exception {
    Set<ArtifactRange> parents = new HashSet<>();
    parents.add(new ArtifactRange(parent.getParent().getNamespace(), parent.getArtifact(), new ArtifactVersion(parent.getVersion()), true, new ArtifactVersion(parent.getVersion()), true));
    addPluginArtifact(artifactId, parents, pluginClass, pluginClasses);
    return new RemoteArtifactManager(clientConfig, restClient, artifactId);
}
Also used : ArtifactVersion(co.cask.cdap.api.artifact.ArtifactVersion) RemoteArtifactManager(co.cask.cdap.test.remote.RemoteArtifactManager) ArtifactRange(co.cask.cdap.api.artifact.ArtifactRange) HashSet(java.util.HashSet)

Example 2 with RemoteArtifactManager

use of co.cask.cdap.test.remote.RemoteArtifactManager in project cdap by caskdata.

the class IntegrationTestManager method addAppArtifact.

@Override
public ArtifactManager addAppArtifact(ArtifactId artifactId, Class<?> appClass, String... exportPackages) throws Exception {
    Manifest manifest = new Manifest();
    manifest.getMainAttributes().put(ManifestFields.EXPORT_PACKAGE, Joiner.on(',').join(exportPackages));
    addAppArtifact(artifactId, appClass, manifest);
    return new RemoteArtifactManager(clientConfig, restClient, artifactId);
}
Also used : RemoteArtifactManager(co.cask.cdap.test.remote.RemoteArtifactManager) Manifest(java.util.jar.Manifest)

Example 3 with RemoteArtifactManager

use of co.cask.cdap.test.remote.RemoteArtifactManager in project cdap by caskdata.

the class IntegrationTestManager method addPluginArtifact.

@Override
public ArtifactManager addPluginArtifact(ArtifactId artifactId, Set<ArtifactRange> parents, Class<?> pluginClass, Class<?>... pluginClasses) throws Exception {
    Manifest manifest = createManifest(pluginClass, pluginClasses);
    final Location appJar = PluginJarHelper.createPluginJar(locationFactory, manifest, pluginClass, pluginClasses);
    artifactClient.add(artifactId, parents, new InputSupplier<InputStream>() {

        @Override
        public InputStream getInput() throws IOException {
            return appJar.getInputStream();
        }
    });
    appJar.delete();
    return new RemoteArtifactManager(clientConfig, restClient, artifactId);
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RemoteArtifactManager(co.cask.cdap.test.remote.RemoteArtifactManager) IOException(java.io.IOException) Manifest(java.util.jar.Manifest) Location(org.apache.twill.filesystem.Location)

Example 4 with RemoteArtifactManager

use of co.cask.cdap.test.remote.RemoteArtifactManager in project cdap by caskdata.

the class IntegrationTestManager method addPluginArtifact.

@Override
public ArtifactManager addPluginArtifact(ArtifactId artifactId, Set<ArtifactRange> parents, @Nullable Set<PluginClass> additionalPlugins, Class<?> pluginClass, Class<?>... pluginClasses) throws Exception {
    Manifest manifest = createManifest(pluginClass, pluginClasses);
    final Location appJar = PluginJarHelper.createPluginJar(locationFactory, manifest, pluginClass, pluginClasses);
    artifactClient.add(Ids.namespace(artifactId.getNamespace()), artifactId.getArtifact(), new InputSupplier<InputStream>() {

        @Override
        public InputStream getInput() throws IOException {
            return appJar.getInputStream();
        }
    }, artifactId.getVersion(), parents, additionalPlugins);
    appJar.delete();
    return new RemoteArtifactManager(clientConfig, restClient, artifactId);
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RemoteArtifactManager(co.cask.cdap.test.remote.RemoteArtifactManager) IOException(java.io.IOException) Manifest(java.util.jar.Manifest) Location(org.apache.twill.filesystem.Location)

Example 5 with RemoteArtifactManager

use of co.cask.cdap.test.remote.RemoteArtifactManager in project cdap by caskdata.

the class IntegrationTestManager method addAppArtifact.

@Override
public ArtifactManager addAppArtifact(ArtifactId artifactId, Class<?> appClass, Manifest manifest) throws Exception {
    final Location appJar = AppJarHelper.createDeploymentJar(locationFactory, appClass, manifest, CLASS_ACCEPTOR);
    artifactClient.add(artifactId, null, new InputSupplier<InputStream>() {

        @Override
        public InputStream getInput() throws IOException {
            return appJar.getInputStream();
        }
    });
    appJar.delete();
    return new RemoteArtifactManager(clientConfig, restClient, artifactId);
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) RemoteArtifactManager(co.cask.cdap.test.remote.RemoteArtifactManager) IOException(java.io.IOException) Location(org.apache.twill.filesystem.Location)

Aggregations

RemoteArtifactManager (co.cask.cdap.test.remote.RemoteArtifactManager)6 FileInputStream (java.io.FileInputStream)3 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 Manifest (java.util.jar.Manifest)3 Location (org.apache.twill.filesystem.Location)3 ArtifactRange (co.cask.cdap.api.artifact.ArtifactRange)2 ArtifactVersion (co.cask.cdap.api.artifact.ArtifactVersion)2 HashSet (java.util.HashSet)2