use of dalvik.annotation.SideEffect in project robovm by robovm.
the class ExemptionMechanismTest method test_finalize.
@SideEffect("Causes OutOfMemoryError to test finalization")
public void test_finalize() {
Mock_ExemptionMechanism mem = new Mock_ExemptionMechanism(null, null, "Name");
assertNotNull(mem);
mem = null;
assertFalse(flag);
Vector v = new Vector();
int capacity;
try {
while (true) {
v.add(this);
}
} catch (OutOfMemoryError e) {
capacity = v.size();
v = null;
}
v = new Vector();
for (int i = 0; i < capacity / 2; i++) {
v.add(this);
}
v = null;
assertTrue(flag);
}
use of dalvik.annotation.SideEffect in project robovm by robovm.
the class OldURLClassLoaderTest method test_findResource_String.
/**
* Regression for Harmony-2237
*/
@SideEffect("Support_TestWebServer requires isolation.")
public void test_findResource_String() throws Exception {
File tempFile1 = File.createTempFile("textFile", ".txt");
tempFile1.createNewFile();
tempFile1.deleteOnExit();
File tempFile2 = File.createTempFile("jarFile", ".jar");
tempFile2.delete();
tempFile2.deleteOnExit();
Support_TestWebServer server = new Support_TestWebServer();
try {
int port = server.initServer();
String tempPath1 = tempFile1.getParentFile().getAbsolutePath() + "/";
InputStream is = getClass().getResourceAsStream("/tests/resources/hyts_patch.jar");
Support_Resources.copyLocalFileto(tempFile2, is);
String tempPath2 = tempFile2.getAbsolutePath();
String tempPath3 = "http://localhost:" + port + "/";
URLClassLoader urlLoader = getURLClassLoader(tempPath1, tempPath2);
assertNull("Found inexistant resource", urlLoader.findResource("XXX"));
assertNotNull("Couldn't find resource from directory", urlLoader.findResource(tempFile1.getName()));
assertNotNull("Couldn't find resource from jar", urlLoader.findResource("Blah.txt"));
urlLoader = getURLClassLoader(tempPath1, tempPath2, tempPath3);
assertNotNull("Couldn't find resource from web", urlLoader.findResource("test1"));
assertNull("Found inexistant resource from web", urlLoader.findResource("test3"));
} finally {
server.close();
}
}
Aggregations