package com.note.testcases;
/**
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Alejandro Gómez Morón
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Platform;
import org.openqa.selenium.ScreenOrientation;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.TargetLocator;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.html5.Location;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.ExecuteMethod;
import org.openqa.selenium.remote.RemoteWebDriver; import com.google.gson.JsonObject; import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.MultiTouchAction;
import io.appium.java_client.TouchAction;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType; /**
* Appium handler driver to work with any appium implementation iOS/Android and working with
* the app independent of the app (native or hybrid).
*
* @author Alejandro Gomez <agommor@gmail.com>
* @author Ivan Gomez de Leon <igomez@emergya.com>
*
*/
public class DevTest { /**
* Log instance.
*/
private final static Logger LOGGER = Logger.getLogger(DevTest.class); /**
* Key to be used in the {@link DesiredCapabilities} checking.
*/
private static String PLATFORM_TYPE_KEY = "platformName"; /**
* Key to be used in the {@link DesiredCapabilities} checking.
*/
private static String APP_KEY = "app"; /**
* Key to be used in the {@link DesiredCapabilities} checking.
*/
private static String APP_HYBRID = "appHybrid"; /**
* Parameter to have always the main window.
*/
private String mainWindow; /**
* Involved instance (decorator pattern).
*/
private AppiumDriver<MobileElement> driver; /**
* Flag to know if we're testing an hybrid app.
*/
private boolean isAnHybridApp; /**
* Builder method to create {@link DevTest} instances.
* @param remoteAddress to be used.
* @param desiredCapabilities to be used.
* @return an {@link DevTest} instance with the custom implementation.
*/
public static DevTest buildInstance(URL remoteAddress, DesiredCapabilities desiredCapabilities) {
DevTest instance = null; // getting app path (if it's exists)
Object appCapability = desiredCapabilities.getCapability(APP_KEY);
if (appCapability != null && appCapability instanceof String) {
String appPath = (String) appCapability;
File file = new File(appPath);
if (file.exists()) {
desiredCapabilities.setCapability(APP_KEY, file.getAbsolutePath());
} else {
LOGGER.error("The app was defined but it cannot be found in " + appPath);
}
} AppiumDriver<MobileElement> driver = null; // building the instance
if (isIOS(desiredCapabilities)) {
driver = new IOSDriver<MobileElement>(remoteAddress, desiredCapabilities);
} else if (isAndroid(desiredCapabilities)) {
driver = new AndroidDriver<MobileElement>(remoteAddress, desiredCapabilities);
} else {
// TODO: work on it. Nowadays just iOS and android are supported by this handler.
driver = new AndroidDriver<MobileElement>(remoteAddress, desiredCapabilities);
} // implicit wait for slow devices
driver.manage().timeouts().implicitlyWait(35, TimeUnit.SECONDS);
Boolean isHybrid = false;
Object appHybrid = desiredCapabilities.getCapability(APP_HYBRID);
desiredCapabilities.setCapability(MobileCapabilityType.TAKES_SCREENSHOT, "true");
if (appHybrid != null && appHybrid instanceof Boolean) {
isHybrid = (Boolean) appHybrid;
if (isHybrid) {
// if the app is hybrid, we have to wait until the WEBVIEW context handler exists
driver = switchToWebViewContext(driver);
}
}
// now the driver is configured, we create the wrapper
instance = new DevTest(driver, isHybrid);
return instance;
} /**
* This method switches to webview context (for hybrid apps).
* @param driver to be switched to.
* @param
* @return modified driver instance.
*/
private static AppiumDriver<MobileElement> switchToWebViewContext(AppiumDriver<MobileElement> driver) {
long start = new Date().getTime();
long end = new Date().getTime();
long limit = 15; // waiting no more than 15 seconds to switch to a WEBVIEW context
boolean switched = false;
int maxRetries = 5;
// for HYBRID APPS, switching the context
do {
sleepFor(1);
Set<String> contextHandles = driver.getContextHandles();
for (String context : contextHandles) {
if (context.contains("WEBVIEW")) {
// the context change needs some extra time
int retries = 0;
do {
sleepFor(5);
try {
driver.context(context);
} catch (Exception ex) {
LOGGER.warn("An error occurred switching the context. Trying again...");
}
retries++;
} while (!driver.getContext().contains("WEBVIEW") && retries < maxRetries);
switched = true;
}
}
end = new Date().getTime();
} while (!switched && (start + (limit * 1000)) > end); if (!switched) {
LOGGER.error("After waiting for " + limit
+ " seconds, the driver couldn't switched to the WEBVIEW context, so the test of the hybrid application will failed!");
}
return driver;
} /**
* Method to know if the driver is ready to test hybrid / native apps.
* @return true if the driver is well configured or false otherwise.
*/
public boolean isDriverReadyToTest() {
boolean ready = false;
if (this.driver != null) {
if (this.isAnHybridApp) {
if (this.getContext().contains("WEBVIEW")) {
ready = true;
}
} else {
if (!this.getContext().contains("WEBVIEW")) {
ready = true;
}
}
}
return ready;
} /**
* Private constructor to avoid instances creation without using the buildInstance method.
* @param driver an {@link AppiumDriver} instance.
* @param isHybrid flag to know if it's an hybrid app.
*/
private DevTest(AppiumDriver<MobileElement> driver, Boolean isHybridApp) {
this.driver = driver;
this.isAnHybridApp = isHybridApp;
this.mainWindow = this.driver.getWindowHandle();
} /**
* It switches to the main window if it's an hybrid app.
*/
public void switchToMainWindow() {
if (this.isAnHybridApp && StringUtils.isNotBlank(this.mainWindow)
&& !this.driver.getWindowHandle().equals(this.mainWindow)) {
this.driver.switchTo().window(this.mainWindow);
}
} /**
* It checks if it's an iOS platform.
* @param desiredCapabilities to check if the SO is iOS.
* @return true if it's an iOS testing.
*/
private static boolean isIOS(Capabilities desiredCapabilities) {
return is(desiredCapabilities, "ios");
} /**
* It checks if it's an Android platform.
* @param desiredCapabilities to check if the SO is iOS.
* @return true if it's an iOS testing.
*/
private static boolean isAndroid(Capabilities desiredCapabilities) {
return is(desiredCapabilities, Platform.ANDROID.name());
} /**
* It checks if it's an iOS platform.
* @param desiredCapabilities to check if the SO is iOS.
* @param type to check.
* @return true if it's an iOS testing.
*/
private static boolean is(Capabilities desiredCapabilities, String type) {
boolean is = false;
if (desiredCapabilities != null) {
Object capability = desiredCapabilities.getCapability(PLATFORM_TYPE_KEY);
if (capability != null && capability instanceof String) {
if (type != null && type.equalsIgnoreCase(((String) capability))) {
is = true;
}
}
}
return is;
} /**
* This method waits for the {@link MobileElement} described by the {@By} selector with a timeout of seconds.
* @param selector to get the element.
* @param seconds to wait for (timeout).
* @param message to send to the log if something happens.
*/
public void waitFor(By selector, long seconds, String message) {
LOGGER.info("Waiting for " + selector.toString());
long start = new Date().getTime();
long end = start + (seconds * 1000);
long now = new Date().getTime();
MobileElement element = null;
do {
element = this.findElement(selector);
now = new Date().getTime();
} while (element == null && now <= end); if (element == null) {
if (message != null && "".equals(message.trim())) {
LOGGER.error("After waiting " + seconds + " seconds for the element " + selector.toString()
+ ", the element is missing!. Custom message: " + message);
} else {
LOGGER.error("After waiting " + seconds + " seconds for the element " + selector.toString()
+ ", the element is missing!");
}
}
} /**
* This method waits for the {@link MobileElement} described by the {@By} selector with a timeout of seconds.
* @param selector to get the element.
* @param seconds to wait for (timeout).
*/
public void waitFor(By selector, long seconds) {
this.waitFor(selector, seconds, null);
} /**
* This method waits for the {@link MobileElement} until it's visible described by the {@By} selector with a timeout of seconds.
* @param selector to get the element.
* @param seconds to wait for (timeout).
* @param message to send to the log if something happens.
*/
public void waitUntilVisible(By selector, long seconds, String message) {
LOGGER.info("Waiting for " + selector.toString());
this.waitFor(selector, seconds, message);
MobileElement element = this.findElement(selector);
if (element != null && !element.isDisplayed()) {
LOGGER.error("After waiting " + seconds + " seconds for the element " + selector.toString()
+ " exists in the DOM but is not displayed.");
}
} /**
* It sleeps the driver for n seconds.
* @param seconds to be slept.
*/
public void wait(int seconds) {
long start = new Date().getTime();
try {
driver.wait(seconds * 1000);
} catch (InterruptedException e) {
long end = new Date().getTime();
do {
end = new Date().getTime();
} while ((start + (seconds * 1000)) > end);
}
} /**
* It sleeps the process for n seconds.
* @param seconds to be slept.
*/
public void sleep(long seconds) {
sleepFor(seconds);
} /**
* It sleeps the process for n seconds.
* @param seconds to be slept.
*/
public static void sleepFor(long seconds) {
long start = new Date().getTime();
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
long end = new Date().getTime();
do {
end = new Date().getTime();
} while ((start + (seconds * 1000)) > end);
}
} /**
* @see {@link AppiumDriver#findElements(By)}.
*/
public List<MobileElement> findElements(By by) {
List<MobileElement> elements = null;
try {
elements = driver.findElements(by);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsById(String)}.
*/
public List<MobileElement> findElementsById(String id) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsById(id);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsByLinkText(String)}.
*/
public List<MobileElement> findElementsByLinkText(String using) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsByLinkText(using);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsByPartialLinkText(String)}.
*/
public List<MobileElement> findElementsByPartialLinkText(String using) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsByPartialLinkText(using);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsByTagName(String)}.
*/
public List<MobileElement> findElementsByTagName(String using) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsByTagName(using);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsByName(String)}.
*/
public List<MobileElement> findElementsByName(String using) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsByName(using);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsByClassName(String)}.
*/
public List<MobileElement> findElementsByClassName(String using) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsByClassName(using);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsByCssSelector(String)}.
*/
public List<MobileElement> findElementsByCssSelector(String using) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsByCssSelector(using);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsByXPath(String)}.
*/
public List<MobileElement> findElementsByXPath(String using) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsByXPath(using);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link AppiumDriver#findElementsByAccessibilityId(String)}.
*/
public List<MobileElement> findElementsByAccessibilityId(String using) {
List<MobileElement> elements = null;
try {
elements = driver.findElementsByAccessibilityId(using);
} catch (Exception ex) {
elements = new ArrayList<MobileElement>();
}
return elements;
} /**
* @see {@link DefaultGenericMobileDriver#findElement(By)}.
*/
public MobileElement findElement(By by) {
MobileElement element;
try {
element = driver.findElement(by);
} catch (Exception ex) {
element = null;
}
return element;
} /**
* @see {@link DefaultGenericMobileDriver#findElementById(String)}.
*/
public MobileElement findElementById(String id) {
MobileElement element;
try {
element = driver.findElementById(id);
} catch (Exception ex) {
element = null;
}
return element;
} /**
* @see {@link DefaultGenericMobileDriver#findElementByLinkText(String)}.
*/
public MobileElement findElementByLinkText(String using) {
MobileElement element;
try {
element = driver.findElementByLinkText(using);
} catch (Exception ex) {
element = null;
}
return element;
} /**
* @see {@link DefaultGenericMobileDriver#findElementByPartialLinkText(String)}.
*/
public MobileElement findElementByPartialLinkText(String using) {
MobileElement element;
try {
element = driver.findElementByPartialLinkText(using);
} catch (Exception ex) {
element = null;
}
return element;
} /**
* @see {@link DefaultGenericMobileDriver#findElementByTagName(String)}.
*/
public MobileElement findElementByTagName(String using) {
MobileElement element;
try {
element = driver.findElementByTagName(using);
} catch (Exception ex) {
element = null;
}
return element;
} /**
* @see {@link DefaultGenericMobileDriver#findElementByName(String)}.
*/
public MobileElement findElementByName(String using) {
MobileElement element;
try {
element = driver.findElementByName(using);
} catch (Exception ex) {
element = null;
}
return element;
} /**
* @see {@link AppiumDriver#getExecuteMethod()}.
*/
public ExecuteMethod getExecuteMethod() {
return driver.getExecuteMethod();
} /**
* @see {@link AppiumDriver#resetApp()}.
*/
public void resetApp() {
driver.resetApp();
} /**
* @see {@link AppiumDriver#isAppInstalled(String)}.
*/
public boolean isAppInstalled(String bundleId) {
return driver.isAppInstalled(bundleId);
} /**
* @see {@link AppiumDriver#installApp(String)}.
*/
public void installApp(String appPath) {
driver.installApp(appPath);
} /**
* @see {@link AppiumDriver#removeApp(String)}.
*/
public void removeApp(String bundleId) {
driver.removeApp(bundleId);
} /**
* @see {@link AppiumDriver#launchApp()}.
*/
public void launchApp() {
driver.launchApp();
} /**
* @see {@link AppiumDriver#closeApp()}.
*/
public void closeApp() {
driver.closeApp();
} /**
* @see {@link AppiumDriver#runAppInBackground(int)}.
*/
public void runAppInBackground(int seconds) {
driver.runAppInBackground(seconds);
} /**
* @see {@link AppiumDriver#hideKeyboard()}.
*/
public void hideKeyboard() {
driver.hideKeyboard();
} /**
* @see {@link AppiumDriver#pullFile(String)}.
*/
public byte[] pullFile(String remotePath) {
return driver.pullFile(remotePath);
} /**
* @see {@link AppiumDriver#pullFolder(String)}.
*/
public byte[] pullFolder(String remotePath) {
return driver.pullFolder(remotePath);
} /**
* @see {@link AppiumDriver#performTouchAction(TouchAction)}.
*/
public TouchAction performTouchAction(TouchAction touchAction) {
return driver.performTouchAction(touchAction);
} /**
* @see {@link AppiumDriver#performMultiTouchAction(MultiTouchAction)}.
*/
public void performMultiTouchAction(MultiTouchAction multiAction) {
driver.performMultiTouchAction(multiAction);
} /**
* This method is the same than {@link DevTest#tap(int, WebElement, int)} but using a {@link MobileElement} object.
*/
public void tap(int fingers, MobileElement element, int duration) {
int xPosition = element.getLocation().getX() + element.getSize().getWidth() / 2;
int yPosition = element.getLocation().getY() + element.getSize().getHeight() / 2;
this.tap(fingers, xPosition, yPosition, duration);
} /**
* @see {@link AppiumDriver#tap(int, WebElement, int)}.
*/
public void tap(int fingers, WebElement element, int duration) {
driver.tap(fingers, element, duration);
} /**
* @see {@link AppiumDriver#tap(int, int, int, int)}.
*/
public void tap(int fingers, int x, int y, int duration) {
driver.tap(fingers, x, y, duration);
} /**
* @see {@link AppiumDriver#swipe(int, int, int, int, int)}.
*/
public void swipe(int startx, int starty, int endx, int endy, int duration) {
driver.swipe(startx, starty, endx, endy, duration);
} /**
* @see {@link AppiumDriver#pinch(WebElement)}.
*/
public void pinch(WebElement el) {
driver.pinch(el);
} /**
* @see {@link AppiumDriver#pinch(int, int)}.
*/
public void pinch(int x, int y) {
driver.pinch(x, y);
} /**
* @see {@link AppiumDriver#zoom(WebElement)}.
*/
public void zoom(WebElement el) {
driver.zoom(el);
} /**
* @see {@link AppiumDriver#zoom(int, int)}.
*/
public void zoom(int x, int y) {
driver.zoom(x, y);
} /**
* @see {@link AppiumDriver#getSettings()}.
*/
public JsonObject getSettings() {
return driver.getSettings();
} /**
* @see {@link AppiumDriver#context(String)}.
*/
public WebDriver context(String name) {
return driver.context(name);
} /**
* @see {@link AppiumDriver#getContextHandles()}.
*/
public Set<String> getContextHandles() {
return driver.getContextHandles();
} /**
* @see {@link AppiumDriver#getContext()}.
*/
public String getContext() {
return driver.getContext();
} /**
* @see {@link AppiumDriver#rotate(ScreenOrientation)}.
*/
public void rotate(ScreenOrientation orientation) {
driver.rotate(orientation);
} /**
* @see {@link AppiumDriver#getOrientation()}.
*/
public ScreenOrientation getOrientation() {
return driver.getOrientation();
} /**
* @see {@link AppiumDriver#location()}.
*/
public Location location() {
return driver.location();
} /**
* @see {@link AppiumDriver#setLocation(Location)}.
*/
public void setLocation(Location location) {
driver.setLocation(location);
} /**
* @see {@link AppiumDriver#getAppStrings()}.
*/
public Map<String, String> getAppStrings() {
return driver.getAppStringMap();
} /**
* @see {@link AppiumDriver#getAppStrings(String)}.
*/
public Map<String, String> getAppStringMap(String language) {
return driver.getAppStringMap(language);
} /**
* @see {@link AppiumDriver#getRemoteAddress()}.
*/
public URL getRemoteAddress() {
return driver.getRemoteAddress();
} /**
* @see {@link RemoteWebDriver#quit()}.
*/
public void quit() {
driver.quit();
} /**
* @see {@link RemoteWebDriver#getWindowHandles()}
*/
public Set<String> getWindowHandles() {
return driver.getWindowHandles();
} /**
* @see {@link RemoteWebDriver#switchTo()}
*/
public TargetLocator switchTo() {
return driver.switchTo();
} /**
* @see {@link RemoteWebDriver#getWindowHandle()}
*/
public String getWindowHandle() {
return driver.getWindowHandle();
} /**
* Adding support to execute JavaScript codes.
* @param script to be executed.
* @return the result of the execution.
*/
public Object executeJavaScript(String script) {
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
Object output = jsExecutor.executeScript(script);
return output;
} /**
* Providing a way to get the native driver.
* @return the native {@link AppiumDriver} instance.
*/
public AppiumDriver<MobileElement> getDriver() {
return driver;
} }

