Remove unused method and test
Bug: 4331476
Change-Id: I43811a9403b4d7a668433fb4749bf10c79f083f1
diff --git a/src/com/android/exchange/EasSyncService.java b/src/com/android/exchange/EasSyncService.java
index 22798ca..4a8795e 100644
--- a/src/com/android/exchange/EasSyncService.java
+++ b/src/com/android/exchange/EasSyncService.java
@@ -96,7 +96,6 @@
import android.util.Xml;
import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -1073,37 +1072,6 @@
}
}
- public File createUniqueFileInternal(String dir, String filename) {
- File directory;
- if (dir == null) {
- directory = mContext.getFilesDir();
- } else {
- directory = new File(dir);
- }
- if (!directory.exists()) {
- directory.mkdirs();
- }
- File file = new File(directory, filename);
- if (!file.exists()) {
- return file;
- }
- // Get the extension of the file, if any.
- int index = filename.lastIndexOf('.');
- String name = filename;
- String extension = "";
- if (index != -1) {
- name = filename.substring(0, index);
- extension = filename.substring(index);
- }
- for (int i = 2; i < Integer.MAX_VALUE; i++) {
- file = new File(directory, name + '-' + i + extension);
- if (!file.exists()) {
- return file;
- }
- }
- return null;
- }
-
/**
* Loads an attachment, based on the PartRequest passed in. The PartRequest is basically our
* wrapper for Attachment
diff --git a/tests/src/com/android/exchange/EasSyncServiceTests.java b/tests/src/com/android/exchange/EasSyncServiceTests.java
index 791e41a..c59b9dd 100644
--- a/tests/src/com/android/exchange/EasSyncServiceTests.java
+++ b/tests/src/com/android/exchange/EasSyncServiceTests.java
@@ -28,7 +28,6 @@
import android.test.suitebuilder.annotation.SmallTest;
import android.util.Base64;
-import java.io.File;
import java.io.IOException;
/**
@@ -50,48 +49,6 @@
mMockContext = getContext();
}
- /**
- * Test that our unique file name algorithm works as expected.
- * @throws IOException
- */
- public void testCreateUniqueFile() throws IOException {
- // Delete existing files, if they exist
- EasSyncService svc = new EasSyncService();
- svc.mContext = mMockContext;
- try {
- String fileName = "A11achm3n1.doc";
- File uniqueFile = svc.createUniqueFileInternal(null, fileName);
- assertEquals(fileName, uniqueFile.getName());
- if (uniqueFile.createNewFile()) {
- uniqueFile = svc.createUniqueFileInternal(null, fileName);
- assertEquals("A11achm3n1-2.doc", uniqueFile.getName());
- if (uniqueFile.createNewFile()) {
- uniqueFile = svc.createUniqueFileInternal(null, fileName);
- assertEquals("A11achm3n1-3.doc", uniqueFile.getName());
- }
- }
- fileName = "A11achm3n1";
- uniqueFile = svc.createUniqueFileInternal(null, fileName);
- assertEquals(fileName, uniqueFile.getName());
- if (uniqueFile.createNewFile()) {
- uniqueFile = svc.createUniqueFileInternal(null, fileName);
- assertEquals("A11achm3n1-2", uniqueFile.getName());
- }
- } finally {
- // These are the files that should be created earlier in the test. Make sure
- // they are deleted for the next go-around
- File directory = getContext().getFilesDir();
- String[] fileNames = new String[] {"A11achm3n1.doc", "A11achm3n1-2.doc", "A11achm3n1"};
- int length = fileNames.length;
- for (int i = 0; i < length; i++) {
- File file = new File(directory, fileNames[i]);
- if (file.exists()) {
- file.delete();
- }
- }
- }
- }
-
public void testAddHeaders() {
HttpRequestBase method = new HttpPost();
EasSyncService svc = new EasSyncService();