@Test public void shouldInitDriver() throws Exception { SelendroidConfiguration conf = new SelendroidConfiguration(); conf.addSupportedApp(new File(APK_FILE).getAbsolutePath()); SelendroidStandaloneDriver driver = getSelendroidStandaloneDriver(); driver.initApplicationsUnderTest(conf); assertThatTestAppHasBeenSuccessfullyRegistered(driver); }
void initApplicationsUnderTest(SelendroidConfiguration serverConfiguration) throws AndroidSdkException { if (serverConfiguration == null) { throw new SelendroidException("Configuration error - serverConfiguration can't be null."); } this.serverConfiguration = serverConfiguration; for (String appPath : serverConfiguration.getSupportedApps()) { File file = new File(appPath); if (file.exists()) { addToAppsStore(file); } else { log.severe("Ignoring app because it was not found: " + file.getAbsolutePath()); } } if (!serverConfiguration.isNoWebViewApp()) { try { File androidAPK = androidDriverAPKBuilder.extractAndroidDriverAPK(); if(serverConfiguration != null && serverConfiguration.isDeleteTmpFiles()) { androidAPK.deleteOnExit(); } AndroidApp app = selendroidApkBuilder.resignApp(androidAPK); appsStore.put(BrowserType.ANDROID, app); } catch (Exception e) { throw new RuntimeException(e); } } }
SelendroidStandaloneDriver implements ServerDetails, InstrumentationProcessListener { void initApplicationsUnderTest(SelendroidConfiguration serverConfiguration) throws AndroidSdkException { if (serverConfiguration == null) { throw new SelendroidException("Configuration error - serverConfiguration can't be null."); } this.serverConfiguration = serverConfiguration; for (String appPath : serverConfiguration.getSupportedApps()) { File file = new File(appPath); if (file.exists()) { addToAppsStore(file); } else { log.severe("Ignoring app because it was not found: " + file.getAbsolutePath()); } } if (!serverConfiguration.isNoWebViewApp()) { try { File androidAPK = androidDriverAPKBuilder.extractAndroidDriverAPK(); if(serverConfiguration != null && serverConfiguration.isDeleteTmpFiles()) { androidAPK.deleteOnExit(); } AndroidApp app = selendroidApkBuilder.resignApp(androidAPK); appsStore.put(BrowserType.ANDROID, app); } catch (Exception e) { throw new RuntimeException(e); } } } }
SelendroidStandaloneDriver implements ServerDetails, InstrumentationProcessListener { void initApplicationsUnderTest(SelendroidConfiguration serverConfiguration) throws AndroidSdkException { if (serverConfiguration == null) { throw new SelendroidException("Configuration error - serverConfiguration can't be null."); } this.serverConfiguration = serverConfiguration; for (String appPath : serverConfiguration.getSupportedApps()) { File file = new File(appPath); if (file.exists()) { addToAppsStore(file); } else { log.severe("Ignoring app because it was not found: " + file.getAbsolutePath()); } } if (!serverConfiguration.isNoWebViewApp()) { try { File androidAPK = androidDriverAPKBuilder.extractAndroidDriverAPK(); if(serverConfiguration != null && serverConfiguration.isDeleteTmpFiles()) { androidAPK.deleteOnExit(); } AndroidApp app = selendroidApkBuilder.resignApp(androidAPK); appsStore.put(BrowserType.ANDROID, app); } catch (Exception e) { throw new RuntimeException(e); } } } SelendroidStandaloneDriver(SelendroidConfiguration serverConfiguration);   SelendroidStandaloneDriver(SelendroidServerBuilder builder, DeviceManager deviceManager,
                             AndroidDriverAPKBuilder androidDriverAPKBuilder); }
