author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Tue, 24 Feb 2015 11:12:53 +0100 | |
changeset 1787 | ea12a3bb4b33 |
parent 1723 | 3a1f262311cf |
permissions | -rw-r--r-- |
jaroslav@576 | 1 |
/** |
jaroslav@576 | 2 |
* Back 2 Browser Bytecode Translator |
jaroslav@1787 | 3 |
* Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
jaroslav@576 | 4 |
* |
jaroslav@576 | 5 |
* This program is free software: you can redistribute it and/or modify |
jaroslav@576 | 6 |
* it under the terms of the GNU General Public License as published by |
jaroslav@576 | 7 |
* the Free Software Foundation, version 2 of the License. |
jaroslav@576 | 8 |
* |
jaroslav@576 | 9 |
* This program is distributed in the hope that it will be useful, |
jaroslav@576 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
jaroslav@576 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
jaroslav@576 | 12 |
* GNU General Public License for more details. |
jaroslav@576 | 13 |
* |
jaroslav@576 | 14 |
* You should have received a copy of the GNU General Public License |
jaroslav@576 | 15 |
* along with this program. Look for COPYING file in the top folder. |
jaroslav@576 | 16 |
* If not, see http://opensource.org/licenses/GPL-2.0. |
jaroslav@576 | 17 |
*/ |
jaroslav@576 | 18 |
package org.apidesign.bck2brwsr.compact.tck; |
jaroslav@576 | 19 |
|
jaroslav@576 | 20 |
import java.io.IOException; |
jaroslav@576 | 21 |
import java.util.ServiceLoader; |
jaroslav@576 | 22 |
import org.apidesign.bck2brwsr.vmtest.Compare; |
jaroslav@576 | 23 |
import org.apidesign.bck2brwsr.vmtest.VMTest; |
jaroslav@576 | 24 |
import org.openide.util.lookup.ServiceProvider; |
jaroslav@576 | 25 |
import org.testng.annotations.Factory; |
jaroslav@576 | 26 |
|
jaroslav@576 | 27 |
/** |
jaroslav@576 | 28 |
* |
jaroslav@576 | 29 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@576 | 30 |
*/ |
jaroslav@576 | 31 |
public class ServiceLoaderTest { |
jaroslav@576 | 32 |
@Compare//(scripting = false) |
jaroslav@576 | 33 |
public Object findsIOException() { |
jaroslav@576 | 34 |
// delayStart(); |
jaroslav@576 | 35 |
for (IOException e : ServiceLoader.load(IOException.class)) { |
jaroslav@576 | 36 |
return "Found service: " + e.getClass().getName(); |
jaroslav@576 | 37 |
} |
jaroslav@576 | 38 |
return null; |
jaroslav@576 | 39 |
} |
jaroslav@576 | 40 |
/* |
jaroslav@576 | 41 |
@org.apidesign.bck2brwsr.core.JavaScriptBody(args = { "a" }, body = "alert(a);") |
jaroslav@576 | 42 |
private static void alert(String a) { |
jaroslav@576 | 43 |
} |
jaroslav@576 | 44 |
private void delayStart() { |
jaroslav@576 | 45 |
for (int i = 0; i < 10; i++) { |
jaroslav@576 | 46 |
alert("State: " + i); |
jaroslav@576 | 47 |
for (int j = 0; j < 493208409; j++) ; |
jaroslav@576 | 48 |
} |
jaroslav@576 | 49 |
} |
jaroslav@576 | 50 |
*/ |
jaroslav@576 | 51 |
|
jaroslav@576 | 52 |
@Factory |
jaroslav@576 | 53 |
public static Object[] create() { |
jaroslav@576 | 54 |
return VMTest.create(ServiceLoaderTest.class); |
jaroslav@576 | 55 |
} |
jaroslav@576 | 56 |
|
jaroslav@576 | 57 |
|
jaroslav@576 | 58 |
@ServiceProvider(service = IOException.class) |
jaroslav@576 | 59 |
public static class MyException extends IOException { |
jaroslav@576 | 60 |
} |
jaroslav@576 | 61 |
} |