Java Code Examples for javax.microedition.io.file.FileConnection

The following examples show how to use javax.microedition.io.file.FileConnection. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: pluotsorbet   Source File: IsDirectory.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isDirectory() on a non-existent directory URL
 */
public void test0004() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);

			boolean isDirectory = conn.isDirectory();
			addOperationDesc("isDirectory() returned " + isDirectory);
			
			passed = isDirectory==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isDirectory() on a non-existent directory URL returns false", passed);
}
 
Example 2
Source Project: pluotsorbet   Source File: UTF8Bench.java    License: GNU General Public License v2.0 6 votes vote down vote up
void generateData() throws IOException {
    String str = "";
    String part = "abcdefghilmnopqrstuvzABCDEFGHILMNOPQRSTUVZabcdefghilmnopqrstuvzABCDEFGHILMNOPQRSTUVZ";
    for (int i = 0; i < 2000; i++) {
      str += part;
    }

    cbuf = new char[str.length()];
    cbufReader = new char[cbuf.length];
    str.getChars(0, str.length(), cbuf, 0);

    String dirPath = System.getProperty("fileconn.dir.private");
    file = (FileConnection)Connector.open(dirPath + "test");
    if (file.exists()) {
        file.delete();
    }
    file.create();
}
 
Example 3
public void startApp() {
    System.out.println("START - Background alarm started: " + startedBackgroundAlarm());

    receiveSMS();

    try {
        FileConnection file = (FileConnection)Connector.open("file:////startBackgroundService");
        if (!file.exists()) {
            file.create();
        }
        file.close();
    } catch (IOException e) {
        System.out.println("Unexpected exception: " + e);
        return;
    }

    System.out.println("DONE - Background alarm started: " + startedBackgroundAlarm());
}
 
Example 4
Source Project: pluotsorbet   Source File: IsDirectory.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isDirectory() on a file
 */
public void test0001() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			boolean isDirectory = conn.isDirectory();
			addOperationDesc("isDirectory() returned " + isDirectory);
			
			passed = isDirectory==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isDirectory() on a file", passed);
}
 
Example 5
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() on a non-writable file
 */
public void test0002() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			addOperationDesc("Setting file as non-writable");
			conn.setWritable(false);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a non-writable file", passed);
}
 
Example 6
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() on a writable directory
 */
public void test0003() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			addOperationDesc("Setting directory as writable");
			conn.setWritable(true);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a writable directory", passed);
}
 
Example 7
Source Project: pluotsorbet   Source File: IsDirectory.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isDirectory() on a non-existent file URL
 */
public void test0003() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir", Connector.READ_WRITE);
		try {
		
			addOperationDesc("Deleting file: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean isDirectory = conn.isDirectory();
			addOperationDesc("isDirectory() returned " + isDirectory);
			
			passed = isDirectory==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isDirectory() on a non-existent file URL returns false", passed);
}
 
Example 8
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() on a file (writable attribute is NOT supported by filesystem)
 */
public void test0005() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			addOperationDesc("Setting file as non-writable");
			conn.setWritable(false);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a file (writable attribute is NOT supported by filesystem)", passed);
}
 
Example 9
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() on a directory (writable attribute is NOT supported by filesystem)
 */
public void test0006() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			addOperationDesc("Setting directory as non-writable");
			conn.setWritable(false);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests canWrite() on a directory (writable attribute is NOT supported by filesystem)", passed);
}
 
Example 10
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() in Connector.READ mode
 */
public void test0009() {
	boolean passed = false;
	try {	
		addOperationDesc("Opening connection in READ mode");
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ);
		try {
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() call returned " + canWrite);
			
			passed = true;								
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}
	
	assertTrueWithLog("Tests canWrite() in Connector.READ mode", passed);
}
 
Example 11
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() on a non-existent file
 */
public void test0010() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting file: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("canWrite() returns false for a non-existent file", passed);
}
 
Example 12
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() on a non-existent file (writable attribute is NOT supported by filesystem)
 */
public void test0011() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting file: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("canWrite() returns false for a non-existent file (writable attribute is NOT supported by filesystem)", passed);
}
 
Example 13
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() on a non-existent directory
 */
public void test0012() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("canWrite() returns false for a non-existent directory", passed);
}
 
Example 14
Source Project: pluotsorbet   Source File: CanWrite.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests canWrite() on a non-existent directory (writable attribute is NOT supported by filesystem)
 */
public void test0013() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean canWrite = conn.canWrite();
			addOperationDesc("canWrite() returned " + canWrite);
			
			passed = canWrite==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("canWrite() returns false for a non-existent directory (writable attribute is NOT supported by filesystem)", passed);
}
 
Example 15
Source Project: pluotsorbet   Source File: FileSize.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests fileSize() on a file
 */
public void test0001() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE); 
		try {				
			addOperationDesc("Creating file with a size of 64 bytes: " + conn.getURL());
			ensureFileExists(conn);
			ensureFileSize(conn, 64);
			
			long fileSize = conn.fileSize();
			addOperationDesc("fileSize() returned " + fileSize);
			
			passed = fileSize==64;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests fileSize() on a file", passed);
}
 
Example 16
Source Project: pluotsorbet   Source File: IsHidden.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a non-existent directory (hidden attribute is NOT supported by filesystem)
 */
public void test0013() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("isHidden() returns false for a non-existent directory (hidden attribute is NOT supported by filesystem)", passed);
}
 
