Search in sources :

Example 1 with Repo

use of org.fdroid.fdroid.data.Repo in project fdroidclient by f-droid.

the class FDroidApp method initWifiSettings.

/**
 * Initialize the settings needed to run a local swap repo. This should
 * only ever be called in {@link org.fdroid.fdroid.net.WifiStateChangeService.WifiInfoThread},
 * after the single init call in {@link FDroidApp#onCreate()}.
 */
public static void initWifiSettings() {
    port = 8888;
    ipAddressString = null;
    subnetInfo = new SubnetUtils("0.0.0.0/32").getInfo();
    ssid = "";
    bssid = "";
    repo = new Repo();
}
Also used : SubnetUtils(org.apache.commons.net.util.SubnetUtils) Repo(org.fdroid.fdroid.data.Repo)

Example 2 with Repo

use of org.fdroid.fdroid.data.Repo in project fdroidclient by f-droid.

the class ProperMultiRepoUpdaterTest method metadataWithRepoPriority.

@Test
public void metadataWithRepoPriority() throws RepoUpdater.UpdateException {
    updateMain();
    updateArchive();
    updateConflicting();
    Repo mainRepo = RepoProvider.Helper.findByAddress(context, REPO_MAIN_URI);
    assertEquals(1, mainRepo.priority);
    assertEquals(2, RepoProvider.Helper.findByAddress(context, REPO_ARCHIVE_URI).priority);
    assertEquals(3, RepoProvider.Helper.findByAddress(context, REPO_CONFLICTING_URI).priority);
    assertMainRepo();
    assertMainArchiveRepoMetadata();
    assertConflictingRepo();
    assertRepoTakesPriority("Conflicting");
    // Make the conflicting repo less important than the main repo.
    ContentValues values = new ContentValues(1);
    values.put(Cols.PRIORITY, 5);
    RepoProvider.Helper.update(context, mainRepo, values);
    Repo updatedMainRepo = RepoProvider.Helper.findByAddress(context, REPO_MAIN_URI);
    assertEquals(5, updatedMainRepo.priority);
    assertRepoTakesPriority("Normal");
}
Also used : ContentValues(android.content.ContentValues) Repo(org.fdroid.fdroid.data.Repo) Test(org.junit.Test)

Example 3 with Repo

use of org.fdroid.fdroid.data.Repo in project fdroidclient by f-droid.

the class ProperMultiRepoUpdaterTest method assertMainArchiveRepoMetadata.

/**
 * + AdAway (org.adaway)
 * - Version 2.9.2 (51)
 * - Version 2.9.1 (50)
 * - Version 2.9 (49)
 * - Version 2.8.1 (48)
 * - Version 2.8 (47)
 * - Version 2.7 (46)
 * - Version 2.6 (45)
 * - Version 2.3 (42)
 * - Version 2.1 (40)
 * - Version 1.37 (38)
 * - Version 1.36 (37)
 * - Version 1.35 (36)
 * - Version 1.34 (35)
 */
private void assertMainArchiveRepoMetadata(List<Repo> allRepos) {
    Repo repo = findRepo(REPO_ARCHIVE, allRepos);
    List<Apk> apks = ApkProvider.Helper.findByRepo(context, repo, Schema.ApkTable.Cols.ALL);
    assertEquals("Apks for main archive repo", 13, apks.size());
    assertApksExist(apks, "org.adaway", new int[] { 35, 36, 37, 38, 40, 42, 45, 46, 47, 48, 49, 50, 51 });
    assertAdAwayMetadata(repo, "Normal");
}
Also used : Repo(org.fdroid.fdroid.data.Repo) Apk(org.fdroid.fdroid.data.Apk)

Example 4 with Repo

use of org.fdroid.fdroid.data.Repo in project fdroidclient by f-droid.

the class ProperMultiRepoUpdaterTest method appsRemovedFromRepo.

