Search in sources :

Example 26 with ExtFile

use of brut.directory.ExtFile in project Apktool by iBotPeaches.

the class DoubleExtensionUnknownFileTest method multipleExtensionUnknownFileTest.

@Test
public void multipleExtensionUnknownFileTest() throws BrutException, IOException {
    String apk = "issue1244.apk";
    // decode issue1244.apk
    ApkDecoder apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + apk));
    ExtFile decodedApk = new ExtFile(sTmpDir + File.separator + apk + ".out");
    apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out"));
    apkDecoder.decode();
    MetaInfo metaInfo = new Androlib().readMetaFile(decodedApk);
    for (String string : metaInfo.doNotCompress) {
        if (StringUtils.countMatches(string, ".") > 1) {
            assertTrue(string.equalsIgnoreCase("assets/bin/Data/sharedassets1.assets.split0"));
        }
    }
}
Also used : MetaInfo(brut.androlib.meta.MetaInfo) ExtFile(brut.directory.ExtFile) ExtFile(brut.directory.ExtFile) File(java.io.File) Test(org.junit.Test)

Example 27 with ExtFile

use of brut.directory.ExtFile in project Apktool by iBotPeaches.

the class LargeIntsInManifestTest method checkIfLargeIntsAreHandledTest.

@Test
public void checkIfLargeIntsAreHandledTest() throws BrutException, IOException {
    String apk = "issue767.apk";
    // decode issue767.apk
    ApkDecoder apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + apk));
    sTestOrigDir = new ExtFile(sTmpDir + File.separator + apk + ".out");
    apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out"));
    apkDecoder.decode();
    // build issue767
    ExtFile testApk = new ExtFile(sTmpDir, apk + ".out");
    new Androlib().build(testApk, null);
    String newApk = apk + ".out" + File.separator + "dist" + File.separator + apk;
    // decode issue767 again
    apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + newApk));
    sTestNewDir = new ExtFile(sTmpDir + File.separator + apk + ".out.two");
    apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out.two"));
    apkDecoder.decode();
    compareXmlFiles("AndroidManifest.xml");
}
Also used : ExtFile(brut.directory.ExtFile) ExtFile(brut.directory.ExtFile) File(java.io.File)

Example 28 with ExtFile

use of brut.directory.ExtFile in project Apktool by iBotPeaches.

the class MissingVersionManifestTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception, BrutException {
    TestUtils.cleanFrameworkFile();
    sTmpDir = new ExtFile(OS.createTempDirectory());
    TestUtils.copyResourceDir(LargeIntsInManifestTest.class, "brut/apktool/issue1264/", sTmpDir);
}
Also used : ExtFile(brut.directory.ExtFile) BeforeClass(org.junit.BeforeClass)

Example 29 with ExtFile

use of brut.directory.ExtFile in project Apktool by iBotPeaches.

the class MissingVersionManifestTest method missingVersionParsesCorrectlyTest.

@Test
public void missingVersionParsesCorrectlyTest() throws BrutException, IOException {
    String apk = "issue1264.apk";
    // decode issue1264.apk
    ApkDecoder apkDecoder = new ApkDecoder(new File(sTmpDir + File.separator + apk));
    ExtFile decodedApk = new ExtFile(sTmpDir + File.separator + apk + ".out");
    apkDecoder.setOutDir(new File(sTmpDir + File.separator + apk + ".out"));
    apkDecoder.decode();
    MetaInfo metaInfo = new Androlib().readMetaFile(decodedApk);
    assertEquals(null, metaInfo.versionInfo.versionName);
}
Also used : MetaInfo(brut.androlib.meta.MetaInfo) ExtFile(brut.directory.ExtFile) ExtFile(brut.directory.ExtFile) File(java.io.File) Test(org.junit.Test)

Example 30 with ExtFile

use of brut.directory.ExtFile in project Apktool by iBotPeaches.

the class ProviderAttributeTest method beforeClass.

@BeforeClass
public static void beforeClass() throws BrutException {
    TestUtils.cleanFrameworkFile();
    sTmpDir = new ExtFile(OS.createTempDirectory());
    TestUtils.copyResourceDir(ProviderAttributeTest.class, "brut/apktool/issue636/", sTmpDir);
}
Also used : ExtFile(brut.directory.ExtFile) BeforeClass(org.junit.BeforeClass)

Aggregations

ExtFile (brut.directory.ExtFile)31 ZipFile (java.util.zip.ZipFile)12 File (java.io.File)10 BeforeClass (org.junit.BeforeClass)8 Test (org.junit.Test)5 MetaInfo (brut.androlib.meta.MetaInfo)4 AndrolibException (brut.androlib.AndrolibException)2 BrutException (brut.common.BrutException)1 Directory (brut.directory.Directory)1 DirectoryException (brut.directory.DirectoryException)1 FileDirectory (brut.directory.FileDirectory)1