/** * The test count. */ protected int getTestCount() { return SReflect.isAndroid() ? 6 : 12; }
/** * Create a model loader. * @param extensions The supported file extensions by order of importance. */ public AbstractModelLoader(String[] extensions) { this(extensions, SReflect.isAndroid() ? 12 : 450); }
/** * Check if a file represents a floppy. * Returns false on android. */ public static boolean isFloppyDrive(File file) { return SReflect.isAndroid() ? false : SNonAndroid.isFloppyDrive(file); }
/** * Get the home directory. */ public static File getDefaultDirectory() { // Todo: default directory on android? return SReflect.isAndroid() ? new File(System.getProperty("user.home")) : SNonAndroid.getDefaultDirectory(); }
/** * Get the parent directory. */ public static File getParentDirectory(File file) { // Todo: parent directory on android? return SReflect.isAndroid() ? file.getParentFile() : SNonAndroid.getParentDirectory(file); }
/** * Get the display name (e.g. of a system drive). * Returns null on android. */ public static String getDisplayName(File file) { return SReflect.isAndroid() ? null : SNonAndroid.getDisplayName(file); }
/** * Test if a call is running on a gui (e.g. Swing or Android UI) thread. * Currently returns false on android. */ public static boolean isGuiThread() { // Todo: ask android helper for android UI thread. return SReflect.isAndroid() ? false : SNonAndroid.isGuiThread(); }
/** * Get the home directory. */ public static File getHomeDirectory() { return SReflect.isAndroid() ? new File(System.getProperty("user.home")) : SNonAndroid.getHomeDirectory(); }
/** * Get the files of a directory. */ public static File[] getFiles(File file, boolean hiding) { // Todo: hidden files on android? return SReflect.isAndroid() ? file.listFiles() : SNonAndroid.getFiles(file, hiding); }
/** * Create a component test suite for components contained in a given path. * @param path The path to look for test cases in. * @param root The classpath root corresponding to the path. * @param excludes Files to exclude (if a pattern is contained in file path). */ public ComponentTestSuite(File path, File root, String[] excludes) throws Exception { this(path, root, excludes, SReflect.isAndroid() ? 2000000 : BasicService.getLocalDefaultTimeout()*10, true, true); }
public static NodeHelper getInstance() { if(INSTANCE == null) { if(SReflect.isAndroid()) { throw new Error("OpcodeHelper.getInstance() is not implemented for Android."); } else { INSTANCE = new AsmNodeHelper(); } } return INSTANCE; }
public void run() { aborted = true; // System.out.println("Aborting test suite "+getName()+" due to excessive run time (>"+timeout+" ms)."); if (!SReflect.isAndroid()) { runner.stop(new RuntimeException("Aborting test suite "+getName()+" due to excessive run time (>"+timeout+" ms).")); } else { System.err.println("Aborting test suite "+getName()+" due to excessive run time (>"+timeout+" ms)."); System.exit(1); } } }, timeout);
/** * Create a new classloader. */ public DelegationURLClassLoader(IResourceIdentifier rid, URL url, ClassLoader basecl, DelegationURLClassLoader[] delegates) { super(url!=null? new URL[]{url}: new URL[0], // No parent class loader to avoid multiple lookups of unavailable classes (not supported on android) SReflect.isAndroid()? basecl : null); this.rid = rid; this.basecl = basecl; this.delegates = delegates==null? new ArrayList(): SUtil.arrayToList(delegates); this.parents = new ArrayList<DelegationURLClassLoader>(); // addParentClassLoader(parent); // if(rid!=null && rid.getLocalIdentifier()!=null) // System.out.println("delclassloader : "+rid.getLocalIdentifier().getUrl()+" "+SUtil.arrayToString(delegates)+" "+hashCode()); }
public static OpcodeHelper getInstance() { if(INSTANCE == null) { if(SReflect.isAndroid()) { throw new Error("OpcodeHelper.getInstance() is not implemented for Android."); } else { INSTANCE = new AsmOpcodeHelper(); } } return INSTANCE; }
/** Returns a new PropertyChangeManager instance **/ public static PropertyChangeManager createInstance() { if(SReflect.isAndroid()) { return new PropertyChangeManager(); } else { return new PropertyChangeManagerDesktop(); } }
/** * Get the rms codec info that needs to be used for encoding/decoding content. */ public Map<Class<?>, Object[]> getCodecInfo() { Map<Class<?>, Object[]> infos = new HashMap<Class<?>, Object[]>(); Object[] bininfo = new Object[]{getBinaryReadInfo(), getBinaryWriteInfo()}; infos.put(JadexBinaryContentCodec.class, bininfo); // Only use xml if jadex-xml module present (todo: remove compile time dependency) if(!SReflect.isAndroid() && SReflect.classForName0("jadex.xml.reader.Reader", getClass().getClassLoader())!=null) { Object[] xmlinfo = new Object[]{getXMLReadInfo(), getXMLWriteInfo()}; infos.put(JadexXMLContentCodec.class, xmlinfo); } return infos; }
/** * Get the rms codec info that needs to be used for encoding/decoding content. */ public Map<Class<?>, Object[]> getCodecInfo() { Map<Class<?>, Object[]> infos = new HashMap<Class<?>, Object[]>(); Object[] bininfo = new Object[]{getBinaryReadInfo(), getBinaryWriteInfo()}; infos.put(JadexBinaryContentCodec.class, bininfo); // Only use xml if jadex-xml module present (todo: remove compile time dependency) if(!SReflect.isAndroid() && SReflect.classForName0("jadex.xml.reader.Reader", getClass().getClassLoader())!=null) { Object[] xmlinfo = new Object[]{getXMLReadInfo(), getXMLWriteInfo()}; infos.put(JadexXMLContentCodec.class, xmlinfo); } return infos; }
/** * Get the rms codec info that needs to be used for encoding/decoding content. */ public Map<Class<?>, Object[]> getCodecInfo() { Map<Class<?>, Object[]> infos = new HashMap<Class<?>, Object[]>(); Object[] bininfo = new Object[]{getBinaryReadInfo(), getBinaryWriteInfo()}; infos.put(JadexBinaryContentCodec.class, bininfo); // Only use xml if jadex-xml module present (todo: remove compile time dependency) if(!SReflect.isAndroid() && SReflect.classForName0("jadex.xml.reader.Reader", getClass().getClassLoader())!=null) { Object[] xmlinfo = new Object[]{getXMLReadInfo(), getXMLWriteInfo()}; infos.put(JadexXMLContentCodec.class, xmlinfo); } return infos; }
/** * Create a new classloader. */ public DelegationURLClassLoader(IResourceIdentifier rid, ClassLoader basecl, DelegationURLClassLoader[] delegates) { super(rid!=null && rid.getLocalIdentifier()!=null? new URL[]{rid.getLocalIdentifier().getUrl()}: new URL[0], // No parent class loader to avoid multiple lookups of unavailable classes (not supported on android) SReflect.isAndroid() ? basecl : null); this.rid = rid; this.basecl = basecl; this.delegates = delegates==null? new ArrayList(): SUtil.arrayToList(delegates); this.parents = new ArrayList<DelegationURLClassLoader>(); // addParentClassLoader(parent); // System.out.println("d1 : "+rid+" "+SUtil.arrayToString(delegates)); }
/** * Create a new classloader. */ public DelegationURLClassLoader(IResourceIdentifier rid, ClassLoader basecl, DelegationURLClassLoader[] delegates) { super(rid!=null && rid.getLocalIdentifier()!=null? new URL[]{rid.getLocalIdentifier().getUrl()}: new URL[0], // No parent class loader to avoid multiple lookups of unavailable classes (not supported on android) SReflect.isAndroid() ? basecl : null); this.rid = rid; this.basecl = basecl; this.delegates = delegates.clone(); // System.out.println("d1 : "+rid+" "+SUtil.arrayToString(delegates)); }