@Test
public void appsRemovedFromRepo() throws RepoUpdater.UpdateException {
    assertEquals(0, AppProvider.Helper.all(context.getContentResolver()).size());
    updateMain();
    Repo repo = RepoProvider.Helper.findByAddress(context, REPO_MAIN_URI);
    assertEquals(3, AppProvider.Helper.all(context.getContentResolver()).size());
    assertEquals(6, ApkProvider.Helper.findByRepo(context, repo, Schema.ApkTable.Cols.ALL).size());
    assertEquals(3, ApkProvider.Helper.findByPackageName(context, "org.adaway").size());
    assertEquals(2, ApkProvider.Helper.findByPackageName(context, "com.uberspot.a2048").size());
    assertEquals(1, ApkProvider.Helper.findByPackageName(context, "siir.es.adbWireless").size());
    RepoUpdater updater = new RepoUpdater(context, RepoProvider.Helper.findByAddress(context, repo.address));
    updateRepo(updater, "multiRepo.conflicting.jar");
    assertEquals(2, AppProvider.Helper.all(context.getContentResolver()).size());
    assertEquals(6, ApkProvider.Helper.findByRepo(context, repo, Schema.ApkTable.Cols.ALL).size());
    assertEquals(4, ApkProvider.Helper.findByPackageName(context, "org.adaway").size());
    assertEquals(2, ApkProvider.Helper.findByPackageName(context, "org.dgtale.icsimport").size());
}
Also used : Repo(org.fdroid.fdroid.data.Repo) RepoUpdater(org.fdroid.fdroid.RepoUpdater) Test(org.junit.Test)

Example 5 with Repo

use of org.fdroid.fdroid.data.Repo in project fdroidclient by f-droid.

the class RepoXMLHandlerTest method testPushRequestsRepoIgnore.