app hybrid的更多相关文章

  1. 会写网页 就会写手机APP -- Hybrid Mobile Apps for ASP.NET Developers

    您好,这篇文章是我的BLOG发出,原始出处在此: 会写网页 就会写手机APP -- Hybrid Mobile Apps for ASP.NET Developers http://www.dotbl ...

  2. Hybrid App—Hybrid App开发模式介绍和各种开发模式对比

    什么是Hybrid App 最开的App开发只有原生开发这个概念,但自从H5广泛流行后,一种效率更高的开发模式Hybrid应运而生,它就是"Hybrid模式".Hybrid APP ...

  3. Native App, Hybrid App, Web App对比

    Native App,Hybrid App和Web App简介 目前基本所有的移动互联网app可以分为三类:Native App,Hybrid App和Web App. Native App是基于智能 ...

  4. “榕树下·那年”移动app ( hybrid ) 开发总结

        榕树下网站本身的技术人员并不多,所以app开发的任务就到了母公司盛大文学这边.       盛大文学无线业务中心负责这次具体开发任务.       一如既往的,开发的情况是:时间紧,任务重,人 ...

  5. Jquery API Hybrid APP调研

    http://jquery.cuishifeng.cn/source.html   hybrid app Hybrid App(混合模式移动应用)是指介于web-app.native-app这两者之间 ...

  6. 聊聊Web App、Hybrid App与Native App的设计差异

    目前主流应用程序大体分为三类:Web App.Hybrid App. Native App. 一.Web App.Hybrid App.Native App 纵向对比 首先,我们来看看什么是 Web ...

  7. 移动开发 Native APP、Hybrid APP和Web APP介绍

    高速区分定义: Native App 以基于智能手机本地操作系统如IOS.Android.WP并使用原生程式(SDK)编写执行的须要用户安装使用的第三方应用程序; Web APP 以HTML+JS+C ...

  8. Hybrid App(一)App开发选型

    1.几种app开发模式概述 Native App 即传统的原生APP开发模式,Android基于Java语言,底层调用Google的 API;iOS基于OC或者Swift语言,底层调用App官方提供的 ...

  9. 超赞!聊聊WEB APP、HYBRID APP与NATIVE APP的设计差异

    编者按:这3类主流应用你都了解吗?设计师除了要有视觉功夫,对不同形式的APP也应当了然于胸,今天百度的同学写了一篇非常全面的总结,帮你迅速搞定3类主流APP的设计方法,附带一大波避雷针,带你巧妙跳过A ...

