Java Code Examples for javax.microedition.io.file.FileConnection#isHidden()

The following examples show how to use javax.microedition.io.file.FileConnection#isHidden() . 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 File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a hidden 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("Setting file as hidden");
			conn.setHidden(true);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a hidden file", passed);
}
 
Example 2
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a non-hidden 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-hidden");
			conn.setHidden(false);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a non-hidden file", passed);
}
 
Example 3
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a hidden 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 hidden");
			conn.setHidden(true);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==true;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a hidden directory", passed);
}
 
Example 4
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a non-hidden directory
 */
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);
			
			addOperationDesc("Setting directory as non-hidden");
			conn.setHidden(false);
			
			boolean isHidden = conn.isHidden();
			addOperationDesc("isHidden() returned " + isHidden);
			
			passed = isHidden==false;
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}

	assertTrueWithLog("Tests isHidden() on a non-hidden directory", passed);
}
 
Example 5
Source File: IsHidden.java    From pluotsorbet with 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 6
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a directory (hidden 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 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 7
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() 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 isHidden = conn.isHidden();
			addOperationDesc("isHidden() call returned " + isHidden);
			
			passed = true;								
		} finally {
			conn.close();
		}
	} catch (Exception e) {
		logUnexpectedExceptionDesc(e);
		passed = false;
	}
	
	assertTrueWithLog("Tests isHidden() in Connector.READ mode", passed);
}
 
Example 8
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() 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 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 file", passed);
}
 
Example 9
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() on a non-existent file (hidden 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 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 file (hidden attribute is NOT supported by filesystem)", passed);
}
 
Example 10
Source File: IsHidden.java    From pluotsorbet with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Tests isHidden() 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 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", passed);
}
 
Example 11
Source File: IsHidden.java    From pluotsorbet with 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);
}