@Test
public void testPushRequestsRepoIgnore() {
    Repo expectedRepo = new Repo();
    expectedRepo.name = "non-public test repo";
    // NOCHECKSTYLE LineLength
    expectedRepo.signingCertificate = "308204e1308202c9a0030201020204483450fa300d06092a864886f70d01010b050030213110300e060355040b1307462d44726f6964310d300b06035504031304736f7661301e170d3136303832333133333131365a170d3434303130393133333131365a30213110300e060355040b1307462d44726f6964310d300b06035504031304736f766130820222300d06092a864886f70d01010105000382020f003082020a0282020100dfdcd120f3ab224999dddf4ea33ea588d295e4d7130bef48c143e9d76e5c0e0e9e5d45e64208e35feebc79a83f08939dd6a343b7d1e2179930a105a1249ccd36d88ff3feffc6e4dc53dae0163a7876dd45ecc1ddb0adf5099aa56c1a84b52affcd45d0711ffa4de864f35ac0333ebe61ea8673eeda35a88f6af678cc4d0f80b089338ac8f2a8279a64195c611d19445cab3fd1a020afed9bd739bb95142fb2c00a8f847db5ef3325c814f8eb741bacf86ed3907bfe6e4564d2de5895df0c263824e0b75407589bae2d3a4666c13b92102d8781a8ee9bb4a5a1a78c4a9c21efdaf5584da42e84418b28f5a81d0456a3dc5b420991801e6b21e38c99bbe018a5b2d690894a114bc860d35601416aa4dc52216aff8a288d4775cddf8b72d45fd2f87303a8e9c0d67e442530be28eaf139894337266e0b33d57f949256ab32083bcc545bc18a83c9ab8247c12aea037e2b68dee31c734cb1f04f241d3b94caa3a2b258ffaf8e6eae9fbbe029a934dc0a0859c5f120334812693a1c09352340a39f2a678dbc1afa2a978bfee43afefcb7e224a58af2f3d647e5745db59061236b8af6fcfd93b3602f9e456978534f3a7851e800071bf56da80401c81d91c45f82568373af0576b1cc5eef9b85654124b6319770be3cdba3fbebe3715e8918fb6c8966624f3d0e815effac3d2ee06dd34ab9c693218b2c7c06ba99d6b74d4f17b8c3cb0203010001a321301f301d0603551d0e04160414d62bee9f3798509546acc62eb1de14b08b954d4f300d06092a864886f70d01010b05000382020100743f7c5692085895f9d1fffad390fb4202c15f123ed094df259185960fd6dadf66cb19851070f180297bba4e6996a4434616573b375cfee94fee73a4505a7ec29136b7e6c22e6436290e3686fe4379d4e3140ec6a08e70cfd3ed5b634a5eb5136efaaabf5f38e0432d3d79568a556970b8cfba2972f5d23a3856d8a981b9e9bbbbb88f35e708bde9cbc5f681cbd974085b9da28911296fe2579fa64bbe9fa0b93475a7a8db051080b0c5fade0d1c018e7858cd4cbe95145b0620e2f632cbe0f8af9cbf22e2fdaa72245ae31b0877b07181cc69dd2df74454251d8de58d25e76354abe7eb690f22e59b08795a8f2c98c578e0599503d9085927634072c82c9f82abd50fd12b8fd1a9d1954eb5cc0b4cfb5796b5aaec0356643b4a65a368442d92ef94edd3ac6a2b7fe3571b8cf9f462729228aab023ef9183f73792f5379633ccac51079177d604c6bc1873ada6f07d8da6d68c897e88a5fa5d63fdb8df820f46090e0716e7562dd3c140ba279a65b996f60addb0abe29d4bf2f5abe89480771d492307b926d91f02f341b2148502903c43d40f3c6c86a811d060711f0698b384acdcc0add44eb54e42962d3d041accc715afd49407715adc09350cb55e8d9281a3b0b6b5fcd91726eede9b7c8b13afdebb2c2b377629595f1096ba62fb14946dbac5f3c5f0b4e5b712e7acc7dcf6c46cdc5e6d6dfdeee55a0c92c2d70f080ac6";
    // NOCHECKSTYLE LineLength
    expectedRepo.description = "This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/u/fdroid.";
    expectedRepo.timestamp = 1472071347;
    RepoDetails actualDetails = getFromFile("pushRequestsIndex.xml", Repo.PUSH_REQUEST_IGNORE);
    handlerTestSuite(expectedRepo, actualDetails, 2, 14, -1, 17);
    checkPushRequests(actualDetails);
    List<RepoPushRequest> repoPushRequests = actualDetails.repoPushRequestList;
    assertNotNull(repoPushRequests);
    assertEquals(0, repoPushRequests.size());
}
Also used : Repo(org.fdroid.fdroid.data.Repo) RepoPushRequest(org.fdroid.fdroid.data.RepoPushRequest) RepoDetails(org.fdroid.fdroid.mock.RepoDetails) Test(org.junit.Test)

Aggregations

Repo (org.fdroid.fdroid.data.Repo)30 Test (org.junit.Test)14 RepoDetails (org.fdroid.fdroid.mock.RepoDetails)8 ArrayList (java.util.ArrayList)5 FDroidProviderTest (org.fdroid.fdroid.data.FDroidProviderTest)5 NonNull (android.support.annotation.NonNull)4 InputStream (java.io.InputStream)4 List (java.util.List)4 JarEntry (java.util.jar.JarEntry)4 JarFile (java.util.jar.JarFile)4 IndexV1Updater (org.fdroid.fdroid.IndexV1Updater)4 Apk (org.fdroid.fdroid.data.Apk)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 ContentValues (android.content.ContentValues)3 App (org.fdroid.fdroid.data.App)3 RepoPushRequest (org.fdroid.fdroid.data.RepoPushRequest)3 Uri (android.net.Uri)2 View (android.view.View)2 TextView (android.widget.TextView)2 JsonFactory (com.fasterxml.jackson.core.JsonFactory)2