Bug 1291821 - Post: remove unused files r=rnewman draft
authorGrisha Kruglov <gkruglov@mozilla.com>
Tue, 29 Nov 2016 13:36:26 -0800
changeset 489500 5428e67f40947d58521b635cda86121d21ebe275
parent 489499 63bd7daaa1fd2a63e10289d6d4cd198aaf81498b
child 547004 995c031aa68a206ce045d8535aa2bc5a3819d4d9
push id46825
push usergkruglov@mozilla.com
push dateFri, 24 Feb 2017 21:13:39 +0000
reviewersrnewman
bugs1291821
milestone54.0a1
Bug 1291821 - Post: remove unused files r=rnewman MozReview-Commit-ID: 4qM5vx4AQyQ
mobile/android/base/android-services.mozbuild
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
--- a/mobile/android/base/android-services.mozbuild
+++ b/mobile/android/base/android-services.mozbuild
@@ -1057,17 +1057,16 @@ sync_java_files = [TOPSRCDIR + '/mobile/
     'sync/stage/FetchMetaGlobalStage.java',
     'sync/stage/FormHistoryServerSyncStage.java',
     'sync/stage/GlobalSyncStage.java',
     'sync/stage/NoSuchStageException.java',
     'sync/stage/PasswordsServerSyncStage.java',
     'sync/stage/ServerSyncStage.java',
     'sync/stage/SyncClientsEngineStage.java',
     'sync/stage/UploadMetaGlobalStage.java',
-    'sync/Sync11Configuration.java',
     'sync/SyncConfiguration.java',
     'sync/SyncConfigurationException.java',
     'sync/SyncConstants.java',
     'sync/SyncDeadlineReachedException.java',
     'sync/SyncException.java',
     'sync/synchronizer/ConcurrentRecordConsumer.java',
     'sync/synchronizer/RecordConsumer.java',
     'sync/synchronizer/RecordsChannel.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());
-  }
-}