随机推荐

  1. Linux下面kettle的部署

    一直以来服务器是linux系统,但是感觉linux图形化不强,于是从接触kettle以来都是在windows系统操作ETL的设计和处理.现在需要在linux中查看一下kettle资源库是否连接正常,以 ...

  2. Caused by: com.alibaba.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2016-07-20 16:27:34.873, end time: 2016-07-20 16:27:39.895, client elapsed: 0 ms

    方案一: 重启dubbo连接 zookeeper 方案二: 经压测,greys跟踪得知,是dubbo的monitor的问题.主要超时的方法是dubbo的getIP方法,monitor每次收集数据的时候 ...

  3. SMTP 协议系列一

    解说一下DOS下telnet命令发送邮件 步骤,以我的163邮箱为例 1.開始-->cmd 进入到dos里面 2.输入telnet  smtp.163.com  25 C: \Users \Ad ...

  4. freemarker 模板开发入门

    数据模型 scalars标量:从根 root 開始指定它的路径,每级之间用点来分隔. 如:whatnot.fruits sequences 序列:使用数组的方括号方式来訪问一个序列的子变量. 如:an ...

  5. VB.NET版机房收费系统---外观层怎样写

    外观设计模式.<大话设计模式>第103页具体解说,不记得这块知识的小伙伴能够翻阅翻阅,看过设计模式,敲过书上的样例,仅仅是学习的第一步,接着,假设在我们的项目中灵活应用,把设计模式用出花儿 ...

  6. sqlplus的使用

    1.连接数据库 sqlplus / as sysdba 2.连接到远程数据库 sqlplus 用户名/密码@服务命名 3.遇到&会当成变量,一般是不需要的,可以关掉 SQL> set d ...

  7. python之函数用法file()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法file() #file() #说明:file()内建函数它的功能等于open(),但 ...

  8. grep -A -B -C

    Linux中grep/egrep查找命令 grep --color    ###颜色着重显示命中的文件及文件件 -n  ###显示行号  number -i   ###忽略大小写 ignore -c ...

  9. CSS3+JS 实现的便签应用

    概述 利用HTML5新增的 locationStorage 实现的便签应用,没有使用 JQuery,主要是为了练习原生JS的使用,采用响应式开发,在手机端和桌面端都有良好的体验,而且使用CSS3添加了 ...

  10. nginx 配置web 虚拟文件夹 而且codeIgniter,thinkphp 重定向url 地址

    nginx 配置虚拟文件夹而且url 重定向 server { #侦听80port listen 8090; #定义使用www.xx.com訪问 server_name 127.0.0.1; #设定本 ...