SelendroidStandaloneDriver implements ServerDetails, InstrumentationProcessListener { void initApplicationsUnderTest(SelendroidConfiguration serverConfiguration) throws AndroidSdkException { if (serverConfiguration == null) { throw new SelendroidException("Configuration error - serverConfiguration can't be null."); } this.serverConfiguration = serverConfiguration; for (String appPath : serverConfiguration.getSupportedApps()) { File file = new File(appPath); if (file.exists()) { addToAppsStore(file); } else { log.severe("Ignoring app because it was not found: " + file.getAbsolutePath()); } } if (!serverConfiguration.isNoWebViewApp()) { try { File androidAPK = androidDriverAPKBuilder.extractAndroidDriverAPK(); if(serverConfiguration != null && serverConfiguration.isDeleteTmpFiles()) { androidAPK.deleteOnExit(); } AndroidApp app = selendroidApkBuilder.resignApp(androidAPK); appsStore.put(BrowserType.ANDROID, app); } catch (Exception e) { throw new RuntimeException(e); } } } SelendroidStandaloneDriver(SelendroidConfiguration serverConfiguration);   SelendroidStandaloneDriver(SelendroidServerBuilder builder, DeviceManager deviceManager,
                             AndroidDriverAPKBuilder androidDriverAPKBuilder); void addToAppsStore(File file); @Override String getServerVersion(); @Override String getCpuArch(); @Override String getOsVersion(); @Override String getOsName(); String createNewTestSession(JSONObject caps); String createNewTestSession(JSONObject caps, Integer retries); List<ActiveSession> getActiveSessions(); boolean isValidSession(String sessionId); void stopSession(String sessionId); void quitSelendroid(); SelendroidCapabilities getSessionCapabilities(String sessionId); ActiveSession getActiveSession(String sessionId); @Override synchronized JSONArray getSupportedApps(); @Override synchronized JSONArray getSupportedDevices(); byte[] takeScreenshot(String sessionId); void setEventListener(SelendroidStandaloneDriverEventListener eventListener); @Override void onInstrumentationProcessComplete(String output); @Override void onInstrumentationProcessFailed(String output, Exception error); }
SelendroidStandaloneDriver implements ServerDetails, InstrumentationProcessListener { void initApplicationsUnderTest(SelendroidConfiguration serverConfiguration) throws AndroidSdkException { if (serverConfiguration == null) { throw new SelendroidException("Configuration error - serverConfiguration can't be null."); } this.serverConfiguration = serverConfiguration; for (String appPath : serverConfiguration.getSupportedApps()) { File file = new File(appPath); if (file.exists()) { addToAppsStore(file); } else { log.severe("Ignoring app because it was not found: " + file.getAbsolutePath()); } } if (!serverConfiguration.isNoWebViewApp()) { try { File androidAPK = androidDriverAPKBuilder.extractAndroidDriverAPK(); if(serverConfiguration != null && serverConfiguration.isDeleteTmpFiles()) { androidAPK.deleteOnExit(); } AndroidApp app = selendroidApkBuilder.resignApp(androidAPK); appsStore.put(BrowserType.ANDROID, app); } catch (Exception e) { throw new RuntimeException(e); } } } SelendroidStandaloneDriver(SelendroidConfiguration serverConfiguration);   SelendroidStandaloneDriver(SelendroidServerBuilder builder, DeviceManager deviceManager,
                             AndroidDriverAPKBuilder androidDriverAPKBuilder); void addToAppsStore(File file); @Override String getServerVersion(); @Override String getCpuArch(); @Override String getOsVersion(); @Override String getOsName(); String createNewTestSession(JSONObject caps); String createNewTestSession(JSONObject caps, Integer retries); List<ActiveSession> getActiveSessions(); boolean isValidSession(String sessionId); void stopSession(String sessionId); void quitSelendroid(); SelendroidCapabilities getSessionCapabilities(String sessionId); ActiveSession getActiveSession(String sessionId); @Override synchronized JSONArray getSupportedApps(); @Override synchronized JSONArray getSupportedDevices(); byte[] takeScreenshot(String sessionId); void setEventListener(SelendroidStandaloneDriverEventListener eventListener); @Override void onInstrumentationProcessComplete(String output); @Override void onInstrumentationProcessFailed(String output, Exception error); static final String WD_RESP_KEY_VALUE; static final String WD_RESP_KEY_STATUS; static final String WD_RESP_KEY_SESSION_ID; static final String APP_BASE_PACKAGE; static final String APP_ID; }