|
|
@ -260,50 +260,50 @@ public class TestChooser extends JDialog { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run(){ |
|
|
|
public void run(){ |
|
|
|
for (int i = 0; i < appClass.size(); i++) { |
|
|
|
for (int i = 0; i < appClass.size(); i++) { |
|
|
|
Class<?> clazz = (Class)appClass.get(i); |
|
|
|
Class<?> clazz = (Class)appClass.get(i); |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (LegacyApplication.class.isAssignableFrom(clazz)) { |
|
|
|
if (LegacyApplication.class.isAssignableFrom(clazz)) { |
|
|
|
Object app = clazz.newInstance(); |
|
|
|
Object app = clazz.newInstance(); |
|
|
|
if (app instanceof SimpleApplication) { |
|
|
|
if (app instanceof SimpleApplication) { |
|
|
|
final Method settingMethod = clazz.getMethod("setShowSettings", boolean.class); |
|
|
|
final Method settingMethod = clazz.getMethod("setShowSettings", boolean.class); |
|
|
|
settingMethod.invoke(app, showSetting); |
|
|
|
settingMethod.invoke(app, showSetting); |
|
|
|
} |
|
|
|
} |
|
|
|
final Method mainMethod = clazz.getMethod("start"); |
|
|
|
final Method mainMethod = clazz.getMethod("start"); |
|
|
|
mainMethod.invoke(app); |
|
|
|
mainMethod.invoke(app); |
|
|
|
Field contextField = LegacyApplication.class.getDeclaredField("context"); |
|
|
|
Field contextField = LegacyApplication.class.getDeclaredField("context"); |
|
|
|
contextField.setAccessible(true); |
|
|
|
contextField.setAccessible(true); |
|
|
|
JmeContext context = null; |
|
|
|
JmeContext context = null; |
|
|
|
while (context == null) { |
|
|
|
while (context == null) { |
|
|
|
context = (JmeContext) contextField.get(app); |
|
|
|
context = (JmeContext) contextField.get(app); |
|
|
|
Thread.sleep(100); |
|
|
|
Thread.sleep(100); |
|
|
|
} |
|
|
|
} |
|
|
|
while (!context.isCreated()) { |
|
|
|
while (!context.isCreated()) { |
|
|
|
Thread.sleep(100); |
|
|
|
Thread.sleep(100); |
|
|
|
} |
|
|
|
} |
|
|
|
while (context.isCreated()) { |
|
|
|
while (context.isCreated()) { |
|
|
|
Thread.sleep(100); |
|
|
|
Thread.sleep(100); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
final Method mainMethod = clazz.getMethod("main", (new String[0]).getClass()); |
|
|
|
final Method mainMethod = clazz.getMethod("main", (new String[0]).getClass()); |
|
|
|
mainMethod.invoke(clazz, new Object[]{new String[0]}); |
|
|
|
mainMethod.invoke(clazz, new Object[]{new String[0]}); |
|
|
|
} |
|
|
|
} |
|
|
|
// wait for destroy
|
|
|
|
// wait for destroy
|
|
|
|
System.gc(); |
|
|
|
System.gc(); |
|
|
|
} catch (IllegalAccessException ex) { |
|
|
|
} catch (IllegalAccessException ex) { |
|
|
|
logger.log(Level.SEVERE, "Cannot access constructor: "+clazz.getName(), ex); |
|
|
|
logger.log(Level.SEVERE, "Cannot access constructor: "+clazz.getName(), ex); |
|
|
|
} catch (IllegalArgumentException ex) { |
|
|
|
} catch (IllegalArgumentException ex) { |
|
|
|
logger.log(Level.SEVERE, "main() had illegal argument: "+clazz.getName(), ex); |
|
|
|
logger.log(Level.SEVERE, "main() had illegal argument: "+clazz.getName(), ex); |
|
|
|
} catch (InvocationTargetException ex) { |
|
|
|
} catch (InvocationTargetException ex) { |
|
|
|
logger.log(Level.SEVERE, "main() method had exception: "+clazz.getName(), ex); |
|
|
|
logger.log(Level.SEVERE, "main() method had exception: "+clazz.getName(), ex); |
|
|
|
} catch (InstantiationException ex) { |
|
|
|
} catch (InstantiationException ex) { |
|
|
|
logger.log(Level.SEVERE, "Failed to create app: "+clazz.getName(), ex); |
|
|
|
logger.log(Level.SEVERE, "Failed to create app: "+clazz.getName(), ex); |
|
|
|
} catch (NoSuchMethodException ex){ |
|
|
|
} catch (NoSuchMethodException ex){ |
|
|
|
logger.log(Level.SEVERE, "Test class doesn't have main method: "+clazz.getName(), ex); |
|
|
|
logger.log(Level.SEVERE, "Test class doesn't have main method: "+clazz.getName(), ex); |
|
|
|
} catch (Exception ex) { |
|
|
|
} catch (Exception ex) { |
|
|
|
logger.log(Level.SEVERE, "Cannot start test: "+clazz.getName(), ex); |
|
|
|
logger.log(Level.SEVERE, "Cannot start test: "+clazz.getName(), ex); |
|
|
|
ex.printStackTrace(); |
|
|
|
ex.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}).start(); |
|
|
|
}).start(); |
|
|
|
} |
|
|
|
} |
|
|
|