Search in sources :

Example 1 with AndroidFinalPackageElement

use of org.jetbrains.android.compiler.artifact.AndroidFinalPackageElement in project android by JetBrains.

the class NonGradleApkProviderTest method testGetApksWithArtifactName.

public void testGetApksWithArtifactName() throws Exception {
    IDevice device = Mockito.mock(IDevice.class);
    ArtifactManager artifactManager = ArtifactManager.getInstance(myFacet.getModule().getProject());
    CompositePackagingElement<?> archive = PackagingElementFactory.getInstance().createArchive("right.apk");
    archive.addFirstChild(new AndroidFinalPackageElement(myFacet.getModule().getProject(), myFacet));
    artifactManager.addArtifact("customApk", AndroidApplicationArtifactType.getInstance(), archive);
    myFacet.getProperties().APK_PATH = "wrong.apk";
    NonGradleApkProvider provider = new NonGradleApkProvider(myFacet, new NonGradleApplicationIdProvider(myFacet), "customApk");
    Collection<ApkInfo> apks = provider.getApks(device);
    assertNotNull(apks);
    assertEquals(1, apks.size());
    ApkInfo apk = apks.iterator().next();
    assertEquals("p1.p2", apk.getApplicationId());
    assertTrue(apk.getFile().getPath().endsWith("right.apk"));
}
Also used : ArtifactManager(com.intellij.packaging.artifacts.ArtifactManager) AndroidFinalPackageElement(org.jetbrains.android.compiler.artifact.AndroidFinalPackageElement) IDevice(com.android.ddmlib.IDevice)

Aggregations

IDevice (com.android.ddmlib.IDevice)1 ArtifactManager (com.intellij.packaging.artifacts.ArtifactManager)1 AndroidFinalPackageElement (org.jetbrains.android.compiler.artifact.AndroidFinalPackageElement)1