Example 17
Source Project: pluotsorbet   Source File: Mkdir.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void test0001() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);
			
			addOperationDesc("Creating directory");
			conn.mkdir();

			boolean exists = conn.exists();
			addOperationDesc("exists() returned " + exists);

			passed = exists == true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("mkdir() creates a new directory", passed);
}
 
Example 18
Source Project: pluotsorbet   Source File: Delete.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests delete() on a file
 */
public void test0001() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			addOperationDesc("Deleting file");
			conn.delete();
			boolean exists = conn.exists();
			addOperationDesc("exists() returned " + exists);

			passed = exists == false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests delete() on a file", passed);
}
 
Example 19
Source Project: pluotsorbet   Source File: Delete.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests delete() on a directory
 */
public void test0002() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			addOperationDesc("Deleting directory");
			conn.delete();

			boolean exists = conn.exists();
			addOperationDesc("exists() returned " + exists);

			passed = exists ==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests delete() on a file", passed);
}
 
Example 20
Source Project: pluotsorbet   Source File: LastModified.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void test0004() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			long modifyTime = conn.lastModified();
			addOperationDesc("lastModified() returned " + modifyTime);
			
			passed = modifyTime == 0;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests lastModified() on a directory (modification date is NOT supported by filesystem)", passed);
}
 
Example 21
Source Project: pluotsorbet   Source File: DirectorySize.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests directorySize() on empty directory
 */
public void test0001() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			long directorySize = conn.directorySize(true);
			addOperationDesc("directorySize(true) returned " + directorySize);
			
			passed = directorySize==0;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests directorySize() on empty directory", passed);
}
 
Example 22
Source Project: pluotsorbet   Source File: DirectorySize.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests directorySize() in Connector.READ mode
 */
public void test0008() {
	boolean passed = false;
	try {	
		addOperationDesc("Opening connection in READ mode");
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ);
		try {
			long directorySize = conn.directorySize(false);
			addOperationDesc("directorySize() call returned " + directorySize);
			
			passed = true;								
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}
	
	assertTrueWithLog("Tests directorySize() in Connector.READ mode", passed);
}
 
Example 23
Source Project: pluotsorbet   Source File: DirectorySize.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests directorySize() on a non-existent directory
 */
public void test0009() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);
			
			long directorySize = conn.directorySize(true);
			addOperationDesc("directorySize(true) returned " + directorySize);
			
			passed = directorySize==-1;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests directorySize() on a non-existent directory", passed);
}
 
Example 24
Source Project: pluotsorbet   Source File: IsHidden.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a file (hidden attribute is NOT supported by filesystem)
 */
public void test0005() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			addOperationDesc("Setting file as hidden");
			conn.setHidden(true);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden + " (should have no effect)");
			
			passed = isHidden==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a file (hidden attribute is NOT supported by filesystem)", passed);
}
 
Example 25
Source Project: pluotsorbet   Source File: LastModified.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void test0002() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			
			addOperationDesc("Creating file: " + conn.getURL());
			ensureFileExists(conn);
			
			long modifyTime = conn.lastModified();
			addOperationDesc("lastModified() returned " + modifyTime);
			
			passed = modifyTime == 0;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests lastModified() on a file (modification date is NOT supported by filesystem)", passed);
}
 
Example 26
Source Project: pluotsorbet   Source File: Exists.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests exists() on a directory
 */
public void test0002() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Creating directory: " + conn.getURL());
			ensureDirExists(conn);
			
			boolean exists = conn.exists();
			addOperationDesc("exists() returned " + exists);
			
			passed = exists==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests exists() on a directory", passed);
}
 
Example 27
Source Project: pluotsorbet   Source File: Exists.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests exists() on a non-existent file
 */
public void test0003() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting file: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean exists = conn.exists();
			addOperationDesc("exists() returned " + exists);
			
			passed = exists==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests exists() on a non-existent file", passed);
}
 
Example 28
Source Project: pluotsorbet   Source File: Exists.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests exists() on a non-existent directory
 */
public void test0004() {
	boolean passed = false;
	try {
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"testdir/", Connector.READ_WRITE);
		try {
			addOperationDesc("Deleting directory: " + conn.getURL());
			ensureNotExists(conn);
			
			boolean exists = conn.exists();
			addOperationDesc("exists() returned " + exists);
			
			passed = exists==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests exists() on a non-existent directory", passed);
}
 
Example 29
Source Project: pluotsorbet   Source File: UsedSize.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests usedSize() in Connector.READ mode
 */
public void test0005() {
	boolean passed = false;
	try {	
		addOperationDesc("Opening connection in READ mode");
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ);
		try {
			long totalSize = conn.usedSize();
			addOperationDesc("usedSize() call returned " + totalSize);
			
			passed = true;								
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}
	
	assertTrueWithLog("Tests usedSize() in Connector.READ mode", passed);
}
 
Example 30
Source Project: pluotsorbet   Source File: TotalSize.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests totalSize()
 */
public void test0001() {
	boolean passed = false;
	try {	
		FileConnection conn = (FileConnection)Connector.open("file://"+getTestPath()+"test", Connector.READ_WRITE);
		try {
			long totalSize = conn.totalSize();
			addOperationDesc("totalSize() returned " + totalSize);
			passed = totalSize > 0;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}
	assertTrueWithLog("Tests totalSize()", passed);
}