Bug 1291821 - Post: remove unused files r=rnewman draft
authorGrisha Kruglov <gkruglov@mozilla.com>
Tue, 29 Nov 2016 13:36:26 -0800
changeset 445753 2c28e52a991f039f32dbaa1d63c507e285022381
parent 445752 7fb9f3be33549ee0f78ed0661e280702a2afb792
child 538604 311209c85a1e233afb84411c4041e8510549eeab
push id37599
push usergkruglov@mozilla.com
push dateWed, 30 Nov 2016 06:33:43 +0000
reviewersrnewman
bugs1291821
milestone53.0a1
Bug 1291821 - Post: remove unused files r=rnewman MozReview-Commit-ID: 4qM5vx4AQyQ
mobile/android/services/src/main/java/org/mozilla/gecko/sync/Sync11Configuration.java
mobile/android/tests/background/junit4/src/org/mozilla/android/sync/test/TestSyncConfiguration.java
deleted file mode 100644
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/Sync11Configuration.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.sync;
-
-import java.net.URI;
-
-import org.mozilla.gecko.background.common.log.Logger;
-import org.mozilla.gecko.sync.crypto.KeyBundle;
-import org.mozilla.gecko.sync.net.AuthHeaderProvider;
-
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-
-/**
- * Override SyncConfiguration to restore the old behavior of clusterURL --
- * that is, a URL without the protocol version etc.
- *
- */
-public class Sync11Configuration extends SyncConfiguration {
-  private static final String LOG_TAG = "Sync11Configuration";
-  private static final String API_VERSION = "1.1";
-
-  public Sync11Configuration(String username,
-                             AuthHeaderProvider authHeaderProvider,
-                             SharedPreferences prefs) {
-    super(username, authHeaderProvider, prefs);
-  }
-
-  public Sync11Configuration(String username,
-                             AuthHeaderProvider authHeaderProvider,
-                             SharedPreferences prefs,
-                             KeyBundle keyBundle) {
-    super(username, authHeaderProvider, prefs, keyBundle);
-  }
-
-  @Override
-  public String getAPIVersion() {
-    return API_VERSION;
-  }
-
-  @Override
-  public String storageURL() {
-    return clusterURL + API_VERSION + "/" + username + "/storage";
-  }
-
-  @Override
-  protected String infoBaseURL() {
-    return clusterURL + API_VERSION + "/" + username + "/info/";
-  }
-
-  protected void setAndPersistClusterURL(URI u, SharedPreferences prefs) {
-    boolean shouldPersist = (prefs != null) && (clusterURL == null);
-
-    Logger.trace(LOG_TAG, "Setting cluster URL to " + u.toASCIIString() +
-                          (shouldPersist ? ". Persisting." : ". Not persisting."));
-    clusterURL = u;
-    if (shouldPersist) {
-      Editor edit = prefs.edit();
-      edit.putString(PREF_CLUSTER_URL, clusterURL.toASCIIString());
-      edit.commit();
-    }
-  }
-
-  protected void setClusterURL(URI u, SharedPreferences prefs) {
-    if (u == null) {
-      Logger.warn(LOG_TAG, "Refusing to set cluster URL to null.");
-      return;
-    }
-    URI uri = u.normalize();
-    if (uri.toASCIIString().endsWith("/")) {
-      setAndPersistClusterURL(u, prefs);
-      return;
-    }
-    setAndPersistClusterURL(uri.resolve("/"), prefs);
-    Logger.trace(LOG_TAG, "Set cluster URL to " + clusterURL.toASCIIString() + ", given input " + u.toASCIIString());
-  }
-
-  @Override
-  public void setClusterURL(URI u) {
-    setClusterURL(u, this.getPrefs());
-  }
-}
\ No newline at end of file
deleted file mode 100644
--- a/mobile/android/tests/background/junit4/src/org/mozilla/android/sync/test/TestSyncConfiguration.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-package org.mozilla.android.sync.test;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
-import org.mozilla.gecko.background.testhelpers.TestRunner;
-import org.mozilla.gecko.sync.Sync11Configuration;
-import org.mozilla.gecko.sync.SyncConfiguration;
-
-import java.net.URI;
-
-@RunWith(TestRunner.class)
-public class TestSyncConfiguration {
-  @Test
-  public void testURLs() throws Exception {
-    final MockSharedPreferences prefs = new MockSharedPreferences();
-
-    // N.B., the username isn't used in the cluster path.
-    SyncConfiguration fxaConfig = new SyncConfiguration("username", null, prefs);
-    fxaConfig.clusterURL = new URI("http://db1.oldsync.dev.lcip.org/1.1/174");
-    Assert.assertEquals("http://db1.oldsync.dev.lcip.org/1.1/174/info/collections", fxaConfig.infoCollectionsURL());
-    Assert.assertEquals("http://db1.oldsync.dev.lcip.org/1.1/174/info/collection_counts", fxaConfig.infoCollectionCountsURL());
-    Assert.assertEquals("http://db1.oldsync.dev.lcip.org/1.1/174/storage/meta/global", fxaConfig.metaURL());
-    Assert.assertEquals("http://db1.oldsync.dev.lcip.org/1.1/174/storage", fxaConfig.storageURL());
-    Assert.assertEquals("http://db1.oldsync.dev.lcip.org/1.1/174/storage/collection", fxaConfig.collectionURI("collection").toASCIIString());
-
-    SyncConfiguration oldConfig = new Sync11Configuration("username", null, prefs);
-    oldConfig.clusterURL = new URI("https://db.com/internal/");
-    Assert.assertEquals("https://db.com/internal/1.1/username/info/collections", oldConfig.infoCollectionsURL());
-    Assert.assertEquals("https://db.com/internal/1.1/username/info/collection_counts", oldConfig.infoCollectionCountsURL());
-    Assert.assertEquals("https://db.com/internal/1.1/username/storage/meta/global", oldConfig.metaURL());
-    Assert.assertEquals("https://db.com/internal/1.1/username/storage", oldConfig.storageURL());
-    Assert.assertEquals("https://db.com/internal/1.1/username/storage/collection", oldConfig.collectionURI("collection").toASCIIString());
-  }
-}