Bug 1291821 - Post: remove unused files r=rnewman

MozReview-Commit-ID: 4qM5vx4AQyQ

--HG--
extra : rebase_source : 5428e67f40947d58521b635cda86121d21ebe275
This commit is contained in:
Grisha Kruglov 2016-11-29 13:36:26 -08:00
parent 283d1a3450
commit 8e54812b61
3 changed files with 0 additions and 124 deletions

View File

@ -1062,7 +1062,6 @@ sync_java_files = [TOPSRCDIR + '/mobile/android/services/src/main/java/org/mozil
'sync/stage/ServerSyncStage.java',
'sync/stage/SyncClientsEngineStage.java',
'sync/stage/UploadMetaGlobalStage.java',
'sync/Sync11Configuration.java',
'sync/SyncConfiguration.java',
'sync/SyncConfigurationException.java',
'sync/SyncConstants.java',

View File

@ -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());
}
}

View File

@ -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());
}
}