Commit 6435f65a by shuai

20180925,首次提交

parents
/.classpath
/.project
.idea
.settings
bin/
lib/
log/
testoutput/
test-output/
环境要求:
1. 安装Java jdk 和 ant到本地环境
运行准备和步骤:
1. 确保工程目录下的resources目录下的tmp.xls 文件不存在。
2. 打开data.xls文件,在Input sheet中的填写测试数据(一行数据就是一次接口调用). 可以把data_all.xls里Testcase Sheet里需要执行的测试用例复制到data.xls的Input里(带表头)。清除data.xls里output sheet里的数据。
保存并关闭data.xls.(必须关闭)
3. 选择测试环境配置: 修改env.properties里的环境值。 可以参照env.prod.properties和env.beta.properties
4. 在工程目录下执行,ant。
配置:
1. 测试数据表说明:data.xls
1)数字输入excel会变成字符型。如果参数为数字型,请输入单引号+数字。例如’10000。
2)OpenId,productId,orderId:
OpenId,productId,orderId需要从之前测试步骤执行结果获取的,填写"code". 代码会使用从之前的测试结果中取得的openid,prouductId,orderId。
3)VerifyCode
a. verifycode需要从之前测试步骤执行结果获取本条用例使用的手机号的verifycode的,填写"code_own"
b. verifycode需要从之前测试步骤执行结果获取非本条用例使用的手机号的verifycode的,填写"code_others"
c. verifycode需要从之前测试步骤执行结果获取本条用例使用的手机号的已过期的verifycode的,填写"code_old"
4)statusCode,errcode,errmsg需要填写期望返回值
5) 对于需要全新客户信息的case,需要把cleanDB字段置为Y。
2. env.properties 文件:
isProduct=Y 表示 生产环境运行,不会连接数据做数据插入和检查。注意,生产环境执行时,如果要测插入商品接口,请在data表的字段busiId和busiName填写实际值,不要使用“code”。
查看结果:
1)测试用例全部执行后,打开data.xls文件, 在output里查看结果。
说明: 在非beta环境运行时,测试case运行结束后,会清除数据库中的测试数据。如需不清除数据,需要comment掉:BestbuyGMAPITest.java里afterClass() function下的
this.cleanCustomerInfo();
this.cleanProductsFromDB();
this.cleanOrdersFromDB();
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="EclipseModuleManager">
<libelement value="jar://$MODULE_DIR$/lib/commons-codec-1.9.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-logging-1.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/fluent-hc-4.5.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/httpclient-4.5.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/httpclient-cache-4.5.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/httpclient-win-4.5.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/httpcore-4.4.4.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/httpmime-4.5.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jna-4.1.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jna-platform-4.1.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/json_simple-1.1.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/testng-6.9.12.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/bcprov-ext-jdk15on-154.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/bcprov-jdk15on-154.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-io-2.5.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/commons-lang3-3.4.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/dbunit-2.5.3.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/fluent-hc-4.5.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/groovy-2.4.7.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/gson-2.5.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/hamcrest-all-1.3.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jackson-annotations-2.8.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jackson-core-2.8.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jackson-databind-2.8.2.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/javax.servlet-5.1.12.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/json-path-3.0.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/json-schema-validator-3.0.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/mysql-connector-java-5.1.30-bin.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/spring-beans-4.3.2.RELEASE.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/spring-core-4.3.2.RELEASE.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/spring-security-core-4.1.3.RELEASE.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/spring-security-oauth2-2.0.11.RELEASE.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/spring-web-4.2.6.RELEASE.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jcommander-1.30.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/jxl.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/groovy-json-2.4.6.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/groovy-xml-2.4.6.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/hamcrest-core-1.3.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/hamcrest-library-1.3.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/rest-assured-3.0.1.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/tagsoup-1.2.1.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/com.google.guava_1.6.0.jar!/" />
<libelement value="jar://$MODULE_DIR$/lib/saxon-8.7.jar!/" />
<src_description expected_position="0">
<src_folder value="file://$MODULE_DIR$/src" expected_position="0" />
</src_description>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library name="commons-codec-1.9.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-codec-1.9.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-logging-1.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-logging-1.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="fluent-hc-4.5.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/fluent-hc-4.5.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="httpclient-4.5.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/httpclient-4.5.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="httpclient-cache-4.5.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/httpclient-cache-4.5.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="httpclient-win-4.5.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/httpclient-win-4.5.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="httpcore-4.4.4.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/httpcore-4.4.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="httpmime-4.5.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/httpmime-4.5.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jna-4.1.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jna-4.1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jna-platform-4.1.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jna-platform-4.1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="json_simple-1.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/json_simple-1.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="testng-6.9.12.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/testng-6.9.12.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="bcprov-ext-jdk15on-154.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/bcprov-ext-jdk15on-154.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="bcprov-jdk15on-154.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/bcprov-jdk15on-154.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-io-2.5.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-io-2.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="commons-lang3-3.4.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-lang3-3.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="dbunit-2.5.3.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/dbunit-2.5.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="fluent-hc-4.5.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/fluent-hc-4.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="groovy-2.4.7.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/groovy-2.4.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="gson-2.5.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/gson-2.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="hamcrest-all-1.3.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/hamcrest-all-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jackson-annotations-2.8.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jackson-annotations-2.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jackson-core-2.8.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jackson-core-2.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jackson-databind-2.8.2.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jackson-databind-2.8.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="javax.servlet-5.1.12.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/javax.servlet-5.1.12.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="json-path-3.0.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/json-path-3.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="json-schema-validator-3.0.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/json-schema-validator-3.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="mysql-connector-java-5.1.30-bin.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/mysql-connector-java-5.1.30-bin.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="spring-beans-4.3.2.RELEASE.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/spring-beans-4.3.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="spring-core-4.3.2.RELEASE.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/spring-core-4.3.2.RELEASE.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="spring-security-core-4.1.3.RELEASE.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/spring-security-core-4.1.3.RELEASE.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="spring-security-oauth2-2.0.11.RELEASE.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/spring-security-oauth2-2.0.11.RELEASE.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="spring-web-4.2.6.RELEASE.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/spring-web-4.2.6.RELEASE.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="inheritedJdk" />
<orderEntry type="module-library">
<library name="jcommander-1.30.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jcommander-1.30.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="jxl.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jxl.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="groovy-json-2.4.6.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/groovy-json-2.4.6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="groovy-xml-2.4.6.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/groovy-xml-2.4.6.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="hamcrest-core-1.3.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="hamcrest-library-1.3.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/hamcrest-library-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="rest-assured-3.0.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/rest-assured-3.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="tagsoup-1.2.1.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/tagsoup-1.2.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="com.google.guava_1.6.0.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/com.google.guava_1.6.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="saxon-8.7.jar">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/saxon-8.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
\ No newline at end of file
<project name="auto_test" default="testoutput" basedir=".">
<!-- Define <testng> task -->
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath>
<pathelement location="lib/testng-6.9.12.jar" />
</classpath>
</taskdef>
<property name="testoutputdir" location="testoutput" />
<property name="srcdir" location="src" />
<property name="libdir" location="lib" />
<property name="full-compile" value="true" />
<property name="basedir" value="D:/workspace/auto_test/" />
<path id="classpath.test">
<fileset dir="${libdir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${testoutputdir}" />
<pathelement location="${srcdir}" />
</path>
<target name="clean">
<delete dir="${basedir}/bin" />
</target>
<target name="compile" depends="clean">
<mkdir dir="${basedir}/bin" />
<javac srcdir="${srcdir}" encoding="UTF-8" destdir="${basedir}/bin" verbose="${full-compile}" classpathref="classpath.test" includeantruntime="off" debug="on" debuglevel="lines,vars,source" />
</target>
<path id="classes">
<fileset dir="${libdir}" includes="*jar"/>
<fileset dir="${libdir}" includes="*zip"/>
<pathelement location="${basedir}/bin/"/>
</path>
<target name="runtest" depends="compile">
<testng outputdir="${testoutputdir}" classpathref="classes" delegateCommandSystemProperties="true">
<xmlfileset dir="${basedir}" includes="testng.xml" />
</testng>
</target>
<target name="testoutput" depends="runtest">
<xslt in="${testoutputdir}/testng-results.xml" style="${testoutputdir}/testng-results.xsl" out="${testoutputdir}/index.html ">
<param name="testNgXslt.outputDir" expression="${basedir}/testoutput/" />
<classpath refid="classpath.test" />
</xslt>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Failed suite-ys">
<test name="Default test-ys">
<classes>
<class name="com.puhui.test.RenMai_APITest">
<methods>
<include name="f" invocation-numbers="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 "/>
</methods>
</class>
</classes>
</test>
</suite>
package aoutTestCode;
import java.io.File;
import java.io.FileWriter;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.offcn.TestUnti.Log;
import sun.util.logging.resources.logging;
import freemarker.template.Configuration;
import freemarker.template.Template;
public class MakeCode {
public static void main(String[] args){
MakeCode mc=new MakeCode();
try {
// mc.aoutMakeCode("xml_makecode/MakeCode.xml");
mc.aoutMakeCode("xml_makecode/rgxs-MakeCode.xml");
} catch (Exception e) {
Log.logError("aoutMakeCode_error");
e.printStackTrace();
}
Log.logInfo("aoutMakeCode_ok");
}
public void aoutMakeCode(String path) throws Exception {
Configuration cfg = new Configuration();
cfg.setDirectoryForTemplateLoading(new File("templates"));
Map<String,Object> root = new HashMap<String,Object>();
xmlToftl xml=new xmlToftl(path);
root.put("package_name", xml.getName("package_name"));
root.put("implements_name",xml.getName("implements_name"));
root.put("class_name", xml.getName("class_name"));
root.put("father_class_name", xml.getName("father_class_name"));
root.put("parameters", xml.getNameAndKey("parameters","parameter"));
root.put("initialize_Disable", xml.getBoolean("initialize_Disable"));
root.put("initializes", xml.getNameAndKey("initializes","initialize"));
root.put("handleInput_Disable", xml.getBoolean("handleInput_Disable"));
root.put("handleInput_replaces", xml.getNameAndTypeAndKey("handleInput_replaces","handleInput_replace"));
root.put("handleInputs_Verifications", xml.getNameAndTypeAndKey("handleInputs_Verifications","handleInputs_Verification"));
root.put("SendRequest_Disable", xml.getBoolean("SendRequest_Disable"));
root.put("SendRequest", xml.getName("SendRequest"));
root.put("handleOutput_Disable", xml.getBoolean("handleOutput_Disable"));
root.put("handleOutput_saves", xml.gethandleOutput_save("handleOutput_saves","handleOutput_save","handleOutput"));
root.put("handleOutput_Table", xml.getName("handleOutput_Table"));
root.put("handleOutput_TableKey", xml.getKey("handleOutput_Table"));
Template t1 = cfg.getTemplate("code.ftl");
File directory = new File(".");
String package_name=xml.getName("package_name").replace(".", "\\");
String FilePath = directory.getCanonicalPath() +File.separator+"src"+File.separator+package_name+File.separator;
File Files = new File(FilePath);
File FilesName = new File(FilePath,xml.getName("class_name")+".java");
Log.logInfo("makeFolder:"+(Files.mkdirs()));
Log.logInfo("makeFile:"+(FilesName.createNewFile()));
//显示生成的数据
Writer out = new FileWriter(FilesName);
t1.process(root, out);
out.flush();
out.close();
}
}
package aoutTestCode;
import java.io.File;
import java.util.List;
import java.util.Map;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class ParseXml {
@SuppressWarnings("unused")
private String filePath;
private Document document;
private Element root;
public ParseXml(String filePath) {
super();
this.filePath = filePath;
this.load(filePath);
}
public void load(String filePath) {
File file=new File(filePath);
if(file.exists()){
SAXReader saxReader=new SAXReader();
try {
document=saxReader.read(file);
root = document.getRootElement();
} catch (DocumentException e) {
System.out.println("文件加载异常"+filePath);
}
}else{
System.out.println("文件没找到");
}
}
public Element getElementObject(String elementPath){
return (Element)document.selectSingleNode(elementPath);
}
public String getElementText(String elementPath){
Element element=this.getElementObject(elementPath);
if(element!=null){
return element.getTextTrim();
}else{
return null;
}
}
public List<Map<String,String>> getElementsName_text(String parameters){
Element P=root.element(parameters);
List<Element> Elements = P.elements("parameter");
for (Element element : Elements) {
System.out.print(element.attributeValue("name")+" ");
System.out.println(element.getTextTrim());
}
return null;
}
public static void main(String[] args) {
ParseXml parseXml=new ParseXml("config/config.xml");
String element=parseXml.getElementText("/config/browser");
System.out.println(element);
}
}
package aoutTestCode;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class xmlToftl {
@SuppressWarnings("unused")
private String filePath;
private Document document;
private Element root;
public xmlToftl(String filePath) {
this.filePath = filePath;
this.load(filePath);
}
public void load(String filePath) {
File file=new File(filePath);
if(file.exists()){
SAXReader saxReader=new SAXReader();
try {
document=saxReader.read(file);
root=document.getRootElement();
} catch (DocumentException e) {
System.out.println("文件加载异常"+filePath);
}
}else{
System.out.println("文件没找到");
}
}
public static void main(String[] args) {
xmlToftl x=new xmlToftl("templates/MakeCode.xml");
x.go();
}
public void go(){
//获取包名
String package_name=getName("package_name");
//获取类名
String class_name=getKey("class_name");
//获取接口名
String implements_name=getKey("implements_name");
//获取boolean
boolean b=getBoolean("initialize_Disable");
System.out.println(b);
//获取参数
List<Map<String,String>> listParameters=getNameAndKey("parameters","parameter");
//获取参数
List<Map<String,String>> initializes=getNameAndKey("initializes","initialize");
System.out.println(initializes.toString());
//获取参数
List<List<String>> getN=getNameAndTypeAndKey("handleInput_replaces","handleInput_replace");
System.out.println(getN);
//获取参数
List<List<String>> getN1=getNameAndTypeAndKey("handleInputs_Verifications","handleInputs_Verification");
System.out.println(getN1);
//获取参数
Map<String,List<String>> getn2=gethandleOutput_save("handleOutput_saves","handleOutput_save","handleOutput");
System.out.println(getn2);
}
public String getName(String str){
if(str.equals("package_name")){
return root.attributeValue("name");
}
Element element=root.element(str);
return element.attributeValue("name");
}
public String getKey(String str){
Element ementsValue=root.element(str);
String Value=ementsValue.getTextTrim();
return Value;
}
public boolean getBoolean(String str){
String type=getKey(str);
if("true".equals(type)){
return true;
}
return false;
}
public List<Map<String,String>> getNameAndKey(String parameters,String parameter){
Element Elements=root.element(parameters);
@SuppressWarnings("unchecked")
List<Element> liste = Elements.elements(parameter);
List<Map<String,String>> list = new ArrayList<Map<String,String>>();
for (Element element : liste) {
Map<String,String> root = new HashMap<String,String>();
if(element.attributeValue("value")==null){
root.put(element.attributeValue("name"), element.getTextTrim());
}else{
root.put(element.attributeValue("value"), element.getTextTrim());
}
list.add(root);
}
return list;
}
public List<List<String>> getNameAndTypeAndKey(String parameters,String parameter){
Element Elements=root.element(parameters);
@SuppressWarnings("unchecked")
List<Element> liste = Elements.elements(parameter);
List<List<String>> list = new ArrayList<List<String>>();
for (Element element : liste) {
List<String> root = new ArrayList<String>();
if(element.attributeValue("name")!=null){
root.add(element.attributeValue("name"));
}
if(element.attributeValue("type")!=null){
root.add(element.attributeValue("type"));
}
if(element.attributeValue("value")!=null){
root.add(element.attributeValue("value"));
}
if(!element.getTextTrim().equals("")){
root.add(element.getTextTrim());
}
list.add(root);
}
return list;
}
public Map<String,List<String>> gethandleOutput_save(String parameters,String parameter,String handleOutput){
Element Elements=root.element(parameters);
@SuppressWarnings("unchecked")
List<Element> liste = Elements.elements(parameter);
Map<String,List<String>> map = new HashMap<String,List<String>>();
String mapString="";
for (Element element : liste) {
List<String> root = new ArrayList<String>();
if(element.attributeValue("name")!=null){
mapString=element.attributeValue("name");
}
List<Element> listh = element.elements(handleOutput);
for (Element element2 : listh) {
root.add(element2.getTextTrim());
}
map.put(mapString,root);
}
return map;
}
}
package com.offcn.TestData;
import org.testng.annotations.DataProvider;
import com.offcn.TestUnti.ReadExcels;
public class offcn_api_testData {
@DataProvider(name="renmai")
public static Object[][] dp(){
ReadExcels readExcels = new ReadExcels("DataAll.xls","TestCase");
try {
return readExcels.readExcels_return();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
package com.offcn.TestUnti;
/**
* Created by puhui on 2016/8/1.
*/
import java.io.UnsupportedEncodingException;
import java.security.Key;
import java.security.Security;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class AES256Encryption {
// 解密
private static final BASE64Decoder DECODER = new BASE64Decoder();
// 加密
private static final BASE64Encoder ENCODER = new BASE64Encoder();
private final static byte[] hex = "0123456789ABCDEF".getBytes();
/**
* 密钥算法 java6支持56位密钥,bouncycastle支持64位
* */
public static final String KEY_ALGORITHM = "AES";
public static final byte[] AES_PASSWORD_TEXT = "puhui88888888888".getBytes();
/**
* 加密/解密算法/工作模式/填充方式
*
* JAVA6 支持PKCS5PADDING填充方式 Bouncy castle支持PKCS7Padding填充方式
* */
public static final String CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding";
/**
*
* 生成密钥,java6只支持56位密钥,bouncycastle支持64位密钥
*
* @return byte[] 二进制密钥
* */
public static byte[] initkey() throws Exception{
//实例化密钥生成器
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
KeyGenerator kg=KeyGenerator.getInstance(KEY_ALGORITHM, "BC");
//初始化密钥生成器,AES要求密钥长度为128位、192位、256位
kg.init(256);
// kg.init(128);
//生成密钥
SecretKey secretKey=kg.generateKey();
//获取二进制密钥编码形式
return secretKey.getEncoded();
// 为了便于测试,这里我把key写死了,如果大家需要自动生成,可用上面注释掉的代码
// return new byte[] { 0x08, 0x08, 0x04, 0x0b, 0x02, 0x0f, 0x0b, 0x0c,
// 0x01, 0x03, 0x09, 0x07, 0x0c, 0x03, 0x07, 0x0a, 0x04, 0x0f,
// 0x06, 0x0f, 0x0e, 0x09, 0x05, 0x01, 0x0a, 0x0a, 0x01, 0x09,
// 0x06, 0x07, 0x09, 0x0d };
// return AES_PASSWORD_TEXT.getBytes();
}
/**
* 转换密钥
*
* @param key
* 二进制密钥
* @return Key 密钥
* */
public static Key toKey(byte[] key) throws Exception {
// 实例化DES密钥
// 生成密钥
SecretKey secretKey = new SecretKeySpec(key, KEY_ALGORITHM);
return secretKey;
}
/**
* 加密数据
*
* @param data 待加密数据
* @return String 加密后的数据
* */
public static String encrypt(byte[] data) {
try{
// 还原密钥
Key k = toKey(AES_PASSWORD_TEXT);
/**
* 实例化 使用 PKCS7PADDING 填充方式,按如下方式实现,就是调用bouncycastle组件实现
* Cipher.getInstance(CIPHER_ALGORITHM,"BC")
*/
// Security.addProvider(new
// org.bouncycastle.jce.provider.BouncyCastleProvider());
// Cipher cipher=Cipher.getInstance(CIPHER_ALGORITHM, "BC");
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
// 初始化,设置为加密模式
cipher.init(Cipher.ENCRYPT_MODE, k);
// 执行操作
byte[] aesData = cipher.doFinal(data);
return ENCODER.encode(aesData);//bass64加密
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* AES解密数据
*
* @param data
* 待解密数据
* @return String 解密后的数据
* */
public static String decrypt(String data) throws Exception {
// 欢迎密钥
Key k = toKey(AES_PASSWORD_TEXT);
byte[] deData = DECODER.decodeBuffer(data);
/**
* 实例化 使用 PKCS7PADDING 填充方式,按如下方式实现,就是调用bouncycastle组件实现
* Cipher.getInstance(CIPHER_ALGORITHM,"BC")
*/
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
// 初始化,设置为解密模式
cipher.init(Cipher.DECRYPT_MODE, k);
// 执行操作
byte[] aa = cipher.doFinal(deData);// 十六进制
return new String(aa);
}
/**
* 将16进制数组转换成字符串
*
* @Description:
* @Title: parseHexStr2Byte
* @user: ningyijie
* @return: String
*/
public static String parseHexStr2Byte(byte[] b) {
byte[] buff = new byte[2 * b.length];
for (int i = 0; i < b.length; i++) {
buff[2 * i] = hex[(b[i] >> 4) & 0x0f];
buff[2 * i + 1] = hex[b[i] & 0x0f];
}
return new String(buff);
}
/**
* @param args
* @throws UnsupportedEncodingException
* @throws Exception
*/
public static void main(String[] args) throws UnsupportedEncodingException {
String str = "a111111";
System.out.println("原文:" + str);
try {
// 加密数据
String data = AES256Encryption.encrypt(str.getBytes());
System.out.println("aes加密后:"+data);
// 解密
String aa = AES256Encryption.decrypt("+RRDgv8Dst9RyN9E0XKPAA=");
System.out.println("aes解密后:" + aa);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package com.offcn.TestUnti;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Date;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
/**
* AES加密解密工具类
*
* @author yupeng
*/
public class AESUtils {
//private static final Logger logger = LoggerFactory.getLogger(AESUtils.class);
// 参数加密密码
public static final String AES_PASSWORD_TEXT = "puhui888888";
// token加密密码
public static final String AES_PASSWORD_TOKEN = "puhui888888";
public static final String FLAG = "!@#";
/**
* 生成当前时间点的加密token
* Token的格式为uid加上时间
* @param uid
* @return
*/
public static String generateToken(String uid) {
StringBuffer tokenStr = new StringBuffer();
long time = new Date().getTime();
tokenStr.append(uid).append(FLAG).append(time);// 生成token
String encrypTokenStr = encrypt(tokenStr.toString(), AES_PASSWORD_TOKEN); // token加密
return encrypTokenStr;
}
/**
* 通过加密token获取UID
*
* @author xiaobowen
* @param encryptToken
* @return uid
*/
public static String getUID(String encryptToken) {
String token = decrypt(encryptToken, AES_PASSWORD_TOKEN);
return getUIDByToken(token);
}
/**
* 通过加密token获取token时间
*
* @author gaozhenbao
* @param encryptToken
* @return time
*/
public static String getTiime(String encryptToken) {
String token = decrypt(encryptToken, AES_PASSWORD_TOKEN);
return getTimeByToken(token);
}
public static String getUIDByToken(String token) {
if (token == null)
return null;
String[] params = token.split(FLAG);
if (params == null || params.length != 2) {
return null;
} else {
// logger.info("token为{},解析为{}",token,params[0]);
return params[0];
}
}
public static String getTimeByToken(String token) {
if (token == null)
return null;
String[] params = token.split(FLAG);
if (params == null || params.length != 2) {
return null;
} else {
return params[1];
}
}
/**
* 获取解密token
*
* @param decryTokenStr
* @return
*/
public static String analyzeToken(String decryTokenStr) {
return decrypt(decryTokenStr, AES_PASSWORD_TOKEN);
}
/**
* AES加密
*
* @author wangyaowei
* @param userpassword 需要加密的密码
* @return enpassword AES加密后的密码
*/
public static String encrypt(String userpassword){
return encrypt(userpassword, AES_PASSWORD_TOKEN);
}
/**
* AES加密
*
* @author yupeng
* @param content
* 需要加密的内容
* @param password
* 加密密码
* @return
*/
public static String encrypt(String content, String password) {
if (content == null) {
return null;
}
try {
KeyGenerator kgen = KeyGenerator.getInstance("AES");// 提供AES密钥算法的(对称)密钥生成器
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(password.getBytes());
kgen.init(128, secureRandom);
SecretKey secretKey = kgen.generateKey();// 生成一个密钥
// byte[] enCodeFormat = secretKey.getEncoded();//基本编码格式的密钥
// SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");// 创建密码器
byte[] byteContent = content.getBytes("utf-8");
// System.out.println("key:" +
// CommonUtils.parseByte2HexStr(key.getEncoded()));
cipher.init(Cipher.ENCRYPT_MODE, secretKey);// 初始化 加密模式
byte[] result = cipher.doFinal(byteContent);
String encryptResultStr = parseByte2HexStr(result);
return encryptResultStr; // 加密 后的16进制
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
return null;
}
/**
* AES解密
*
* @author yupeng
* @param content
* 待解密内容(十六进制)
* @param password
* 解密密钥
* @return
*/
public static String decrypt(String content, String password) {
return decrypt(parseHexStr2Byte(content), password);
}
/**
* AES解密
*
* @author yupeng
* @param content
* 待解密内容
* @param password
* 解密密钥
* @return
*/
public static String decrypt(byte[] content, String password) {
try {
KeyGenerator kgen = KeyGenerator.getInstance("AES");// 提供AES密钥算法的(对称)密钥生成器
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
secureRandom.setSeed(password.getBytes());
kgen.init(128, secureRandom);
SecretKey secretKey = kgen.generateKey();
byte[] enCodeFormat = secretKey.getEncoded();
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");// 创建密码器
cipher.init(Cipher.DECRYPT_MODE, key);// 初始化 解密模式
byte[] result = cipher.doFinal(content);// 解密为16进制
String resultStr = new String(result);// 将16进制转化为字符串
return resultStr; // 解密
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
return null;
}
/**
* 将二进制转换成16进制
*
* @param buf
* @return
*/
public static String parseByte2HexStr(byte buf[]) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < buf.length; i++) {
String hex = Integer.toHexString(buf[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}
/**
* 将16进制转换为二进制
*
* @param hexStr
* @return
*/
public static byte[] parseHexStr2Byte(String hexStr) {
if (hexStr.length() < 1)
return null;
byte[] result = new byte[hexStr.length() / 2];
for (int i = 0; i < hexStr.length() / 2; i++) {
int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16);
result[i] = (byte) (high * 16 + low);
}
return result;
}
}
package com.offcn.TestUnti;
//package com.puhui.TestUnti;
//
//import com.puhui.process.BasicsGM;
//import com.puhui.process.ZY;
//import com.puhui.system.system;
//
//import io.restassured.RestAssured;
//import io.restassured.config.RestAssuredConfig;
//import io.restassured.config.SSLConfig;
//import io.restassured.path.json.JsonPath;
//import io.restassured.response.Response;
//
//import java.io.File;
//import java.util.HashMap;
//
////import org.apache.http.entity.ContentType;
//
//
//
//
//import static io.restassured.http.ContentType.JSON;
//
//
//public class CopyOfRequestDataUtils {
//
// public static void main(String[] args) {
// String s="/user/validator/code?phone=13910960649&sendImageCode=CJ6J";
//
// }
// //发送请求前的准备
// private RestAssured getRMEnv(system tem) {
// RestAssured ra = new RestAssured();
// ra.config = RestAssuredConfig.newConfig().sslConfig(
// SSLConfig.sslConfig().allowAllHostnames());
//// System.out.println(tem.getRM_URI());
// ra.baseURI = tem.getRM_URI();
//
//// System.out.println(Integer.valueOf(tem.getRM_port()));
//// if (!ReadProperties.GetPropertyByKey("isProduct").contains("Y")){
// ra.port = Integer.valueOf(tem.getRM_port());
//// }
//
//// System.out.println(tem.getRM_basePath());
// ra.basePath = tem.getRM_basePath();
//
// return ra;
// }
//
// //发送post请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getPost3Response(HashMap<String, Object> data,
// String serviceURL) {
// //设置参数格式
// String Parameter= MapUtil.getParameter(data);
//
//// String system= MapUtil.getValue("system", data);
// String system= "zy3";
// com.puhui.system.system tem=(com.puhui.system.system)(BasicsGM.map.get(system));
//
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+Parameter);
//
// int state=0;
//// String oauth2="";
////
//// while(state<5){
//// try {
//// state++;
//// Thread.sleep(1000);
//// oauth2= OAuthTokenUnti.getOathToken(system).getValue();
//// break;
//// } catch (Exception e) {
//// Log.logError("获取Token失败,"+state+"次。");
//// }
////
//// }
//// state=0;
// System.out.println("serviceURL="+serviceURL);
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// re=rdu.getRMEnv(tem).when().post(serviceURL).thenReturn();
// JsonPath jp = re.body().jsonPath();
// System.out.println(jp.getString("status"));
// if("500".equals(jp.getString("status"))){
// Log.logError("请求返回500,"+state+"次。");
// }else{
// return re;
// }
// } catch (Exception e) {
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//
//
// //发送post请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getPostResponse(HashMap<String, Object> data,
// String serviceURL) {
// //设置参数格式
// String Parameter= MapUtil.getParameter(data);
//
// String system= MapUtil.getValue("system", data);
// com.puhui.system.system tem=(com.puhui.system.system)(BasicsGM.map.get(system));
//
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+Parameter);
//
// int state=0;
// String oauth2="";
//
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// oauth2= OAuthTokenUnti.getOathToken(system).getValue();
// break;
// } catch (Exception e) {
// Log.logError("获取Token失败,"+state+"次。");
// }
//
// }
// state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// re=rdu.getRMEnv(tem).given().auth()
// .oauth2(oauth2)
// .contentType(JSON).body(Parameter).when().post(serviceURL).thenReturn();
// JsonPath jp = re.body().jsonPath();
// if("500".equals(jp.getString("status"))){
// Log.logError("请求返回500,"+state+"次。");
// }else{
// return re;
// }
// } catch (Exception e) {
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//
// //发送get请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getGetResponse_Token(HashMap<String, Object> data,
// String serviceURL) {
// //设置参数格式
// String Parameter=MapUtil.getParameter(data);
// if("{}".equals(Parameter)){
// Parameter="";
// }else{
// Parameter=Parameter.substring(1, Parameter.length()-1);
//
// }
// String system=MapUtil.getValue("system", data);
// system tem=(system)(BasicsGM.map.get(system));
//
//
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+Parameter);
//// System.out.println("serviceURL+Parameter="+serviceURL+Parameter);
//
// int state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
//// System.out.println("url="+serviceURL+"/"+Parameter);
// while(state<5){
// try {
// state++;
// System.out.println("token="+ZY.ZY_Token.get("token"));
// re=rdu.getRMEnv(tem).given().header("Authorization", ZY.ZY_Token.get("token")==null? "":ZY.ZY_Token.get("token")).when().get(serviceURL).andReturn();
// if("500".equals(re.statusCode()+"")){
// Thread.sleep(1000);
// Log.logError("请求返回500,"+state+"次。");
// }else{
// return re;
// }
// } catch (Exception e) {
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
// //发送post请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getPostResponse(HashMap<String, Object> data,
// String serviceURL, String token) {
// //设置参数格式
// String Parameter= MapUtil.getParameter(data);
//
// String system= MapUtil.getValue("system", data);
// com.puhui.system.system tem=(com.puhui.system.system)(BasicsGM.map.get(system));
//
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+Parameter);
//
// int state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// re=rdu.getRMEnv(tem).given().header("Authorization",token)
// .contentType(JSON).body(Parameter).when().post(serviceURL).thenReturn();
// JsonPath jp = re.body().jsonPath();
// if("500".equals(jp.getString("status"))){
// Log.logError("请求返回500,"+state+"次。");
// }else{
// return re;
// }
// } catch (Exception e) {
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//
// //发送post请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getPostResponse_token(HashMap<String, Object> data,
// String serviceURL) {
// //设置参数格式
// String Parameter=MapUtil.getParameter(data);
//
// String system=MapUtil.getValue("system", data);
// system tem=(system)(BasicsGM.map.get(system));
//
//
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+Parameter);
//
// int state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
// while(state<5){
// try {
// state++;
//// System.out.println("token="+ZY.ZY_Token.get("token"));
//// System.out.println("serviceURL="+serviceURL);
//// System.out.println("Parameter="+Parameter);
// re=rdu.getRMEnv(tem).given().header("Authorization", ZY.ZY_Token.get("token")==null? "":ZY.ZY_Token.get("token"))
// .contentType(JSON).body(Parameter).when().post(serviceURL).thenReturn();
// JsonPath jp = re.body().jsonPath();
// String rrr=re.asString();
// if("500".equals(jp.getString("status"))){
// Log.logError("请求返回500,"+state+"次。");
// Thread.sleep(1000);
// }else{
// return re;
// }
// } catch (Exception e) {
//// e.printStackTrace();
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//
//
// //发送post请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getPostResponse_tupian(HashMap<String, Object> data,
// String serviceURL,HashMap<String, String> map,String filename) {
// //设置参数格式
// String Parameter=MapUtil.getParameter(data);
//
// String system=MapUtil.getValue("system", data);
// system tem=(system)(BasicsGM.map.get(system));
//
//
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+Parameter);
//
// int state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
// while(state<5){
// try {
// state++;
//// System.out.println("token="+ZY.ZY_Token.get("token"));
//// System.out.println("serviceURL="+serviceURL);
//// System.out.println("Parameter="+Parameter);
// try{
// File filen=new File("out/"+filename);
// re=rdu.getRMEnv(tem).given().header("Authorization", ZY.ZY_Token.get("token")==null? "":ZY.ZY_Token.get("token"))
// .when().multiPart("file", filen)
// .params(map)
// .post(serviceURL).andReturn();
// }catch(Exception e){
// re=rdu.getRMEnv(tem).given().header("Authorization", ZY.ZY_Token.get("token")==null? "":ZY.ZY_Token.get("token"))
// .when()
// .params(map)
// .post(serviceURL).andReturn();
// }
//
// JsonPath jp = re.body().jsonPath();
//// String rrr=re.asString();
// if("500".equals(jp.getString("status"))){
// Log.logError("请求返回500,"+state+"次。");
// Thread.sleep(1000);
// }else{
// return re;
// }
// } catch (Exception e) {
//// e.printStackTrace();
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//
//
// //发送put请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getPutResponse(HashMap<String, Object> data,
// String serviceURL) {
// //设置参数格式
// String Parameter= MapUtil.getParameter(data);
//
// String system= MapUtil.getValue("system", data);
// com.puhui.system.system tem=(com.puhui.system.system)(BasicsGM.map.get(system));
//
//
// Parameter=Parameter.substring(1, Parameter.length()-1);
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+Parameter);
//// System.out.println("serviceURL+Parameter="+serviceURL+Parameter);
//
// int state=0;
// String oauth2="";
//
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// oauth2= OAuthTokenUnti.getOathToken(system).getValue();
// break;
// } catch (Exception e) {
// Log.logError("获取Token失败,"+state+"次。");
// }
//
// }
// state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// re=rdu.getRMEnv(tem).given().auth()
// .oauth2(oauth2)
// .when().put(serviceURL+Parameter).andReturn();
// JsonPath jp = re.body().jsonPath();
// if("500".equals(jp.getString("status"))){
// Log.logError("请求返回500,"+state+"次。");
// }else{
// return re;
// }
// } catch (Exception e) {
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//
// //发送get请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getGetResponse(HashMap<String, Object> data,
// String serviceURL) {
// //设置参数格式
// String Parameter= MapUtil.getParameter(data);
//
// String system= MapUtil.getValue("system", data);
// com.puhui.system.system tem=(com.puhui.system.system)(BasicsGM.map.get(system));
//
//
// Parameter=Parameter.substring(1, Parameter.length()-1);
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+Parameter);
//// System.out.println("serviceURL+Parameter="+serviceURL+Parameter);
//
// int state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
//// System.out.println("url="+serviceURL+"/"+Parameter);
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// re=rdu.getRMEnv(tem).given().get(serviceURL+"/"+Parameter).andReturn();
// if("500".equals(re.statusCode()+"")){
// Log.logError("请求返回500,"+state+"次。");
// }else{
// return re;
// }
// } catch (Exception e) {
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//
//
// //xuwen临时使用 - 发送get请求返回整个响应结果,token为Bearer格式
// @SuppressWarnings("static-access")
// public static Response getGetResponse_xuwen(HashMap<String, Object> data,
// String serviceURL) {
// //设置参数格式
// String Parameter= MapUtil.getParameter(data);
//
// String system= MapUtil.getValue("system", data);
// com.puhui.system.system tem=(com.puhui.system.system)(BasicsGM.map.get(system));
// int state=0;
// String oauth2="";
//
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// oauth2= OAuthTokenUnti.getOathToken(system).getValue();
// break;
// } catch (Exception e) {
// Log.logError("获取Token失败,"+state+"次。");
// }
//
// }
// state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
//// re=rdu.getRMEnv(tem).given().auth().oauth2(oauth2).get(serviceURL).andReturn();
// re=rdu.getRMEnv(tem).given().header("Authorization","Bearer "+oauth2).get(serviceURL).andReturn();
// if("500".equals(re.statusCode()+"")){
// Log.logError("请求返回500,"+state+"次。");
// }else{
//// String url = rdu.getRMEnv(tem).baseURI+rdu.getRMEnv(tem).basePath+serviceURL;
//// System.out.println(url);
// return re;
// }
// } catch (Exception e) {
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//
//
// //发送get请求返回整个响应结果
// @SuppressWarnings("static-access")
// public static Response getGetResponse(HashMap<String, Object> data,
// String serviceURL,String token) {
// //设置参数格式
// String parameter= MapUtil.getParameter(data);
//
// String system= MapUtil.getValue("system", data);
// com.puhui.system.system tem=(com.puhui.system.system)(BasicsGM.map.get(system));
//
//
// parameter=parameter.substring(1, parameter.length()-1);
// Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
//
// int state=0;
// Response re=null;
// CopyOfRequestDataUtils rdu=new CopyOfRequestDataUtils();
// while(state<5){
// try {
// state++;
// Thread.sleep(1000);
// if(parameter != null && !"".equals(parameter)) {
// re = rdu.getRMEnv(tem).given().header("Authorization", token).get(serviceURL + "/" + parameter).andReturn();
// }else {
// re = rdu.getRMEnv(tem).given().header("Authorization", token).get(serviceURL).andReturn();
// }
// if("500".equals(re.statusCode()+"")){
// Log.logError("请求返回500,"+state+"次。");
// }else{
// return re;
// }
// } catch (Exception e) {
// Log.logError("请求超时,"+state+"次。");
// }
// }
// return re;
// }
//}
package com.offcn.TestUnti;
import com.puhui.aes.AesEncryptionUtil;
import org.apache.commons.lang3.StringUtils;
/**
* 加密和解密
*
* @author wangcj
*/
public class EncryptionUtil {
private static final String prefix = "xy";
private EncryptionUtil() {
}
/**
* 加密
*
* @author wangcj
* @param content
* @return
*/
public static String encrypt(String content) {
String tempContent = content;
if (StringUtils.isBlank(tempContent)) {
return tempContent;
}
if (tempContent.startsWith(prefix)) {
return tempContent;
}
return AesEncryptionUtil.encrypt(tempContent);
}
/**
* 解密
*
* @author wangcj
* @param content
* @return
*/
public static String decrypt(String content) {
String tempContent = content;
if (StringUtils.isBlank(tempContent)) {
return tempContent;
}
if (tempContent.startsWith(prefix)) {
return AesEncryptionUtil.decrypt(tempContent);
}
return tempContent;
}
public static void main(String[] args) {
String s1=EncryptionUtil.encrypt("18230065651");
String s=EncryptionUtil.decrypt("e10adc3949ba59abbe56e057f20f883e");
System.out.println("加密后,卡号是:"+s1);
System.out.println("解密后,卡号是:"+s);
}
}
\ No newline at end of file
package com.offcn.TestUnti;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.testng.annotations.Test;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by puhui on 2017/1/9.
*/
public class GetTaoBaoCookies {
public static List<Map<String, String>> initCookies(FileReader fr) throws IOException {
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
BufferedReader br = new BufferedReader(fr);
String line = "";
int m = 1;
while ((line = br.readLine()) != null) {
System.err.println("第" + m + "行");
m++;
String[] arrs = line.split("\t");
Map<String, String> map = new HashMap<>();
map.put("path", arrs[2]);
map.put("name", arrs[arrs.length - 2]);
map.put("value", arrs[arrs.length - 1]);
map.put("domain", arrs[0]);
list.add(map);
}
return list;
}
@Test
public void getcookies() throws IOException {
FileReader fr = new FileReader("d:/cookies.txt");
List<Map<String, String>> list = initCookies(fr);
System.out.println();
Map a = new HashMap();
a.put("xx", JSONArray.fromObject(list));
System.out.println(JSONObject.fromObject(a));
}
}
package com.offcn.TestUnti;
import io.restassured.RestAssured;
import io.restassured.response.Response;
public class GetVerifyCode {
//获取验证码的前置信息
public static RestAssured getVerifyCode() {
RestAssured ra_VerifyCode = new RestAssured();
ra_VerifyCode.baseURI = "http://106.75.3.8";
ra_VerifyCode.port = 8765;
ra_VerifyCode.basePath = "/puhui-notification-server/api/v1/message/query";
return ra_VerifyCode;
}
//获取验证码并分析出返回
public static String getGetResponse(String phone) {
RestAssured ra_VerifyCode = new RestAssured();
ra_VerifyCode.baseURI = "http://106.75.3.8";
ra_VerifyCode.port = 8765;
ra_VerifyCode.basePath = "/puhui-notification-server/api/v1/message/query";
Response ra_VerifyCode1 = ra_VerifyCode.given().param("mobile", phone).get();
String str2 = ra_VerifyCode1.body().jsonPath().getString("消息内容").split(",")[0]
.split(":")[1].trim().toString();
return str2;
}
}
package com.offcn.TestUnti;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
public class HttpUtils {
/**
* get
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doGet(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpGet request = new HttpGet(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
/**
* post form
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param bodys
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
Map<String, String> bodys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (bodys != null) {
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
for (String key : bodys.keySet()) {
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
}
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
request.setEntity(formEntity);
}
return httpClient.execute(request);
}
/**
* Post String
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Post stream
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Put String
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Put stream
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
StringBuilder sbUrl = new StringBuilder();
sbUrl.append(host);
if (!StringUtils.isBlank(path)) {
sbUrl.append(path);
}
if (null != querys) {
StringBuilder sbQuery = new StringBuilder();
for (Map.Entry<String, String> query : querys.entrySet()) {
if (0 < sbQuery.length()) {
sbQuery.append("&");
}
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
sbQuery.append(query.getValue());
}
if (!StringUtils.isBlank(query.getKey())) {
sbQuery.append(query.getKey());
if (!StringUtils.isBlank(query.getValue())) {
sbQuery.append("=");
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
}
}
}
if (0 < sbQuery.length()) {
sbUrl.append("?").append(sbQuery);
}
}
return sbUrl.toString();
}
private static HttpClient wrapClient(String host) {
HttpClient httpClient = new DefaultHttpClient();
if (host.startsWith("https://")) {
sslClient(httpClient);
}
return httpClient;
}
private static void sslClient(HttpClient httpClient) {
try {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] xcs, String str) {
}
public void checkServerTrusted(X509Certificate[] xcs, String str) {
}
};
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = httpClient.getConnectionManager();
SchemeRegistry registry = ccm.getSchemeRegistry();
registry.register(new Scheme("https", 443, ssf));
} catch (KeyManagementException ex) {
throw new RuntimeException(ex);
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
}
}
}
\ No newline at end of file
package com.offcn.TestUnti;
import java.io.*;
import java.net.URL;
import java.security.*;
import java.security.cert.*;
import javax.net.ssl.*;
public class InstallCert {
public static void main(String[] args) throws Exception {
String host;
int port;
char[] passphrase;
if ((args.length == 1) || (args.length == 2)) {
String[] c = args[0].split(":");
host = c[0];
port = (c.length == 1) ? 443 : Integer.parseInt(c[1]);
String p = (args.length == 1) ? "changeit" : args[1];
passphrase = p.toCharArray();
} else {
System.out.println("Usage: java InstallCert <host>[:port] [passphrase]");
return;
}
File file = new File("jssecacerts");
if (file.isFile() == false) {
char SEP = File.separatorChar;
File dir = new File(System.getProperty("java.home") + SEP
+ "lib" + SEP + "security");
file = new File(dir, "jssecacerts");
if (file.isFile() == false) {
file = new File(dir, "cacerts");
}
}
System.out.println("Loading KeyStore " + file + "...");
InputStream in = new FileInputStream(file);
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(in, passphrase);
in.close();
SSLContext context = SSLContext.getInstance("TLS");
TrustManagerFactory tmf =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ks);
X509TrustManager defaultTrustManager = (X509TrustManager)tmf.getTrustManagers()[0];
SavingTrustManager tm = new SavingTrustManager(defaultTrustManager);
context.init(null, new TrustManager[] {tm}, null);
SSLSocketFactory factory = context.getSocketFactory();
System.out.println("Opening connection to " + host + ":" + port + "...");
SSLSocket socket = (SSLSocket)factory.createSocket(host, port);
socket.setSoTimeout(10000);
try {
System.out.println("Starting SSL handshake...");
socket.startHandshake();
socket.close();
System.out.println();
System.out.println("No errors, certificate is already trusted");
} catch (SSLException e) {
System.out.println();
e.printStackTrace(System.out);
}
X509Certificate[] chain = tm.chain;
if (chain == null) {
System.out.println("Could not obtain server certificate chain");
return;
}
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
System.out.println();
System.out.println("Server sent " + chain.length + " certificate(s):");
System.out.println();
MessageDigest sha1 = MessageDigest.getInstance("SHA1");
MessageDigest md5 = MessageDigest.getInstance("MD5");
for (int i = 0; i < chain.length; i++) {
X509Certificate cert = chain[i];
System.out.println
(" " + (i + 1) + " Subject " + cert.getSubjectDN());
System.out.println(" Issuer " + cert.getIssuerDN());
sha1.update(cert.getEncoded());
System.out.println(" sha1 " + toHexString(sha1.digest()));
md5.update(cert.getEncoded());
System.out.println(" md5 " + toHexString(md5.digest()));
System.out.println();
}
System.out.println("Enter certificate to add to trusted keystore or 'q' to quit: [1]");
String line = reader.readLine().trim();
int k;
try {
k = (line.length() == 0) ? 0 : Integer.parseInt(line) - 1;
} catch (NumberFormatException e) {
System.out.println("KeyStore not changed");
return;
}
X509Certificate cert = chain[k];
String alias = host + "-" + (k + 1);
ks.setCertificateEntry(alias, cert);
OutputStream out = new FileOutputStream("jssecacerts");
ks.store(out, passphrase);
out.close();
System.out.println();
System.out.println(cert);
System.out.println();
System.out.println
("Added certificate to keystore 'jssecacerts' using alias '"
+ alias + "'");
}
private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray();
private static String toHexString(byte[] bytes) {
StringBuilder sb = new StringBuilder(bytes.length * 3);
for (int b : bytes) {
b &= 0xff;
sb.append(HEXDIGITS[b >> 4]);
sb.append(HEXDIGITS[b & 15]);
sb.append(' ');
}
return sb.toString();
}
private static class SavingTrustManager implements X509TrustManager {
private final X509TrustManager tm;
private X509Certificate[] chain;
SavingTrustManager(X509TrustManager tm) {
this.tm = tm;
}
public X509Certificate[] getAcceptedIssuers() {
throw new UnsupportedOperationException();
}
public void checkClientTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
throw new UnsupportedOperationException();
}
public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
this.chain = chain;
tm.checkServerTrusted(chain, authType);
}
}
}
package com.offcn.TestUnti;
import java.io.File;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
public class Log {
/**
* @param args
*/
private static Logger logger;
private static String filePath="src/log4f.properties";
private static boolean flag = false;
@SuppressWarnings("static-access")
private static synchronized void getPropertyFile(){
logger=logger.getLogger("TestProject");
PropertyConfigurator.configure(new File(filePath).getAbsolutePath());
flag=true;
}
private static void getFlag(){
if(flag==false){
Log.getPropertyFile();
}
}
public static void logInfo(String message){
Log.getFlag();
logger.info(message);
}
public static void logError(String message){
Log.getFlag();
logger.error(message);
}
public static void logWarn(String message){
Log.getFlag();
logger.warn(message);
}
}
package com.offcn.TestUnti;
/**
* Created by puhui on 2016/8/10.
*/
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* MD5加密工具类,
*
* @author luyujian
*/
public class MD5keyUtil {
/**
* 返回加密的密文
*
* @param str
* 要加密的字符串
* @return
*/
public static String getMD5Str(String str) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) { // NOSONAR
System.out.println(e.getMessage());
} catch (UnsupportedEncodingException e) { // NOSONAR
System.out.println(e.getMessage());
}
byte[] byteArray = messageDigest.digest();
StringBuffer md5StrBuff = new StringBuffer();
for (int i = 0; i < byteArray.length; i++) {
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
else
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
}
return md5StrBuff.toString().toUpperCase();
}
public static void main(String[] arg) {
System.out.println(getMD5Str("22"));
}
}
package com.offcn.TestUnti;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import net.sf.json.JSONObject;
public class MapUtil {
public static void main(String[] args) {
HashMap<String, Object> hm=new HashMap<String, Object>();
hm.put("1", "a1");
hm.put("statusCode", "a2");
hm.put("3", "a3");
hm.put("errcode", "a4");
hm.put("5", "a5");
hm.put("errmsg", "a6");
HashMap<String, Object> newhm=Expect(hm);
System.out.println("@AfterClass_data_ext="+JSONObject.fromObject(newhm).toString());
}
//马洪亮
// 生成数组格式的json串
public static String getArrayJson(String para) {
StringBuffer sb = new StringBuffer();
sb.append("[");
if (para.contains(";")) {
for (int i = 0; i < para.split(";").length; i++) {
sb.append("{");
sb.append(para.split(";")[i]);
sb.append("},");
}
sb.deleteCharAt(sb.length() - 1);
}else{
sb.append("{");
sb.append(para);
sb.append("}");
}
sb.append("]");
return sb.toString();
}
//显示整个map
public static String showMap(HashMap<String, Object> data){
Set<Map.Entry<String,Object>> set=data.entrySet();
Iterator<Entry<String, Object>> it=set.iterator();
HashMap<String, Object> newdata=new HashMap<String, Object>();
StringBuffer sb=new StringBuffer();
while(it.hasNext()){
Map.Entry<String,Object> me=it.next();
String key=me.getKey();
Object value=me.getValue();
sb.append(key+":"+value+",");
}
return sb+"";
}
//显示整个map
public static String showMap_String(Map<String, String> data){
Set<Map.Entry<String,String>> set=data.entrySet();
Iterator<Entry<String, String>> it=set.iterator();
HashMap<String, String> newdata=new HashMap<String, String>();
StringBuffer sb=new StringBuffer();
while(it.hasNext()){
Map.Entry<String,String> me=it.next();
String key=me.getKey();
String value=me.getValue();
sb.append(key+":"+value+",");
}
return sb+"";
}
//返回期望结果
public static HashMap<String, Object> Expect(HashMap<String, Object> data){
Set<Map.Entry<String,Object>> set=data.entrySet();
Iterator<Entry<String, Object>> it=set.iterator();
HashMap<String, Object> newdata=new HashMap<String, Object>();
while(it.hasNext()){
Map.Entry<String,Object> me=it.next();
String key=me.getKey();
Object value=me.getValue();
if(key.equals("statusCode") || key.equals("code") || key.equals("msg") || key.equals("custom")){
newdata.put(key, value);
}
}
return newdata;
}
//获得数据中的Parameter,并修改成json模式
public static String getParameter(HashMap<String, Object> data){
String s=MapUtil.getValue("parameter",data);
StringBuffer sb=new StringBuffer();
sb.append("{");
sb.append(s);
sb.append("}");
return sb.toString();
}
// //获取验证码map中不是参数描述的手机号的验证码
// public static String getOthersVerifyCode(String ownPhoneNumber) {
// String verifycode = "";
// Iterator<Entry<String, String>> it = BasicsGM.verifyCode.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry<String, String> entry = it.next();
// if (!entry.getKey().equals(ownPhoneNumber)) {
// verifycode = entry.getValue();
// break;
// }
// }
// return verifycode;
// }
//获取verifyCode-map中指定的key所对应的值
// public static String getOldVerifyCode(String phone) {
// String str="";
// str=BasicsGM.verifyCode.get(phone);
// return str;
// }
//获取map中指定的key所对应的值,返回字符串
public static String getValue(String ownPhoneNumber,HashMap<String, Object> data) {
Object verifycode = null;
Iterator<Entry<String, Object>> it = data.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
if (entry.getKey().equals(ownPhoneNumber)) {
verifycode = entry.getValue();
// System.out.println(verifycode);
break;
}
}
return verifycode+"";
}
//在parameter中查看,是否有(第二个参数)电话的关键字,有的话返回数字值
public static String getNumber(String parameter,String number){
String[] strcomma=parameter.split(",");
int comma=strcomma.length;
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
//此时是多个,,,
String[] str=strcomma[k].split(":");
String str_strcomma=Arrays.toString(str);
// System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
//在找到后的位置开始查找数字,最后把数字的字符串返回
if(str_strcomma.contains(number)){
int start=str_strcomma.indexOf(',');
str_strcomma=str_strcomma.substring(start+1,str_strcomma.length()-1);
for (int i =0;i< str_strcomma.length(); i++) {
if (Character.isDigit(str_strcomma.charAt(i))) {
sb.append(str_strcomma.charAt(i));
}
}
}
}
return sb.toString();
}
//在parameter中查看,是否有(第二个参数)verifyCode的关键字,有的话返回他的字母值
public static String getParameter(String parameter,String Letter){
if(parameter==null){
return "";
}
String[] strcomma=parameter.split(",");
int comma=strcomma.length;
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
//此时是多个,,,
String[] str=strcomma[k].split(":");
String str_strcomma=Arrays.toString(str);
// System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
//在找到后的位置开始查找数字,最后把数字的字符串返回
if(str_strcomma.contains(Letter)){
int start=str_strcomma.indexOf(',');
sb.append(str_strcomma.substring(start+2,str_strcomma.length()-1));
return sb.toString();
}
}
return sb.toString();
}
//在parameter中查看,是否有(第二个参数)verifyCode的关键字,有的话返回他的字母值
public static String getParameter_accurate(String parameter,String Letter){
if(parameter==null){
return "";
}
String[] strcomma=parameter.split(",");
int comma=strcomma.length;
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
//此时是多个,,,
String str=strcomma[k].split(":")[0];
String str_strcomma= MapUtil.killQuotes(str, "\"");//去掉双引号的education
// String String str_strcomma==str;
// System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
//在找到后的位置开始查找数字,最后把数字的字符串返回
if(str_strcomma.equals(Letter)){
try {
sb.append(strcomma[k].split(":")[1]);
} catch (Exception e) {
Log.logInfo("字段没有后半部分");
}
return sb.toString();
}
}
return sb.toString();
}
//去掉字母值的指定符号,参数1字符串,参数2指定符号
public static String killQuotes(String parameter,String Letter){
StringBuffer sb=new StringBuffer();
for(int k=0;k<parameter.length();k++){
if(parameter.charAt(k)!= '"'){
sb.append(parameter.charAt(k));
}
}
return sb.toString();
}
//去掉字母值的指定符号,参数1字符串,参数2指定符号
public static String killQuotes(String parameter,char Letter){
StringBuffer sb=new StringBuffer();
for(int k=0;k<parameter.length();k++){
if(parameter.charAt(k)!= Letter){
sb.append(parameter.charAt(k));
}
}
return sb.toString();
}
//在parameter中,按照第二个参数进行分割,分割成两段,获取后面那段的内容
public static String getParameterList(String parameter,String Letter){
if(parameter==null || parameter.equals("")){
return "";
}
String[] strcomma=parameter.split(Letter);
if(strcomma.length>0 && strcomma[1]!=null){
return strcomma[1].toString();
}
return "";
}
}
package com.offcn.TestUnti;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
/**
* 魔蝎验签
* @author puhui
*
*/
public class MoXie {
public static void main(String[] args) {
String s="{\"mobile\":\"13910960649\",\"user_id\":\"d9c3a0add4d545fbb236f25671e189ed-order\",\"task_id\":\"12345\",\"name\":\"姚帅\",\"idcard\":\"11022119811222061X\",\"result\":\"true\",\"message\":\"报告通知\",\"timestamp\":3000}";
System.out.println(MoXie.base64Hmac256(s, "27c7e4bc518c48d095d9caf544771876"));
}
public static String base64Hmac256(String payload, String secret) {
try {
Mac sha256Hmac = Mac.getInstance("HmacSHA256");
SecretKeySpec secretKey = new SecretKeySpec(secret.getBytes(), "HmacSHA256");
sha256Hmac.init(secretKey);
return Base64.encodeBase64String(sha256Hmac.doFinal(payload.getBytes()));
} catch (Exception ignored) {
return "";
}
}
public static String jiaFanXieXian(String str){
str=str.replaceAll("\"", "\\\"");
return str;
}
}
package com.offcn.TestUnti;
import io.restassured.RestAssured;
import io.restassured.config.RestAssuredConfig;
import io.restassured.config.SSLConfig;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static io.restassured.http.ContentType.JSON;
/**
* Created by puhui on 16/9/14.
*/
public class MockServerTestUtil {
static RestAssured ra;
public static RestAssured getLocalRAEnv(){
if (ra == null){
ra = new RestAssured();
ra.config = RestAssuredConfig.newConfig().sslConfig(SSLConfig.sslConfig().allowAllHostnames());
ra.baseURI = "http://127.0.0.1";
ra.port = 30800;
}
return ra;
}
public static void sendSingleMessageResponse(String mobile, String messageContent){
Response re = getLocalRAEnv().given().
param("token", "faketoken").
param("senderId", 1).
param("senderName", "iqianjin").
param("mobile", mobile).
param("messageContent", messageContent).
param("bsCode", "sbcode").
when().get("/api/v1/message/getSend").thenReturn();
re.getBody().print();
re.then().statusCode( 200 );
}
//batchNo批次号非必要参数,
// messageContent messageContents 单条内容和多条容不能共存,优先单一内容发送,多条内容发送是与发送号码一一对应的。
public static JsonPath sendmutiMessageResponse(List<String> mobiles, List<String> messageContents){
Map<String, Object> jsonAsMap = new HashMap();
jsonAsMap.put("senderName","testmuti");
jsonAsMap.put("messageContents",messageContents);
jsonAsMap.put("mobiles",mobiles);
jsonAsMap.put("bscode","fakebscode");
Response re = getLocalRAEnv().given().contentType(JSON).body(jsonAsMap).
when(). post("/api/v1/message/send").thenReturn();
re.getBody().print();
re.then().statusCode( 200 );
return re.getBody().jsonPath();
}
public static JsonPath getSingleMessageResponse(String mobile){
Response re = getLocalRAEnv().given().
param("mobile", mobile).
when(). get("/api/v1/message/query").thenReturn();
re.getBody().print();
re.then().statusCode( 200 );
return re.getBody().jsonPath();
}
}
package com.offcn.TestUnti;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import net.sf.json.JSONObject;
public class MyDateUtil {
public static void main(String[] args) {
getTime(24,0,0);
}
//按需生成字符串时间,参数是小时、分、秒,最好别有进位
public static String getTime(int hour,int minute,int seconds) {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.HOUR_OF_DAY,(calendar.get(Calendar.HOUR_OF_DAY)+hour)>22?22:calendar.get(Calendar.HOUR_OF_DAY)+hour);
calendar.set(Calendar.MINUTE, calendar.get(Calendar.MINUTE)+minute);
calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND)+seconds);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
// System.out.println(format.format(calendar.getTime()));
if(calendar.get(Calendar.HOUR_OF_DAY)==0){
throw new RuntimeException("只能创建当日房间,今日时间不足,请休息一会儿吧~");
}
return format.format(calendar.getTime());
}
//返回当前时间字符串
public static String getTime() {
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = sdf.format(d);
return s;
}
}
package com.offcn.TestUnti;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class MySqlUtil {
//查询表名tableName的条件是condition的结果集
public ResultSet selectFromDB(String tableName, String condition) throws Exception {
Connection conn = null;
String sql;
ResultSet rs = null;
String url = ReadProperties.GetPropertyByKey("sqlurl");
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement();
sql = "select * from " + tableName + " where " + condition;
// System.out.println("select_sql="+sql);
rs = stmt.executeQuery(sql);
return rs;
}
}
package com.offcn.TestUnti;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.security.oauth2.client.DefaultOAuth2ClientContext;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import com.offcn.process.BasicsGM;
import com.offcn.system.system;
import com.offcn.test.APITest;
import java.util.Arrays;
public class OAuthTokenUnti {
public APITest RAPI;
// private static OAuth2AccessToken token;
public static OAuth2AccessToken token;
public static void main(String[] args) {
String strToken=OAuthTokenUnti.getOathToken("gmysx").getValue();
System.out.println("strToken="+strToken);
}
public static OAuth2AccessToken getOathToken(String system){
if(token == null){
OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(getResource(system),new DefaultOAuth2ClientContext(new DefaultAccessTokenRequest()));
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>> asList(converter));
token = restTemplate.getAccessToken();
}
return token;
}
private static ClientCredentialsResourceDetails getResource(String system){
ClientCredentialsResourceDetails resource = new ClientCredentialsResourceDetails();
system tem=(system)(BasicsGM.map.get(system));
resource.setAccessTokenUri(tem.getAccess_token_uri());
resource.setClientId(tem.getClient_id());
resource.setClientSecret(tem.getClient_secret());
resource.setGrantType(tem.getGrant_type());
return resource;
}
}
package com.offcn.TestUnti;
import java.util.Random;
import java.util.regex.Pattern;
/**
* Created with IntelliJ IDEA.
* Description:
* 手机号正则: ^1[34578][0-9]{9}
* 生成手机号工具类
*
* @author
* Date: 2017-11-09
* Time: 10:24
*/
public class PhoneNoGeneratorUtil {
private static String firstNum = "1";
private static String[] secondNumArray = {"3", "4", "5", "7", "8"};
public static void main(String[] args) {
System.out.println(PhoneNoGeneratorUtil.getPhoneNo());
}
/**
* 调用一次生成一个手机号,手机号后9位数字通过循环生成
*/
public static String getPhoneNo() {
StringBuffer sb = new StringBuffer();
Random random = new Random();
String secondNum = secondNumArray[random.nextInt(secondNumArray.length)];
sb.append(firstNum);
sb.append(secondNum);
for (int i = 0; i < 9; i++) {
Integer thirdNum = random.nextInt(10);
sb.append(thirdNum.toString());
}
return sb.toString();
}
/**
* 当需要生成较大量的手机号时调用该方法
* 后9位数字随机生成,长度不足时则补0
*/
public String getMultiPhoneNo() {
StringBuffer sb = new StringBuffer();
Random random = new Random();
String secondNum = secondNumArray[random.nextInt(secondNumArray.length)];
sb.append(firstNum);
sb.append(secondNum);
Integer thirdNum = 1 + random.nextInt(999999999);
if (thirdNum.toString().length() <= 9) {
sb.append(thirdNum);
for (int i = 1; i <= 9 - thirdNum.toString().length(); i++) {
sb.append(0);
}
} else {
sb.append(thirdNum.toString());
}
return sb.toString();
}
/**
* 手机号校验
*/
public boolean checkPhoneNo(String phoneNum) {
// 定义手机号的规则
String phoneNumPattern = "^1[34578][0-9]{9}";
// 比对phoneNum是否符合定义的规则
boolean result = Pattern.matches(phoneNumPattern, phoneNum);
return result;
}
}
package com.offcn.TestUnti;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import net.sf.json.JSONObject;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
public class ReadExcels {
private String fileName;
private String SheetName;
public ReadExcels() {
}
public ReadExcels(String fileName, String sheetName) {
this.fileName = fileName;
SheetName = sheetName;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getSheetName() {
return SheetName;
}
public void setSheetName(String sheetName) {
SheetName = sheetName;
}
@SuppressWarnings({ "unused", "resource" })
public Object[][] readExcels_return() throws Exception{
String targetFile = "TestData/"+fileName;
FileInputStream fis = new FileInputStream(new File(targetFile));
Workbook wb = WorkbookFactory.create(new File(targetFile));
Sheet sheet = wb.getSheet(SheetName);
int rows=sheet.getPhysicalNumberOfRows();
//有多少行数据就创建多少个map,首行是标题第二行开始才是数据,所以rows-1
@SuppressWarnings("unchecked")
HashMap<String, Object>[][] arrmap = new HashMap[rows-1][1];
List<String> list = new ArrayList<String>();
//每个子map分别为arrmap[0][0]、arrmap[1][0]、arrmap[2][0]。。。
for(int i = 1 ; i < sheet.getPhysicalNumberOfRows() ; i++){
arrmap[i-1][0] = new HashMap<>();
}
//获取标题行数据存放在list里面
for(int i = 0 ; i < 1 ; i++){
Row r = sheet.getRow(i);
for (int j = 0; j < r.getPhysicalNumberOfCells(); j++) {
Cell cell = r.getCell(j);
list.add(getCellValue(cell));
}
}
Log.logInfo("数据源读取记录:共有几列数据="+list.size());
Log.logInfo("数据源读取记录:共有几行数据="+arrmap.length);
for(int i = 1 ; i < sheet.getPhysicalNumberOfRows() ; i++){
Row r = sheet.getRow(i);
for (int j = 0; j < r.getPhysicalNumberOfCells(); j++) {
Cell cell = r.getCell(j);
String brandName=getCellValue(cell);
if (!brandName.equals("null")){//如果单元格不等于空,才进行存储
// System.out.println("i="+i+",j="+j);
arrmap[i - 1][0].put(list.get(j), brandName);//分别往每个子map中存放数据,每行是一个map
}
}
}
/**
* 查看数据提取结果
for(int i=0;i<arrmap.length;i++){
for(int j=0;j<arrmap[i].length;j++){
System.out.print(" "+arrmap[i][j]);
}
System.out.println();
}
for(int i=0;i<arrmap.length;i++){
HashMap<String, Object> arr=arrmap[i][0];
System.out.println("处理后数据="+JSONObject.fromObject(arr).toString());
}
*/
return arrmap;
}
private String getCellValue(Cell cell){
int cellType=0;
try {
cellType = cell.getCellType();
} catch (Exception e) {
return "无法解析";
}
String value = "";
if(cellType == Cell.CELL_TYPE_STRING){
value = cell.getStringCellValue();
}else if(cellType == Cell.CELL_TYPE_NUMERIC){
value = String.valueOf(cell.getNumericCellValue());
}else if(cellType == Cell.CELL_TYPE_BOOLEAN){
value = String.valueOf(cell.getBooleanCellValue());
}else if(cellType == Cell.CELL_TYPE_BLANK){
value = "";
}else if(cellType == Cell.CELL_TYPE_FORMULA){
value = String.valueOf(cell.getCellFormula());
}else{
value = "";
}
return value;
}
}
package com.offcn.TestUnti;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class ReadProperties {
public static void main(String[] args) {
// String s=ReadProperties.GetPropertyByKey("rgxs");
// System.out.println(s);
// ClearProperty();
// SetProperty("123","111");
}
public static String GetPropertyByKey(String key) {
Properties pps = new Properties();
try {
File directory = new File(".");
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"class.properties";
InputStream in = new BufferedInputStream (new FileInputStream(sourceFile));
pps.load(in);
String value = pps.getProperty(key);
return value;
}catch (IOException e) {
return null;
}
}
//得到information中的值
public static String GetinformationByKey(String key) {
Properties pps = new Properties();
try {
File directory = new File(".");
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"information.properties";
InputStream in = new BufferedInputStream (new FileInputStream(sourceFile));
pps.load(in);
String value = pps.getProperty(key);
return value;
}catch (IOException e) {
return null;
}
}
//
public static void updateProperty(String name,String value){
Properties prop = new Properties();// 属性集合对象
File directory = new File(".");
try {
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"information.properties";
FileInputStream fis = new FileInputStream(sourceFile);// 属性文件输入流
prop.load(fis);// 将属性文件流装载到Properties对象中
fis.close();// 关闭流
// 获取属性值,sitename已在文件中定义
// System.out.println("获取属性值:password=" + prop.getProperty("password"));
// 获取属性值,country未在文件中定义,将在此程序中返回一个默认值,但并不修改属性文件
// System.out.println("获取属性值:country=" + prop.getProperty("country", "中国"));
// 修改sitename的属性值
prop.setProperty(name, value);
// 文件输出流
FileOutputStream fos = new FileOutputStream(sourceFile);
// 将Properties集合保存到流中
prop.store(fos,"");
fos.close();// 关闭流
// Log.logInfo("成功保存环境信息文件。");
} catch (IOException e) {
// Log.logError("保存环境信息文件失败。");
e.printStackTrace();
}
}
//判断Properties文件是否为空
public static boolean isBoolean(){
File directory = new File(".");
try {
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"information.properties";
Properties prop = new Properties();// 属性集合对象
FileInputStream fis = new FileInputStream(sourceFile);// 属性文件输入流
prop.load(fis);// 将属性文件流装载到Properties对象中
boolean b=prop.isEmpty();
fis.close();// 关闭流
return b;
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
public static void ClearProperty() {
File directory = new File(".");
try {
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"information.properties";
File file =new File(sourceFile);
if(!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter =new FileWriter(file);
fileWriter.write("");
fileWriter.flush();
fileWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static String GetPropertyByClassName(String key) {
Properties pps = new Properties();
try {
File directory = new File(".");
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"reflect.properties";
InputStream in = new BufferedInputStream (new FileInputStream(sourceFile));
pps.load(in);
String value = pps.getProperty(key);
return value;
}catch (IOException e) {
return null;
}
}
public static String GetPropertyByClassName(String key,String qudao) {
Properties pps = new Properties();
try {
File directory = new File(".");
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+qudao+"_reflect.properties";
InputStream in = new BufferedInputStream (new FileInputStream(sourceFile));
pps.load(in);
String value = pps.getProperty(key);
return value;
}catch (IOException e) {
return null;
}
}
}
package com.offcn.TestUnti;
import com.offcn.process.BasicsGM;
import com.offcn.system.system;
import redis.clients.jedis.*;
public class RedisUtils {
public enum RedisPath{
LOGINVERIFYCODE("bestbuy:customer:sendCode:app:login:"),
SETDEALVERIFYCODE("bestbuy:customer:sendCode:app:setDeal:");
private String path;
RedisPath(String redisPath){
this.path = redisPath;
}
public String toString(){
return this.path.toString();
}
}
//获取电话号码所对应的验证码采用redis方式
public String getVerifyCode(String phoneNumber){
system tem=(system)(BasicsGM.map.get("gmysx"));
String verifyCode=null;
Jedis jedis = new Jedis(tem.getRedis_URI());
jedis.auth("2xqPR2i7OoiKn5bs8tI0");
jedis.select(Integer.valueOf(tem.getRedis_db_index()));
verifyCode=jedis.get(("BESTBUY:CUST:PHONEMSG:"+phoneNumber));
if(verifyCode==null){
Log.logInfo("getVerifyCode Cannot get verifyCode not in Redis for "+ phoneNumber);
verifyCode="";
}
return verifyCode;
}
//获取自营渠道的图片验证码
public String getZyVerifyCode(String phoneNumber){
if(phoneNumber==null){
phoneNumber="";
}
system tem=(system)(BasicsGM.map.get("zy"));
String verifyCode=null;
Jedis jedis = new Jedis(tem.getRedis_URI());
jedis.auth("2xqPR2i7OoiKn5bs8tI0");
jedis.select(Integer.valueOf(tem.getRedis_db_index()));
verifyCode=jedis.get(("bestbuy:customer:imgCode:app:register:"+phoneNumber));
if(verifyCode==null){
Log.logInfo("getZyVerifyCode Cannot get verifyCode not in Redis for "+ phoneNumber);
verifyCode="";
}
Log.logInfo("自营渠道的图片验证码:"+verifyCode);
return verifyCode;
}
//获取自营3.0渠道的图片验证码
public String getZy3VerifyCode(String phoneNumber){
if(phoneNumber==null){
phoneNumber="";
}
system tem=(system)(BasicsGM.map.get("zy3"));
String verifyCode=null;
Jedis jedis = new Jedis(tem.getRedis_URI());
jedis.auth("2xqPR2i7OoiKn5bs8tI0");
jedis.select(Integer.valueOf(tem.getRedis_db_index()));
verifyCode=jedis.get(("bestbuy:customer:imgCode:app:register:v1:"+ phoneNumber));
if(verifyCode==null){//
Log.logInfo("getZyVerifyCode Cannot get verifyCode not in Redis for "+ phoneNumber);
verifyCode="";
}
Log.logInfo("自营渠道的图片验证码:"+verifyCode);
return verifyCode;
}
//自营渠道的短信验证码bestbuy:customer:sendCode:app:register
public String getZyDuanXinCode(String phoneNumber){
system tem=(system)(BasicsGM.map.get("zy"));
String verifyCode=null;
Jedis jedis = new Jedis(tem.getRedis_URI());
jedis.auth("2xqPR2i7OoiKn5bs8tI0");
jedis.select(Integer.valueOf(tem.getRedis_db_index()));
verifyCode=jedis.get(("bestbuy:customer:sendCode:app:register:"+phoneNumber));
if(verifyCode==null){
Log.logInfo("getZyDuanXinCode Cannot get verifyCode not in Redis for "+ phoneNumber);
verifyCode="";
}
Log.logInfo("自营渠道的短信验证码:"+verifyCode);
return verifyCode;
}
//通用方法
public String getRedisCode(RedisPath redisPath,String phoneNumber){
system tem=(system)(BasicsGM.map.get("zy"));
String verifyCode=null;
Jedis jedis = new Jedis(tem.getRedis_URI());
jedis.auth("2xqPR2i7OoiKn5bs8tI0");
jedis.select(Integer.valueOf(tem.getRedis_db_index()));
verifyCode=jedis.get((redisPath.toString()+phoneNumber));
if(verifyCode==null){
Log.logInfo("获取验证码失败,电话: "+ phoneNumber);
verifyCode="";
}
Log.logInfo("获取的验证码为:"+verifyCode);
return verifyCode;
}
//获取蛋壳的注册验证码
public String getDkVerifyCode(String phoneNumber){
if(phoneNumber==null){
phoneNumber="";
}
system tem=(system)(BasicsGM.map.get("dk"));
String verifyCode=null;
Jedis jedis = new Jedis(tem.getRedis_URI());
jedis.auth("2xqPR2i7OoiKn5bs8tI0");
jedis.select(Integer.valueOf(tem.getRedis_db_index()));
verifyCode=jedis.get(("BESTBUY:CUST:PHONEMSG:"+ phoneNumber));
if(verifyCode==null){
Log.logInfo("getDkVerfyCode Cannot get verifyCode not in Redis for "+ phoneNumber);
verifyCode="";
}
Log.logInfo("蛋壳注册验证码为:"+verifyCode);
return verifyCode;
}
public static void main(String[] args) {
RedisUtils ru=new RedisUtils();
System.out.println(ru.getZy3VerifyCode("13910960649"));
// System.out.println(getZyDuanXinCode("13910960649"));
}
}
package com.offcn.TestUnti;
import java.util.HashMap;
import com.offcn.interfaces.API;
/**
* 反射工具类
*
* @author yaoshuai
*
*/
public class Reflect_api {
public API Reflections(HashMap<String, Object> data) {
String ClassName = Reflect_api.getRefleserviceUrlxClassName(data);
API obj = null;
Class c = null;
int count=1;
while(true){
try {
c = Class.forName(ClassName);
break;
}catch (ClassNotFoundException e) {
String serviceUrl = data.get("serviceUrl").toString();
String CalssName_new = serviceUrl.split("/")[serviceUrl.split("/").length - 1];
String system = MapUtil.getValue("system", data);
String classRoute = ReadProperties.GetPropertyByKey(system);
ClassName=classRoute+"process."+CalssName_new;
// Log.logError("Reflect_api,ReflexClass Error,Classname=" + ClassName);
// String system = MapUtil.getValue("system", data);
// String classRoute = ReadProperties.GetPropertyByKey(system);
// count++;
// if(!classRoute.equals("com.offcn.api.xyzb.liucheng")){
//// String serviceUrl = data.get("serviceUrl").toString();
//// ClassName = serviceUrl.split("/")[serviceUrl.split("/").length - 1];
// String classRoute1 = ReadProperties.GetPropertyByKey("gmysx");
// ClassName=ClassName.replaceAll(classRoute, classRoute1);
// }
}
if(count==3){
break;
}
}
try{
obj = (API) c.newInstance();
}catch (InstantiationException e) {
Log.logError("Reflect_api,instantiation Error,Classname="
+ ClassName);
e.printStackTrace();
} catch (IllegalAccessException e) {
Log.logError("Reflect_api,Reflection class is not public Error,Classname="
+ ClassName);
e.printStackTrace();
}
return obj;
}
// 获得数据中serviceUrl所对应的类名
private static String getRefleserviceUrlxClassName(
HashMap<String, Object> data) {
String serviceUrl = data.get("serviceUrl").toString();
String CalssName = serviceUrl.split("/")[serviceUrl.split("/").length - 1];
String system = MapUtil.getValue("system", data);
String classRoute = ReadProperties.GetPropertyByKey(system);
// if ("/order/insert".equals(serviceUrl)) {
// if (serviceUrl.indexOf("/order/insert")!=-1) {
// return classRoute+CalssName + "_dd";
// }
//xuwen-添加对商户(sh)的支持
// if("zy".equals(system) || "sh".equals(system) || "dk".equals(system) ){
// String classReflectName = ReadProperties.GetPropertyByClassName(serviceUrl);
// if ( classReflectName!=null ) {
// return classRoute+ classReflectName;
// }
// }
if("xyzb".equals(system)){
String classReflectName = ReadProperties.GetPropertyByClassName(serviceUrl,system);
if ( classReflectName!=null ) {
return classRoute+ classReflectName;
}
}
return classRoute+CalssName;
}
}
package com.offcn.TestUnti;
import io.restassured.RestAssured;
import io.restassured.config.EncoderConfig;
import io.restassured.config.RestAssuredConfig;
import io.restassured.config.SSLConfig;
import io.restassured.http.ContentType;
import io.restassured.http.Cookies;
import io.restassured.http.Headers;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import com.offcn.system.system;
import static io.restassured.http.ContentType.JSON;
public class RequestDataUtils {
public static void main(String[] args) {
String s="/user/validator/code?phone=13910960649&sendImageCode=CJ6J";
}
//发送请求前的准备
private RestAssured getRMEnv(system tem) {
RestAssured ra = new RestAssured();
ra.config = RestAssuredConfig.newConfig().sslConfig(
SSLConfig.sslConfig().allowAllHostnames());
// System.out.println(""+tem.getRM_URI()+"");
ra.baseURI = tem.getRM_URI();
// System.out.println(tem.getRM_port());
if (tem.getRM_port()!=null && tem.getRM_port().length()>1){
ra.port = Integer.valueOf(tem.getRM_port());
}
// System.out.println(tem.getRM_basePath());
if (tem.getRM_basePath()!=null && tem.getRM_basePath().length()>1){
ra.basePath = tem.getRM_basePath();
}
// RestAssured.config = RestAssured.config().encoderConfig(EncoderConfig.encoderConfig().encodeContentTypeAs("x-www-form-urlencoded", ContentType.ANY).defaultContentCharset("utf-8"));
return ra;
}
//不带token的post请求
public static Response Post_headers(HashMap<String, Object> data, String serviceURL,String zgl_clienttype) {
// 设置参数格式
String Parameter = (String) data.get("parameter");
String system = MapUtil.getValue("system", data);
com.offcn.system.system tem = (com.offcn.system.system) (BasicsGM.map.get(system));
Log.logInfo(data.get("Description").toString() + "," + data.get("TCNO").toString() + ",Parameter=" + Parameter);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
re = rdu.getRMEnv(tem).given()
.header("zgl-systemtype", "Windows")
.header("zgl-clienttype", zgl_clienttype)
.contentType(JSON).body("{"+Parameter+"}").when()
.post(serviceURL).thenReturn();
// System.out.println(re.getStatusCode()+"............................");
// System.out.println(re.asString());
JsonPath jp = re.body().jsonPath();
if ("500".equals(jp.getString("status"))) {
Log.logError("请求返回500," + state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
e.printStackTrace();
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
//不带token的post请求
public static Response Post_NOToken(HashMap<String, Object> data, String serviceURL) {
// 设置参数格式
String Parameter = (String) data.get("parameter");
String system = MapUtil.getValue("system", data);
com.offcn.system.system tem = (com.offcn.system.system) (BasicsGM.map.get(system));
Log.logInfo(data.get("Description").toString() + "," + data.get("TCNO").toString() + ",Parameter=" + Parameter);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
if("/web/member".equals(serviceURL)){
// Cookie cookie1 = Cookie.Builder("username", "John").setComment("comment 1").build();
// Cookie cookie2 = Cookie.Builder("token", 1234).setComment("comment 2").build();
// Cookies cookies = new Cookies(cookie1, cookie2);
// System.out.println(XYZB.laravel_session);
// System.out.println(Parameter);
re = rdu.getRMEnv(tem).given()
// .header("laravel_session", XYZB.laravel_session)
// .header("XSRF-TOKEN", XYZB.XSRF_token)
.cookie("laravel_session", XYZB.laravel_session)
.cookie("XSRF-TOKEN", XYZB.XSRF_token)
.contentType(JSON).body("{"+Parameter+"}").when()
.post(serviceURL).thenReturn();
// System.out.println(re.getStatusCode()+"............................");
// System.out.println(re.asString());
// Headers headers=re.getHeaders();
// System.out.println(headers.toString());
// System.out.println(re.getSessionId());
// JsonPath jp = re.body().jsonPath();
if (!"200".equals(re.getStatusCode()+"")) {
Log.logError("请求返回:" +re.getStatusCode()+",第"+ state + "次。");
Thread.sleep(1000);
} else {
return re;
}
}else{
re = rdu.getRMEnv(tem).given()
// .header("laravel_session", XYZB.laravel_session)
.cookie("laravel_session", XYZB.laravel_session)
.contentType(JSON).body("{"+Parameter+"}").when()
.post(serviceURL).thenReturn();
// System.out.println(re.getStatusCode()+"............................");
// System.out.println(re.asString());
JsonPath jp = re.body().jsonPath();
if ("500".equals(jp.getString("status"))) {
Log.logError("请求返回500," + state + "次。");
Thread.sleep(1000);
} else {
return re;
}
}
} catch (Exception e) {
e.printStackTrace();
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
//不带token的post请求
@SuppressWarnings("static-access")
public static Response Post_NOtokenNOcookie(HashMap<String, Object> data, String serviceURL) {
// 设置参数格式
String Parameter = (String) data.get("parameter");
String system = MapUtil.getValue("system", data);
com.offcn.system.system tem = (com.offcn.system.system) (BasicsGM.map.get(system));
Log.logInfo(data.get("Description").toString() + "," + data.get("TCNO").toString() + ",Parameter=" + Parameter);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
re = rdu.getRMEnv(tem).given()
.contentType(JSON).body("{"+Parameter+"}").when()
.post(serviceURL).thenReturn();
if (!"200".equals(re.getStatusCode()+"")) {
Log.logError("请求返回," + re.getStatusCode() + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
e.printStackTrace();
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
//需要添加token的post,json请求
@SuppressWarnings("static-access")
public static Response Post_token(HashMap<String, Object> data, String serviceURL, String token) {
// 设置参数格式
String Parameter = (String) data.get("parameter");
String system = MapUtil.getValue("system", data);
com.offcn.system.system tem = (com.offcn.system.system) (BasicsGM.map.get(system));
Log.logInfo(data.get("Description").toString() + "," + data.get("TCNO").toString() + ",Parameter=" + Parameter);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
// re = rdu.getRMEnv(tem).given().cookie("laravel_session", XYZB.laravel_session).when().get("http://live.offcncloud.com/web/admin").thenReturn();
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token)
.contentType(JSON).body("{"+Parameter+"}").when()
.post(serviceURL).thenReturn();
// System.out.println(MapUtil.showMap_String(re.getCookies()));
if (!"200".equals(re.getStatusCode()+"")) {
Log.logError("请求返回:" +re.getStatusCode()+",第"+ state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
//发送get请求返回整个响应结果
@SuppressWarnings("static-access")
public static Response Get_Noparameter(HashMap<String, Object> data,
String serviceURL,String token) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
int state=0;
Response re=null;
RequestDataUtils rdu=new RequestDataUtils();
while(state<3){
try {
state++;
if(parameter != null && !"".equals(parameter)) {
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token).get(serviceURL + "/" + parameter).andReturn();
}else{
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token).get(serviceURL).andReturn();
}
if(!"200".equals(re.statusCode()+"")){
Log.logError("请求返回"+re.statusCode()+"次。");
}else{
return re;
}
} catch (Exception e) {
Log.logError("请求超时,"+state+"次。");
}
}
return re;
}
//发送get请求返回整个响应结果
@SuppressWarnings("static-access")
public static Response Get_token(HashMap<String, Object> data,
String serviceURL,String token) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
int state=0;
Response re=null;
RequestDataUtils rdu=new RequestDataUtils();
while(state<3){
try {
state++;
if(parameter != null && !"".equals(parameter)) {
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token).get(serviceURL + "?" + parameter).andReturn();
}else {
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token).get(serviceURL).andReturn();
}
if(!"200".equals(re.statusCode()+"")){
Log.logError("请求返回"+re.statusCode()+"次。");
}else{
return re;
}
} catch (Exception e) {
Log.logError("请求超时,"+state+"次。");
}
}
return re;
}
//get错误token请求
@SuppressWarnings("static-access")
public static Response Get_Errtoken(HashMap<String, Object> data,
String serviceURL,String token) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
int state=0;
Response re=null;
RequestDataUtils rdu=new RequestDataUtils();
while(state<5){
try {
state++;
if(parameter != null && !"".equals(parameter)) {
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token+"1").get(serviceURL + "/" + parameter).andReturn();
}else {
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token+"1").get(serviceURL).andReturn();
}
if("500".equals(re.statusCode()+"")){
Log.logError("请求返回500,"+state+"次。");
}else{
return re;
}
} catch (Exception e) {
Log.logError("请求超时,"+state+"次。");
}
}
return re;
}
//get超长token请求
@SuppressWarnings("static-access")
public static Response Get_Longtoken(HashMap<String, Object> data,
String serviceURL,String token) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
int state=0;
Response re=null;
RequestDataUtils rdu=new RequestDataUtils();
while(state<5){
try {
state++;
if(parameter != null && !"".equals(parameter)) {
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token+token+token+token+token).get(serviceURL + "/" + parameter).andReturn();
}else {
re = rdu.getRMEnv(tem).given().header("Authorization", "Bearer "+ token+token+token+token+token).get(serviceURL).andReturn();
}
if("500".equals(re.statusCode()+"")){
Log.logError("请求返回500,"+state+"次。");
}else{
return re;
}
} catch (Exception e) {
Log.logError("请求超时,"+state+"次。");
}
}
return re;
}
//get无token请求
@SuppressWarnings("static-access")
public static Response Get_Notoken(HashMap<String, Object> data,
String serviceURL) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
int state=0;
Response re=null;
RequestDataUtils rdu=new RequestDataUtils();
while(state<5){
try {
state++;
re = rdu.getRMEnv(tem).given().cookie("laravel_session",XYZB.laravel_session).get(serviceURL).andReturn();
// System.out.println(re.asString());
if(!"200".equals(re.statusCode()+"")){
Log.logError("请求返回,"+re.statusCode()+"。");
}else{
return re;
}
} catch (Exception e) {
Log.logError("请求超时,"+state+"次。");
}
}
return re;
}
//get无token请求
@SuppressWarnings("static-access")
public static Response Get_Notoken_NoCookie(HashMap<String, Object> data,
String serviceURL) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
int state=0;
Response re=null;
RequestDataUtils rdu=new RequestDataUtils();
while(state<5){
try {
state++;
re = rdu.getRMEnv(tem).given().get(serviceURL).andReturn();
// System.out.println(re.asString());
if(!"200".equals(re.statusCode()+"")){
Log.logError("请求返回,"+re.statusCode()+"。");
}else{
return re;
}
} catch (Exception e) {
Log.logError("请求超时,"+state+"次。");
}
}
return re;
}
@SuppressWarnings("static-access")
public static Response Get_cookie(HashMap<String, Object> data,
String serviceURL) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
int state=0;
Response re=null;
RequestDataUtils rdu=new RequestDataUtils();
while(state<5){
try {
state++;
re = rdu.getRMEnv(tem).given()
.cookie("laravel_session",XYZB.laravel_session)
.cookie("XSRF-TOKEN", XYZB.XSRF_token)
.get(serviceURL).andReturn();
if(!"200".equals(re.statusCode()+"")){
Log.logError("请求返回,"+re.statusCode()+"。");
}else{
return re;
}
} catch (Exception e) {
Log.logError("请求超时,"+state+"次。");
}
}
return re;
}
//带token的pout请求
@SuppressWarnings("deprecation")
public static Response Put_Token(HashMap<String, Object> data,String token, String serviceURL,Map<String, Object> jsonAsMap) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
// 设置参数格式
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
re = rdu.getRMEnv(tem).given().config(RestAssured.config()
.encoderConfig(EncoderConfig.encoderConfig()
.encodeContentTypeAs("x-www-form-urlencoded", ContentType.ANY)
.defaultContentCharset("utf-8")))
.header("Authorization","Bearer "+ token)
.formParameters(jsonAsMap).
// .formParam("start_time", "2018-08-31 22:19:42")
// .formParam("end_time", "2018-08-31 23:00:00")
// .formParam("room_name", "呜呜呜呜22s11")
// .formParam("office_type", "国家公务员")
// .formParam("province", "北京")
// .formParam("city", "市辖区")
// .formParam("area", "东城区").
when().put(serviceURL).thenReturn();
JsonPath jp = re.body().jsonPath();
if ("500".equals(jp.getString("status"))) {
Log.logError("请求返回500," + state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
e.printStackTrace();
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
//带token的del请求
public static Response Del_Token(HashMap<String, Object> data,String token, String serviceURL) {
//设置参数格式
String parameter= MapUtil.getParameter(data);
String system= MapUtil.getValue("system", data);
com.offcn.system.system tem=(com.offcn.system.system)(BasicsGM.map.get(system));
parameter=parameter.substring(1, parameter.length()-1);
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+",Parameter="+parameter);
// 设置参数格式
Log.logInfo("serviceURL=" + serviceURL + ",Parameter=" + token);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
re = rdu.getRMEnv(tem).given().header("Authorization","Bearer "+ token).
when().delete(serviceURL).thenReturn();
JsonPath jp = re.body().jsonPath();
if ("500".equals(jp.getString("status"))) {
Log.logError("请求返回500," + state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
}
package com.offcn.TestUnti;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import jxl.*;
import jxl.format.Colour;
import jxl.read.biff.BiffException;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
public class SheetUtils {
public Workbook workbook;
public Sheet sheet;
public Cell cell;
int rows;
int columns;
public String fileName;
public String sheetName;
public ArrayList<String> arrkey = new ArrayList<String>();
String sourceFile;
/**
* @param fileName
* excel鏂囦欢鍚�
* @param caseName
* sheet鍚�
*/
public SheetUtils(String fileName, String sheetName) {
super();
this.fileName = fileName;
this.sheetName = sheetName;
}
public Object[][] getExcelData() {
try {
workbook = Workbook.getWorkbook(new File(getPath()));
} catch (BiffException | IOException e) {
e.printStackTrace();
}
sheet = workbook.getSheet(sheetName);
rows = sheet.getRows();
columns = sheet.getColumns();
@SuppressWarnings("unchecked")
HashMap<String, Object>[][] arrmap = new HashMap[rows - 1][1];
if (rows > 1) {
for (int i = 0; i < rows - 1; i++) {
arrmap[i][0] = new HashMap<>();
}
} else {
System.out.println("excel no data");
}
for (int c = 0; c < columns; c++) {
String cellvalue = sheet.getCell(c, 0).getContents();
arrkey.add(cellvalue);
}
for (int r = 1; r < rows; r++) {
for (int c = 0; c < columns; c++) {
Object cellvalue = getCellValue(c, r);
if (cellvalue != null)
arrmap[r - 1][0].put(arrkey.get(c), getCellValue(c, r));
}
}
// for(int i=0;i<arrmap.length;i++){
// for(int j=0;j<arrmap[i].length;j++){
// System.out.println("i="+i+",j="+j);
// System.out.println("arr="+arrmap[i][j]);
// }
// }
return arrmap;
}
public Object getCellValue(int c, int r) {
Object cellvalue = null;
Cell cell = sheet.getCell(c, r);
if (cell.getContents().equals("null")) {
return null;
}
if (sheet.getCell(c, 0).getContents().equals("list")) {
}
if (cell.getType() == CellType.LABEL) {
LabelCell nc = (LabelCell) cell;
return nc.getString();
}
if (cell.getType() == CellType.DATE) {
DateCell nc = (DateCell) cell;
return nc.getDate();
}
if (cell.getType() == CellType.NUMBER) {
NumberCell nc = (NumberCell) cell;
return nc.getValue();
}
return cellvalue;
}
/**
* 鑾峰緱excel鏂囦欢鐨勮矾寰�
*
* @return
* @throws IOException
*/
public String getPath() throws IOException {
sourceFile = "TestData/"+fileName;
return sourceFile;
}
public void writeExcel(String NO,String caseNo, String input,String Description,
String statusline, String resbody,String codeORerrcode,String msgORerrmsy,
String result,String time) {
File file;
try {
// System.out.println(getPath());
file = new File(getPath());
Workbook rwb = Workbook.getWorkbook(file);
File tempfile = new File("TestData/"+fileName);
WritableWorkbook wwb = Workbook.createWorkbook(tempfile, rwb);
WritableSheet ws = wwb.getSheet(sheetName);
if (ws == null) {
ws = wwb.createSheet(sheetName, 0);
}
int rows = ws.getRows();
WritableFont wf = new WritableFont(WritableFont.TAHOMA);
wf.setPointSize(10);
WritableCellFormat wcf = new WritableCellFormat(wf);
ws.addCell(new Label(0, rows, NO, wcf));
ws.addCell(new Label(1, rows, caseNo, wcf));
ws.addCell(new Label(2, rows, input, wcf));
ws.addCell(new Label(3, rows, Description, wcf));
ws.addCell(new Label(4, rows, statusline, wcf));
ws.addCell(new Label(5, rows, resbody, wcf));
ws.addCell(new Label(6, rows, codeORerrcode, wcf));
ws.addCell(new Label(7, rows, msgORerrmsy, wcf));
ws.addCell(new Label(8, rows, time, wcf));
if (result.equals("Pass")) {
wf = new WritableFont(WritableFont.TAHOMA);
wcf = new WritableCellFormat(wf);
wf.setColour(Colour.GREEN);
} else if (result.contains("Fail")) {
wf = new WritableFont(WritableFont.TAHOMA);
wcf = new WritableCellFormat(wf);
wf.setColour(Colour.RED);
} else {
wf = new WritableFont(WritableFont.TAHOMA);
wcf = new WritableCellFormat(wf);
wf.setColour(Colour.YELLOW);
}
ws.addCell(new Label(9, rows, result, wcf));
wwb.write();
wwb.close();
rwb.close();
file.delete();
tempfile.renameTo(file);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void writeExcel(String c1, String c2, String c3) {
File file;
try {
file = new File(getPath());
Workbook rwb = Workbook.getWorkbook(file);
File tempfile = new File("TestData/"+fileName);
WritableWorkbook wwb = Workbook.createWorkbook(tempfile, rwb);
WritableSheet ws = wwb.getSheet(sheetName);
if (ws == null) {
ws = wwb.createSheet(sheetName, 0);
}
int rows = ws.getRows();
ws.addCell(new Label(0, rows, c1));
ws.addCell(new Label(1, rows, c2));
ws.addCell(new Label(2, rows, c3));
wwb.write();
wwb.close();
rwb.close();
file.delete();
tempfile.renameTo(file);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void cleanAndWriteToSheet(String[][] array) {
File file;
try {
file = new File(getPath());
Workbook rwb = Workbook.getWorkbook(file);
File tempfile = new File("TestData/"+fileName);
WritableWorkbook wwb = Workbook.createWorkbook(tempfile, rwb);
WritableSheet ws = wwb.getSheet(sheetName);
if (ws == null) {
ws = wwb.createSheet(sheetName, 0);
}
int rows = ws.getRows();
for (int i = 0; i < rows - 1; i++) {
ws.removeRow(i);
}
for (int r = 0; r < array.length - 1; r++) {
for (int c = 0; c < array[r].length - 1; c++) {
ws.addCell(new Label(c, r, array[r][c]));
}
}
wwb.write();
wwb.close();
rwb.close();
file.delete();
tempfile.renameTo(file);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package com.offcn.TestUnti;
import java.util.ArrayList;
public class StringUtils {
public static void main(String[] args) {
String str="\u64cd\u4f5c\u6210\u529f";
System.out.println(decodeUnicode(str));
}
//字符串按符号分隔
public static String[] getArrayString(String custom,String Symbol){
return custom.split(Symbol);
}
//长字符串中是否分别包含字符串数据
public static boolean VerificationString(String custom,String[] ArrayString){
for(int i=0;i<ArrayString.length;i++){
if(!custom.contains(ArrayString[i])){
return false;
}else{
// System.out.println("包含");
continue;
}
}
return true;
}
//Unicode转UTF-8的转化
public static String decodeUnicode(String theString) {
char aChar;
int len = theString.length();
StringBuffer outBuffer = new StringBuffer(len);
for (int x = 0; x < len;) {
aChar = theString.charAt(x++);
if (aChar == '\\') {
aChar = theString.charAt(x++);
if (aChar == 'u') {
// Read the xxxx
int value = 0;
for (int i = 0; i < 4; i++) {
aChar = theString.charAt(x++);
switch (aChar) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
value = (value << 4) + aChar - '0';
break;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
value = (value << 4) + 10 + aChar - 'a';
break;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
value = (value << 4) + 10 + aChar - 'A';
break;
default:
throw new IllegalArgumentException(
"Malformed \\uxxxx encoding.");
}
}
outBuffer.append((char) value);
} else {
if (aChar == 't')
aChar = '\t';
else if (aChar == 'r')
aChar = '\r';
else if (aChar == 'n')
aChar = '\n';
else if (aChar == 'f')
aChar = '\f';
outBuffer.append(aChar);
}
} else
outBuffer.append(aChar);
}
return outBuffer.toString();
}
}
package com.offcn.TestUnti;
import java.io.File;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import com.offcn.system.system;
public class XMLread {
public static void main(String[] args) {
XMLread xml=new XMLread();
@SuppressWarnings("unchecked")
Map<String,Object> map=(Map<String, Object>) xml.getSystem();
system ysx=(system) map.get("Gm_ysx");
system dd=(system) map.get("Gm_dd");
System.out.println(ysx.getRM_port());
System.out.println(dd.getRM_port());
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map<String, Object> getSystem(){
Document document = null;
Object obj=null;
Method met=null;
Map<String,Object> map=new HashMap<String,Object>();
try {
SAXReader saxReader = new SAXReader();
document = saxReader.read(new File("src/resources/system.xml")); // 读取XML文件,获得document对象
// 获取根节点
Element root = document.getRootElement();
// 获取根节点下的子节点
for (Iterator i = root.elementIterator(); i.hasNext();) {
// 将每个子节点赋给el
Element el = (Element) i.next();
// 如果节点的名称为“system”,system元素属性name=参数// && systemName.equals(el.attribute("name").getValue())
if ("system".equals(el.getName())) {// 获取节点元素的名称
Class c=Class.forName("com.offcn.system.system");
obj=(Object) c.newInstance();
for (Iterator it = el.elementIterator(); it.hasNext();) {
Element elchild = (Element) it.next();
met=c.getDeclaredMethod(getMethodName(elchild.getName()), String.class);
met.invoke(obj, elchild.getText());
map.put(el.attribute("name").getValue(), obj);
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return map;
}
//获取注入得方法名
private String getMethodName(String str){
String s="set"+str.substring(0,1).toUpperCase()+str.substring(1,str.length());
return s;
}
}
package com.offcn.TestUnti;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import net.sf.json.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import sun.misc.BASE64Decoder;
/**
* 图片识别类
* 第一个参数:几位的中英数
* 第二个参数:图片地址
* 返回解析好的字符串
* @author puhui
*/
public class aliOCR {
public static void main(String[] args) {
// getYZM(6,"d:\\a1.jpg");
getYZM(4,"d:\\t1.jpg");
}
public static String getYZM(int count,String imagePath){
String host = "http://ali-checkcode.showapi.com";
String path = "/checkcode";
String method = "POST";
Map<String, String> headers = new HashMap<String, String>();
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
headers.put("Authorization", "APPCODE 4afc3a5a191a4bbd80b837c3374ac872");
Map<String, String> querys = new HashMap<String, String>();
Map<String, String> bodys = new HashMap<String, String>();
bodys.put("convert_to_jpg", "0");
bodys.put("img_base64", encodeImgageToBase64(new File(imagePath)));
bodys.put("typeId", "30"+count+"0");
String result=null;
try {
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
result=EntityUtils.toString(response.getEntity());
JSONObject obj = JSONObject.fromObject(result);
result=obj.getString("showapi_res_body");
JSONObject obj1 = JSONObject.fromObject(result);
result=obj1.get("Result").toString();
System.out.println("获取的验证码是:"+obj1.get("Result"));
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
//图片转化成base64字符串
public static String encodeImgageToBase64(File imageFile) {// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
// 其进行Base64编码处理
byte[] data = null;
// 读取图片字节数组
try {
InputStream in = new FileInputStream(imageFile);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
return new String(Base64.encodeBase64(data));
}
//base64字符串转化成图片
public static boolean GenerateImage(String FilePath,String imgStr)
{ //对字节数组字符串进行Base64解码并生成图片
if (imgStr == null) //图像数据为空
return false;
BASE64Decoder decoder = new BASE64Decoder();
try
{
//Base64解码
byte[] b = decoder.decodeBuffer(imgStr);
for(int i=0;i<b.length;++i)
{
if(b[i]<0)
{//调整异常数据
b[i]+=256;
}
}
//生成jpeg图片
String imgFilePath = FilePath;//新生成的图片
OutputStream out = new FileOutputStream(imgFilePath);
out.write(b);
out.flush();
out.close();
return true;
}
catch (Exception e)
{
return false;
}
}
}
package com.offcn.TestUnti;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class cmdUtil {
public static String run(String cmdString) {
Runtime runtime = Runtime.getRuntime();
StringBuffer b=null;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(runtime.exec(cmdString).getInputStream(),"GBK"));
//StringBuffer b = new StringBuffer();
String line=null;
b=new StringBuffer();
while ((line=br.readLine())!=null) {
b.append(line+"\n");
}
// System.out.println(b.toString());
} catch (Exception e) {
e.printStackTrace();
}
return b.toString();
}
public static void main(String[] args) {
cmdUtil delp = new cmdUtil();
System.out.println(delp.run("nslookup www.qq.com").contains("Address: 192.168.10.222"));
// delp.run("nslookup www.qq.com");
// delp.run("netsh interface ip set dns \"无线网络连接\" static 192.168.10.222");
}
}
package com.offcn.TestUnti;
import java.text.SimpleDateFormat;
public class randomUtil {
public static String dateString(){
SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmmss");
String dateStr = dateformat.format(System.currentTimeMillis());
return dateStr;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 添加公告
*
* @author puhui
*
*/
public class announce extends XYZB implements API {
public String parameter;//参数集合
public String uuid;
public String nickname;
public String create_time;
public String token_room_num;
public String content;//公告内容
public String id;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_announcement a",
" a.uuid = '" + Current_uuid + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_announcement info is not in DB;";
} else {
String act_uuid = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("uuid")));
String act_nickname = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("nickname")));
String act_create_time = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("create_time")));
String act_token_room_num = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("token_room_num")));
String act_content = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("content")));
Current_announcement_id=String.
valueOf(rs_bankcard.getString(rs_bankcard.findColumn("id")));
uuid = MapUtil.killQuotes(jp.getString("data.uuid"), "\"");//去掉双引号的uuid
nickname = MapUtil.killQuotes(jp.getString("data.nickname"), "\"");//去掉双引号的uuid
create_time = MapUtil.killQuotes(jp.getString("data.create_time"), "\"");//去掉双引号的uuid
token_room_num = MapUtil.killQuotes(jp.getString("data.token_room_num"), "\"");//去掉双引号的uuid
content = MapUtil.killQuotes(jp.getString("data.content"), "\"");//去掉双引号的uuid
id = MapUtil.killQuotes(jp.getString("data.id"), "\"");//去掉双引号的uuid
if ((!act_uuid.equals(uuid))
|| (!act_nickname.equals(StringUtils.decodeUnicode(nickname)))
|| (!act_create_time.contains(create_time))
|| (!act_token_room_num.equals(token_room_num))
|| (!act_content.contains(content))){
result = result && false;
failReason = failReason + "xyu_announcement info in DB is wrong;";
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_announcement info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 删除公告信息
*
* @author puhui
*
*/
public class announce_del extends XYZB implements API {
public String parameter;//参数集合
public String Description;//参数集合
public String id;//文件id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
id = MapUtil.getParameter(parameter, "id").trim();
if ((!id.equals("")) && id.equals("code")) {
parameter = Current_announcement_id;
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的Othercode
data.put("parameter", parameter);
return data;
}
if ((!id.equals("")) && id.equals("Othercode")) {
parameter = Integer.valueOf(Current_id)-2+"";
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的Othercode
data.put("parameter", parameter);
return data;
}
data.put("parameter", id);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
parameter = MapUtil.getValue("parameter", data);
Response re = RequestDataUtils.Del_Token(data,Client_token, "/api/v1/announce/"+parameter);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_files f ",
" f.id = '" + Current_id + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow()!=0){
result = result && false;
failReason = failReason + "xyu_room_files info in DB is wrong;";
} else {
Log.logInfo("xyu_room_files info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取公告列表
*
* @author puhui
*
*/
public class announce_get extends XYZB implements API {
public String parameter;//参数集合
public String Description;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/announce", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/announce", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken(data, "/api/v1/announce");
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, "/api/v1/announce",Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if((data.get("custom") != null) && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null) {
parameter = MapUtil.getValue("parameter", data);
String dataarr[] =jp.getString("data.data").split("]");
System.out.println(jp.getString("data.data"));
try {
ResultSet xyu_announcement=null;
xyu_announcement = this.selectFromDB(
" xyu_announcement a ",
" a.token_room_num = '" + Current_room + "' ");
xyu_announcement.last();
// System.out.println(dataarr.length);
// System.out.println(xyu_announcement.getRow());
if (xyu_announcement.getRow()!=dataarr.length) {
result = result && false;
failReason = failReason + "xyu_announcement.getRow() is not dataarr.length;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_announcement info in DB;";
e.printStackTrace();
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 提交回答
*
* @author puhui
*
*/
public class answer extends XYZB implements API {
public String parameter;//参数集合
public String id;//
public String answer;//
public String private_;//
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
id = MapUtil.getParameter(parameter, "id").trim();
answer = MapUtil.getParameter(parameter, "answer").trim();
private_ = MapUtil.getParameter(parameter, "private").trim();
if ((!id.equals("")) && id.equals("code")) {
id=Current_questions_id;
parameter = parameter.replace("\"id\":code", "\"id\":\""+ Current_questions_id + "\"");
}
if ((!answer.equals("")) && answer.equals("random")) {
answer="我也不会啊。。。";
parameter = parameter.replace("\"answer\":random", "\"answer\":\""+ answer + "\"");
}
if (!private_.equals("")) {
parameter = parameter.replace("\"private_\"", "\"private\"");
}
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
private_ = MapUtil.killQuotes(private_, "\"");//去掉双引号的private_
answer = MapUtil.killQuotes(answer, "\"");//去掉双引号的answer
id = MapUtil.killQuotes(id, "\"");//去掉双引号的id
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_answer ",
" 1 = 1");
rs_bankcard.last();
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_room_answer info is not in DB;";
} else {
String act_id = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("id")));
String act_answer = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("answer")));
act_answer = MapUtil.killQuotes(act_answer, "\"");
String act_question_id = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("question_id")));
String act_private = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("private")));
// System.out.println(private_);
// System.out.println(act_private);
// System.out.println(answer);
// System.out.println(StringUtils.decodeUnicode(act_answer));
// System.out.println(id);
// System.out.println(act_question_id);
if ((!private_.equals(act_private))
|| (!answer.equals(StringUtils.decodeUnicode(act_answer)))
|| (!id.equals(act_question_id))){
result = result && false;
failReason = failReason + "xyu_room_answer info in DB is wrong;";
}
}
} catch (Exception e) {
e.printStackTrace();
result = result && false;
failReason = failReason + "cannot verify xyu_room_answer info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 禁止提问
*
* @author puhui
*
*/
public class ask_status extends XYZB implements API {
public String parameter;//参数集合
public String Description;//参数集合
public String is_ask;//
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
is_ask = MapUtil.getParameter(parameter, "is_ask").trim();
is_ask=MapUtil.killQuotes(is_ask, "\"");
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
jsonAsMap.put("is_ask", is_ask);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, Url,jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
rs_bankcard.last();
String act_is_ask = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("is_ask")));
if (!is_ask.equals(act_is_ask)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
} else {
Log.logInfo("xyu_room info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 全员禁言
*
* @author puhui
*
*/
public class banned_status extends XYZB implements API {
public String parameter;//参数集合
public String Description;//参数集合
public String is_banned;//
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
is_banned = MapUtil.getParameter(parameter, "is_banned").trim();
is_banned=MapUtil.killQuotes(is_banned, "\"");
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
jsonAsMap.put("is_banned", is_banned);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, Url,jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
rs_bankcard.last();
String act_is_banned = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("is_banned")));
if (!is_banned.equals(act_is_banned)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
} else {
Log.logInfo("xyu_room info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取禁言状态
*
* @author puhui
*
*/
public class banned_status_get extends XYZB implements API {
public String Description;//参数集合
public int id;//房间id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/banned_status", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/banned_status", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken_NoCookie(data, "/api/v1/banned_status");
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, "/api/v1/banned_status",Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
String is_banned=jp.getString("data.is_banned");
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
rs_bankcard.last();
// System.out.println(rs_bankcard.getString("is_banned"));
if (!is_banned.equals(rs_bankcard.getString("is_banned"))){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
} else {
Log.logInfo("xyu_room info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取发言间隔时间
*
* @author puhui
*
*/
public class banned_time extends XYZB implements API {
public String Description;//参数集合
public int id;//房间id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Get_Noparameter(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
String banned_time=jp.getString("data.banned_time");
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
rs_bankcard.last();
if (!banned_time.equals(rs_bankcard.getString("banned_time"))){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
} else {
Log.logInfo("xyu_room info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 更新发言间隔时间
*
* @author puhui
*
*/
public class banned_time_up extends XYZB implements API {
public String parameter;//参数集合
public String Description;//参数集合
public String banned_time;//
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
banned_time = MapUtil.getParameter(parameter, "banned_time").trim();
banned_time=MapUtil.killQuotes(banned_time, "\"");
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
jsonAsMap.put("banned_time", banned_time);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, "/api/v1/banned_time",jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
rs_bankcard.last();
String act_banned_time = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("banned_time")));
if (!banned_time.equals(act_banned_time)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
} else {
Log.logInfo("xyu_room info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.util.HashMap;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
/**
* 用户离开房间
*
* @author puhui
*
*/
public class del extends XYZB implements API {
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Del_Token(data, Client_token, Url);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
try {
ResultSet rs_bankcard=null;
rs_bankcard = this.selectFromDB(
" xyu_room_users r ",
" r.uuid = '" + Current_uuid + "' ");
rs_bankcard.last();
// System.out.println(rs_bankcard.getRow());
if(!(rs_bankcard.getString("online").equals("0"))){
result = result && false;
failReason = failReason + "online is not find;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.util.HashMap;
import java.util.Map;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
/**
* 流程-编辑房间
*
* @author puhui
*
*/
public class edit extends XYZB implements API {
public String parameter;//参数集合
public String room_name;//房间名称
public static String start_time;//开始时间
public static String end_time;//结束时间
public String Description;//用例名称
public String office_type;//公职类别
public String province;//地区
public String city;//城市
public String area;//区县
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
room_name = MapUtil.getParameter(parameter, "room_name").trim();
start_time = MapUtil.getParameter(parameter, "start_time").trim();
end_time = MapUtil.getParameter(parameter, "end_time").trim();
office_type = MapUtil.getParameter(parameter, "office_type").trim();
province = MapUtil.getParameter(parameter, "province").trim();
city = MapUtil.getParameter(parameter, "city").trim();
area = MapUtil.getParameter(parameter, "area").trim();
if ((!room_name.equals("")) && room_name.equals("code")) {
parameter = parameter.replace("\"room_name\":code", "\"room_name\":\""+ room_names.get("Not_edited") + "\"");
}
// 获取Description对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("未开始")){
if ((!start_time.equals("")) && start_time.equals("code")) {
parameter = parameter.replace("\"start_time\":code", "\"start_time\":\""+ MyDateUtil.getTime(24, 0, 0) + "\"");
start_time=MyDateUtil.getTime(24, 0, 0);
}
if ((!end_time.equals("")) && end_time.equals("code")) {
parameter = parameter.replace("\"end_time\":code", "\"end_time\":\""+ MyDateUtil.getTime(24, 1, 1) + "\"");
end_time=MyDateUtil.getTime(24, 1, 1);
}
Not_started_xyzb.put("teacher_password", Not_edited_xyzb.get("teacher_password"));
Not_started_xyzb.put("student_password", Not_edited_xyzb.get("student_password"));
Not_started_xyzb.put("assistant_password", Not_edited_xyzb.get("assistant_password"));
Not_started_xyzb.put("host_password", Not_edited_xyzb.get("host_password"));
Not_started_xyzb.put("id", Not_edited_xyzb.get("id"));
room_nums.put("Not_started", room_nums.get("Not_edited"));
room_names.put("Not_started", room_names.get("Not_edited"));
ReadProperties.updateProperty("Not_started_xyzbid", Not_edited_xyzb.get("id").toString());
ReadProperties.updateProperty("Not_started_xyzbroom_nums", room_nums.get("Not_started").toString());
ReadProperties.updateProperty("Not_started_xyzbroom_names", room_names.get("Not_edited").toString());
ReadProperties.updateProperty("Not_started_xyzbteacher_password", Not_edited_xyzb.get("teacher_password").toString());
ReadProperties.updateProperty("Not_started_xyzbstudent_password",Not_edited_xyzb.get("student_password").toString());
ReadProperties.updateProperty("Not_started_xyzbassistant_password", Not_edited_xyzb.get("assistant_password").toString());
ReadProperties.updateProperty("Not_started_xyzbhost_password", Not_edited_xyzb.get("host_password").toString());
// System.out.println(MapUtil.showMap(Not_edited_xyzb));
// System.out.println(MapUtil.showMap(Not_started_xyzb));
// System.out.println(MapUtil.showMap(room_nums));
// System.out.println(MapUtil.showMap(room_names));
}else if(Description.contains("直播中")){
if ((!start_time.equals("")) && start_time.equals("code")) {
parameter = parameter.replace("\"start_time\":code", "\"start_time\":\""+ MyDateUtil.getTime(0, 0, 5) + "\"");
start_time=MyDateUtil.getTime(0, 0, 5);
}
if ((!end_time.equals("")) && end_time.equals("code")) {
parameter = parameter.replace("\"end_time\":code", "\"end_time\":\""+ MyDateUtil.getTime(24, 0, 5) + "\"");
end_time=MyDateUtil.getTime(24, 0, 5);
}
Running_xyzb.put("teacher_password", Not_edited_xyzb.get("teacher_password"));
Running_xyzb.put("student_password", Not_edited_xyzb.get("student_password"));
Running_xyzb.put("assistant_password", Not_edited_xyzb.get("assistant_password"));
Running_xyzb.put("host_password", Not_edited_xyzb.get("host_password"));
Running_xyzb.put("id", Not_edited_xyzb.get("id"));
room_nums.put("Running_xyzb", room_nums.get("Not_edited"));
room_names.put("Running_xyzb", room_names.get("Not_edited"));
ReadProperties.updateProperty("Running_xyzbid", Not_edited_xyzb.get("id").toString());
ReadProperties.updateProperty("Running_xyzbroom_nums", room_nums.get("Not_edited").toString());
ReadProperties.updateProperty("Running_xyzbroom_names", room_names.get("Not_edited").toString());
ReadProperties.updateProperty("Running_xyzbteacher_password", Not_edited_xyzb.get("teacher_password").toString());
ReadProperties.updateProperty("Running_xyzbstudent_password",Not_edited_xyzb.get("student_password").toString());
ReadProperties.updateProperty("Running_xyzbassistant_password", Not_edited_xyzb.get("assistant_password").toString());
ReadProperties.updateProperty("Running_xyzbhost_password", Not_edited_xyzb.get("host_password").toString());
// System.out.println(MapUtil.showMap(Not_edited_xyzb));
// System.out.println(MapUtil.showMap(Running_xyzb));
// System.out.println(MapUtil.showMap(room_nums));
// System.out.println(MapUtil.showMap(room_names));
}else if(Description.contains("已结束")){
if ((!start_time.equals("")) && start_time.equals("code")) {
parameter = parameter.replace("\"start_time\":code", "\"start_time\":\""+ MyDateUtil.getTime(0, 0, 5) + "\"");
start_time=MyDateUtil.getTime(0, 0, 5);
}
if ((!end_time.equals("")) && end_time.equals("code")) {
parameter = parameter.replace("\"end_time\":code", "\"end_time\":\""+ MyDateUtil.getTime(0, 0, 6) + "\"");
end_time=MyDateUtil.getTime(0, 0, 6);
}
Finished_xyzb.put("teacher_password", Not_edited_xyzb.get("teacher_password"));
Finished_xyzb.put("student_password", Not_edited_xyzb.get("student_password"));
Finished_xyzb.put("assistant_password", Not_edited_xyzb.get("assistant_password"));
Finished_xyzb.put("host_password", Not_edited_xyzb.get("host_password"));
Finished_xyzb.put("id", Not_edited_xyzb.get("id"));
room_nums.put("Finished_xyzb", room_nums.get("Not_edited"));
room_names.put("Finished_xyzb", room_names.get("Not_edited"));
ReadProperties.updateProperty("Finished_xyzbid", Not_edited_xyzb.get("id").toString());
ReadProperties.updateProperty("Finished_xyzbroom_nums", room_nums.get("Not_edited").toString());
ReadProperties.updateProperty("Finished_xyzbroom_names", room_names.get("Not_edited").toString());
ReadProperties.updateProperty("Finished_xyzbteacher_password", Not_edited_xyzb.get("teacher_password").toString());
ReadProperties.updateProperty("Finished_xyzbstudent_password",Not_edited_xyzb.get("student_password").toString());
ReadProperties.updateProperty("Finished_xyzbassistant_password", Not_edited_xyzb.get("assistant_password").toString());
ReadProperties.updateProperty("Finished_xyzbhost_password", Not_edited_xyzb.get("host_password").toString());
// System.out.println(MapUtil.showMap(Not_edited_xyzb));
// System.out.println(MapUtil.showMap(Finished_xyzb));
// System.out.println(MapUtil.showMap(room_nums));
// System.out.println(MapUtil.showMap(room_names));
}else if(Description.contains("已失效")){
if ((!start_time.equals("")) && start_time.equals("code")) {
parameter = parameter.replace("\"start_time\":code", "\"start_time\":\""+ MyDateUtil.getTime(0, 0, 5) + "\"");
start_time=MyDateUtil.getTime(0, 0, 5);
}
if ((!end_time.equals("")) && end_time.equals("code")) {
parameter = parameter.replace("\"end_time\":code", "\"end_time\":\""+ MyDateUtil.getTime(0, 1, 6) + "\"");
end_time=MyDateUtil.getTime(0, 1, 6);
}
Invalid_xyzb.put("teacher_password", Not_edited_xyzb.get("teacher_password"));
Invalid_xyzb.put("student_password", Not_edited_xyzb.get("student_password"));
Invalid_xyzb.put("assistant_password", Not_edited_xyzb.get("assistant_password"));
Invalid_xyzb.put("host_password", Not_edited_xyzb.get("host_password"));
Invalid_xyzb.put("id", Not_edited_xyzb.get("id"));
room_nums.put("Invalid_xyzb", room_nums.get("Not_edited"));
room_names.put("Invalid_xyzb", room_names.get("Not_edited"));
ReadProperties.updateProperty("Invalid_xyzbid", Not_edited_xyzb.get("id").toString());
ReadProperties.updateProperty("Invalid_xyzbroom_nums", room_nums.get("Not_edited").toString());
ReadProperties.updateProperty("Invalid_xyzbroom_names", room_names.get("Not_edited").toString());
ReadProperties.updateProperty("Invalid_xyzbteacher_password", Not_edited_xyzb.get("teacher_password").toString());
ReadProperties.updateProperty("Invalid_xyzbstudent_password",Not_edited_xyzb.get("student_password").toString());
ReadProperties.updateProperty("Invalid_xyzbassistant_password", Not_edited_xyzb.get("assistant_password").toString());
ReadProperties.updateProperty("Invalid_xyzbhost_password", Not_edited_xyzb.get("host_password").toString());
// System.out.println(MapUtil.showMap(Not_edited_xyzb));
// System.out.println(MapUtil.showMap(Invalid_xyzb));
// System.out.println(MapUtil.showMap(room_nums));
// System.out.println(MapUtil.showMap(room_names));
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
parameter = MapUtil.getValue("parameter", data);
room_name = MapUtil.getParameter(parameter, "room_name").trim();
office_type = MapUtil.getParameter(parameter, "office_type").trim();
province = MapUtil.getParameter(parameter, "province").trim();
city = MapUtil.getParameter(parameter, "city").trim();
area = MapUtil.getParameter(parameter, "area").trim();
jsonAsMap.put("start_time", start_time);
jsonAsMap.put("end_time", end_time);
jsonAsMap.put("room_name", room_names.get("Not_edited"));
jsonAsMap.put("office_type", office_type);
jsonAsMap.put("province", province);
jsonAsMap.put("city", city);
jsonAsMap.put("area", area);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Salesman_token, "/api/room/"+room_nums.get("Not_edited"),jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
}
if (result){
// 获取Description对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("未开始")){
BasicsGM.updateOrderStatus("xyu.xyu_room","status=1", "room_num="+room_nums.get("Not_started"));
}else if(Description.contains("直播中")){
BasicsGM.updateOrderStatus("xyu.xyu_room","status=2", "room_num="+room_nums.get("Running_xyzb"));
}else if(Description.contains("已结束")){
BasicsGM.updateOrderStatus("xyu.xyu_room","status=3", "room_num="+room_nums.get("Finished_xyzb"));
}else if(Description.contains("已失效")){
BasicsGM.updateOrderStatus("xyu.xyu_room","status=4", "room_num="+room_nums.get("Invalid_xyzb"));
BasicsGM.updateOrderStatus("xyu.xyu_room","start_time='2017-02-11 11:11:11' ", "room_num="+room_nums.get("Invalid_xyzb"));
BasicsGM.updateOrderStatus("xyu.xyu_room","end_time='2017-02-11 12:12:12' ", "room_num="+room_nums.get("Invalid_xyzb"));
}
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取房间用户信息
*
* @author puhui
*
*/
public class getRooms extends XYZB implements API {
public String parameter;//参数集合
public String Description;
public String password;//姓名
public String room_num;
public String current_page;
public String first_page_url;
public String last_page;
public String last_page_url;
public String next_page_url;
public String path;
public String per_page;
public String prev_page_url;
public String to;
public String total;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
password = MapUtil.getParameter(parameter, "password").trim();
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/users", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/users", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken(data, "/api/v1/users");
return re;
}
Response re = RequestDataUtils.Get_token(data, "/api/v1/users",Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if((data.get("custom") != null) && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
//如果请求地址接口是studentinfo接口5
if (jp.getString("data") != null) {
parameter = MapUtil.getValue("parameter", data);
first_page_url=jp.getString("data.first_page_url");
last_page_url=jp.getString("data.last_page_url");
next_page_url=jp.getString("data.next_page_url");
prev_page_url=jp.getString("data.prev_page_url");
total=jp.getString("data.total");
String role="";
if(parameter.contains("&")){
String arr[]=parameter.split("&");
role=arr[0].split("=")[1];
}
try {
ResultSet rs_bankcard=null;
if(!parameter.contains("role")){
rs_bankcard = this.selectCountFromDB(
" xyu_room_users r ",
" r.room_num = '" + Current_room + "' ");
rs_bankcard.last();
// System.out.println(rs_bankcard.getString("count(*)"));
}else{
rs_bankcard = this.selectCountFromDB(
" xyu_room_users r ",
" r.room_num = '" + Current_room + "' and role = '"+role+"'");
rs_bankcard.last();
// System.out.println(rs_bankcard.getString("count(*)"));
}
if (!(rs_bankcard.getString("count(*)")).equals(total)) {
result = result && false;
failReason = failReason + "total is not find;";
}
if(!first_page_url.contains(parameter.substring(1, parameter.length()-2))){
result = result && false;
failReason = failReason + "first_page_url is not find;";
}
if(!last_page_url.contains(parameter.substring(1, parameter.length()-2))){
result = result && false;
failReason = failReason + "last_page_url is not find;";
}
if(next_page_url!=null && !next_page_url.contains(parameter.substring(1, parameter.length()-2))){
result = result && false;
failReason = failReason + "next_page_url is not find;";
}
if(prev_page_url!=null && !prev_page_url.contains(parameter.substring(1, parameter.length()-2))){
result = result && false;
failReason = failReason + "prev_page_url is not find;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取用户信息
*
* @author puhui
*
*/
public class getUser extends XYZB implements API {
public String parameter;//参数集合
public String Description;
public String uuid;
public String id;
public String room_num;
public String nickname;
public String speaking_status;
public String enabled;
public String role;
public String created_at;
public String updated_at;
public String online;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
uuid = MapUtil.getParameter(parameter, "uuid").trim();
uuid = MapUtil.killQuotes(uuid, "\"");//去掉双引号的education
if ((!uuid.equals("")) && uuid.equals("code")) {
parameter = Current_uuid;
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的parameter
data.put("parameter", parameter);
return data;
}
// 替换原来的parameter
data.put("parameter", uuid);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/users", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/users", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken(data, "/api/v1/users");
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, "/api/v1/users",Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if((data.get("custom") != null) && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null) {
parameter = MapUtil.getValue("parameter", data);
id =jp.getString("data.id");
room_num =jp.getString("data.room_num");
nickname =jp.getString("data.nickname");
role =jp.getString("data.role");
speaking_status =jp.getString("data.speaking_status");
enabled =jp.getString("data.enabled");
online =jp.getString("data.online");
try {
ResultSet xyu_room_users=null;
if(id!=null){
xyu_room_users = this.selectFromDB(
" xyu_room_users r ",
" r.uuid = '" + parameter + "' ");
xyu_room_users.last();
String act_id = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("id")));
String act_room_num = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("room_num")));
String act_nickname = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("nickname")));
String act_role = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("role")));
String act_speaking_status = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("speaking_status")));
String act_enabled = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("enabled")));
String act_online = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("online")));
if (!act_id.equals(id)) {
result = result && false;
failReason = failReason + "id is not find;";
}
if (!act_room_num.equals(room_num)) {
result = result && false;
failReason = failReason + "re_room_num is not find;";
}
if(!act_nickname.equals(nickname)){
result = result && false;
failReason = failReason + "Current_nickname is not find;";
}
if(!act_role.contains(role)){
result = result && false;
failReason = failReason + "Current_password is not find;";
}
if(!act_speaking_status.equals(speaking_status)){
result = result && false;
failReason = failReason + "re_speaking_status is not find;";
}
if(!act_enabled.equals(enabled)){
result = result && false;
failReason = failReason + "re_enabled is not find;";
}
if(!act_online.equals(online)){
result = result && false;
failReason = failReason + "re_online is not find;";
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
if (result){
Current_user_id=id;
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取配置信息
*
* @author puhui
*
*/
public class get_config extends XYZB implements API {
public String Description;//参数集合
public int id;//房间id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, Url, Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, Url, Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken_NoCookie(data, Url);
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 根据room_num获取教师相关信息
*
* @author puhui
*
*/
public class get_teacher_info extends XYZB implements API {
public String parameter;//参数集合
public String Description;
public String teacher_uuid;
public String uuid;
public String nickname;
public String desc;
public String pic;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
teacher_uuid = MapUtil.getParameter(parameter, "teacher_uuid").trim();
teacher_uuid = MapUtil.killQuotes(teacher_uuid, "\"");//去掉双引号的education
// if ((!room_name.equals("")) && room_name.equals("code")) {
// parameter = parameter.replace("\"room_name\":code", "\"room_name\":\""+ room_names.get("Not_edited") + "\"");
// }
if ((!teacher_uuid.equals("")) && teacher_uuid.equals("code")) {
parameter = "teacher_uuid="+Current_uuid;
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的parameter
data.put("parameter", parameter);
return data;
}
// 替换原来的parameter
data.put("parameter", teacher_uuid);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/users", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/users", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken(data, "/api/v1/users");
return re;
}
Response re = RequestDataUtils.Get_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if((data.get("custom") != null) && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null) {
parameter = MapUtil.getValue("parameter", data);
/**
* public String uuid;
public String nickname;
public String desc;
public String pic;
*/
uuid =jp.getString("data.uuid");
nickname =jp.getString("data.nickname");
// desc =jp.getString("data.data.desc[0]");
// pic =jp.getString("data.data.pic[0]");
try {
ResultSet xyu_room_users=null;
if(uuid!=null){
xyu_room_users = this.selectFromDB(
" xyu_room_users r ",
" r.uuid = '" + Current_uuid + "' ");
xyu_room_users.last();
String act_nickname = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("nickname")));
String act_uuid = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("uuid")));
if (!act_uuid.equals(uuid)) {
result = result && false;
failReason = failReason + "uuid is not find;";
}
if(!act_nickname.equals(nickname)){
result = result && false;
failReason = failReason + "nickname is not find;";
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_users info in DB;";
e.printStackTrace();
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 业务员管理员登陆
*
* @author puhui
*
*/
public class login extends XYZB implements API {
public String parameter;//参数集合
public String Description;//用例名称
public String username;//姓名
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
username = MapUtil.getParameter(parameter, "username").trim();
if ((!username.equals("")) && username.equals("Enterprise_users")) {
parameter = parameter.replace("\"username\":Enterprise_users", "\"username\":\""+ Enterprise_users.get("name") + "\"");
}
if ((!username.equals("")) && username.equals("Business_Administrator")) {
parameter = parameter.replace("\"username\":Business_Administrator", "\"username\":\""+ Business_Administrator.get("name") + "\"");
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_NOtokenNOcookie(data,Url );
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null){
String token_data=jp.getString("data.access_token");
// String[] token_arr=token_data.split(",");
// String[] token_value=token_arr[0].split(":");
// Salesman_token=token_value[1];
Salesman_token=token_data;
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
/**
* 修改用户昵称
*
* @author puhui
*
*/
public class modify extends XYZB implements API {
public String parameter;//参数集合
public String Description;
public String nickname;//nickname
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
nickname = MapUtil.getParameter(parameter, "nickname").trim();
if ((!nickname.equals("")) && nickname.equals("random")) {
Current_nickname="ys"+(new Random().nextInt(90000000)+ 10000000);
parameter = parameter.replace("\"nickname\":random", "\"nickname\":\""+ Current_nickname + "\"");
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
parameter = MapUtil.getValue("parameter", data);
nickname = MapUtil.getParameter(parameter, "nickname").trim();
jsonAsMap.put("nickname", nickname);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, Url,jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
try {
parameter = MapUtil.getValue("parameter", data);
ResultSet rs_bankcard=null;
if(!parameter.contains("role")){
rs_bankcard = this.selectFromDB(
" xyu_room_users r ",
" r.uuid = '" + Current_uuid + "' ");
rs_bankcard.last();
// System.out.println(rs_bankcard.getString("count(*)"));
}
if(!(rs_bankcard.getString("nickname").equals(nickname))){
result = result && false;
failReason = failReason + "nickname is not find;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_users info in DB;";
e.printStackTrace();
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取运营信息
*
* @author puhui
*
*/
public class operation_info extends XYZB implements API {
public String Description;//参数集合
public int id;//房间id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, Url, Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, Url, Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken_NoCookie(data, Url);
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
String weixintitle=jp.getString("data.weixintitle");
String weixinlink=jp.getString("data.weixinlink");
weixinlink = MapUtil.killQuotes(weixinlink, "\"");
String weibotitle=jp.getString("data.weibotitle");
weibotitle = MapUtil.killQuotes(weibotitle, "\"");
String weibolink=jp.getString("data.weibolink");
weibolink = MapUtil.killQuotes(weibolink, "\"");
String qqgrouptitle=jp.getString("data.qqgrouptitle");
qqgrouptitle = MapUtil.killQuotes(qqgrouptitle, "\"");
String qqgrouplink=jp.getString("data.qqgrouplink");
qqgrouplink = MapUtil.killQuotes(qqgrouplink, "\"");
String updateTime=jp.getString("data.updateTime");
updateTime=updateTime.substring(0,updateTime.length()-2);
try {
ResultSet xyu_room = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
xyu_room.last();
if (!(xyu_room.getString("operation_info")).contains(weixintitle)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!(xyu_room.getString("operation_info")).contains(weixinlink)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!(xyu_room.getString("operation_info")).contains(weibotitle)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!(xyu_room.getString("operation_info")).contains(weibolink)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!(xyu_room.getString("operation_info")).contains(qqgrouptitle)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!(xyu_room.getString("operation_info")).contains(qqgrouplink)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!(xyu_room.getString("operation_info")).contains(updateTime)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
else {
Log.logInfo("xyu_room info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
/**
* 更新运营信息
*
* @author puhui
*
*/
public class operation_info_up extends XYZB implements API {
public String parameter;//参数集合
public String Description;
public String weixintitle;//
public String weixinlink;//
public String weibotitle;//
public String weibolink;//
public String qqgrouptitle;//
public String qqgrouplink;//
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
weixintitle = MapUtil.getParameter(parameter, "weixintitle").trim();
weixinlink = MapUtil.getParameter(parameter, "weixinlink").trim();
weibotitle = MapUtil.getParameter(parameter, "weibotitle").trim();
weibolink = MapUtil.getParameter(parameter, "weibolink").trim();
qqgrouptitle = MapUtil.getParameter(parameter, "qqgrouptitle").trim();
qqgrouplink = MapUtil.getParameter(parameter, "qqgrouplink").trim();
if ((!weixintitle.equals("")) && weixintitle.equals("random")) {
weixintitle="ys"+(new Random().nextInt(90000000)+ 10000000);
parameter = parameter.replace("\"weixintitle\":random", "\"weixintitle\":\""+ weixintitle + "\"");
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
jsonAsMap.put("weixintitle", weixintitle);
jsonAsMap.put("weixinlink", weixinlink);
jsonAsMap.put("weibotitle", weibotitle);
jsonAsMap.put("weibolink", weibolink);
jsonAsMap.put("qqgrouptitle", qqgrouptitle);
jsonAsMap.put("qqgrouplink", qqgrouplink);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, "/api/v1/operation_info",jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
// String weixintitle=jp.getString("data.weixintitle");
// String weixinlink=jp.getString("data.weixinlink");
// String weibotitle=jp.getString("data.weibotitle");
// String weibolink=jp.getString("data.weibolink");
// String qqgrouptitle=jp.getString("data.qqgrouptitle");
// String qqgrouplink=jp.getString("data.qqgrouplink");
// String updateTime=jp.getString("data.updateTime");
// if(updateTime!=null){
// updateTime=updateTime.substring(0,updateTime.length()-2);
// }
try {
ResultSet xyu_room = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
xyu_room.last();
String su=StringUtils.decodeUnicode((xyu_room.getString("operation_info")));
if (!su.contains(weixintitle)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!su.contains(weixinlink)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!su.contains(weibotitle)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!su.contains(weibolink)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!su.contains(qqgrouptitle)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
if (!su.contains(qqgrouplink)){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
}
// if (!su.contains(updateTime)){
// result = result && false;
// failReason = failReason + "xyu_room info in DB is wrong;";
// }
else {
Log.logInfo("xyu_room info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb.process;
import io.restassured.http.Headers;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 流程-打开小雨直播登录后台首页
*
* @author puhui
*
*/
public class admin extends XYZB implements API {
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Get_Notoken(data, Url);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
Headers headers=re.getHeaders();
// System.out.println(headers.toString());
// System.out.println(re.getSessionId());
// System.out.println(MapUtil.showMap_String(re.getCookies()));
laravel_session=re.getCookie("laravel_session");
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if((data.get("custom") != null ) &&
!re.asString().contains("</html>")) {
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ String.valueOf(json) + ". ";
}
if (json.length() != 0) {
int Alength="csrf-token\" content=\"".length();
int start=json.indexOf("csrf-token\" content=\"");
int end=Alength+start+41;
Page_token=json.substring(start+Alength, end-1);
if(Page_token.length()<=0){
result = result && false;
}
// System.out.println(Page_token);
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb.process;
import io.restassured.http.Headers;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 流程-用户退出登录
*
* @author puhui
*
*/
public class logout extends XYZB implements API {
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Get_cookie(data, Url);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
// Headers headers=re.getHeaders();
// System.out.println(headers.toString());
// System.out.println(re.getSessionId());
// System.out.println(MapUtil.showMap_String(re.getCookies()));
// System.out.println(XSRF_token);
XSRF_token="";
laravel_session="";
Page_token="";
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if((data.get("custom") != null && !re.asString().contains("</html>"))
&& (!json.contains(String.valueOf(data.get("custom"))))) {
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ String.valueOf(json) + ". ";
}
if (json.length() != 0) {
int Alength="csrf-token\" content=\"".length();
int start=json.indexOf("csrf-token\" content=\"");
int end=Alength+start+41;
Page_token=json.substring(start+Alength, end-1);
// System.out.println(Page_token);
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb.process;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.PhoneNoGeneratorUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.TestUnti.randomUtil;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 流程--添加企业用户
*
* @author puhui
*
*/
public class member extends XYZB implements API {
public String parameter;//参数集合
public String Description;//用例名称
public String _token;//token
public String name;//姓名
public String password;//密码
public String email;//邮箱
public String mobile;//电话
public String role_id;//角色
public String repass;//重复密码
public static String temporary_name;//临时用户名
public static String temporary_pwd;//临时密码
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
_token = MapUtil.getParameter(parameter, "_token").trim();
name = MapUtil.getParameter(parameter, "name").trim();
password = MapUtil.getParameter(parameter, "password").trim();
email = MapUtil.getParameter(parameter, "email").trim();
mobile = MapUtil.getParameter(parameter, "mobile").trim();
role_id = MapUtil.getParameter(parameter, "role_id").trim();
repass = MapUtil.getParameter(parameter, "repass").trim();
if ((!_token.equals("")) && _token.equals("code")) {
parameter = parameter.replace("\"_token\":code", "\"_token\":\""+ Page_token + "\"");
}
if ((!name.equals("")) && name.equals("random")) {
SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmmss");
String dateStr = dateformat.format(new Date());
temporary_name="ys"+dateStr;
// temporary_name="ys"+(new Random().nextInt(90000000)+ 10000000);
parameter = parameter.replace("\"name\":random", "\"name\":\""+ temporary_name + "\"");
}
if ((!name.equals("")) && name.equals("Enterprise_users")) {
parameter = parameter.replace("\"name\":Enterprise_users", "\"name\":\""+ Enterprise_users.get("name") + "\"");
}
if ((!name.equals("")) && name.equals("Business_Administrator")) {
parameter = parameter.replace("\"name\":Business_Administrator", "\"name\":\""+ Business_Administrator.get("name") + "\"");
}
if ((!email.equals("")) && email.equals("random")) {
parameter = parameter.replace("\"email\":random", "\"email\":\""+ temporary_name + "@qq.com\"");
}
if ((!mobile.equals("")) && mobile.equals("random")) {
parameter = parameter.replace("\"mobile\":random", "\"mobile\":\""+ PhoneNoGeneratorUtil.getPhoneNo() + "\"");
}
temporary_pwd=password;
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_NOToken(data, Url);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && !re.asString().contains("</html>")){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("2".equals(role_id)){
Enterprise_users.put("name", temporary_name);
Enterprise_users.put("pwd", temporary_pwd);
ReadProperties.updateProperty("Enterprise_users", Enterprise_users.get("name").toString());
}
if("3".equals(role_id)){
Business_Administrator.put("name", temporary_name);
Business_Administrator.put("pwd", temporary_pwd);
ReadProperties.updateProperty("Business_Administrator", Business_Administrator.get("name").toString());
}
//是否是线上数据库
if (!isProduct) {
name = MapUtil.getParameter(parameter, "name").trim();
email = MapUtil.getParameter(parameter, "email").trim();
mobile = MapUtil.getParameter(parameter, "mobile").trim();
name = MapUtil.killQuotes(name, "\"");//去掉双引号的bankNo
email = MapUtil.killQuotes(email, "\"");//去掉双引号的bankName
mobile = MapUtil.killQuotes(mobile, "\"");//去掉双引号的bankCode
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_users x ",
" x.name = '" + name + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_users info is not in DB;";
} else {
String exp_email = (email != null)
? String.valueOf(email).trim() : "";
String exp_mobile = (mobile != null)
? String.valueOf(mobile).trim() : "";
String act_email = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("email")));
String act_mobile = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("mobile")));
if ((!exp_email.equals(act_email)) || (!exp_mobile.equals(act_mobile))) {
result = result && false;
failReason = failReason + "xyu_users info in DB is wrong;";
} else {
Log.logInfo("xyu_users info in DB is correct;");
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify bankcard info in DB;";
e.printStackTrace();
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb.process;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 删除文件信息
*
* @author puhui
*
*/
public class room_files_del extends XYZB implements API {
public String parameter;//参数集合
public String Description;//参数集合
public String id;//文件id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
id = MapUtil.getParameter(parameter, "id").trim();
if ((!id.equals("")) && id.equals("code")) {
parameter = Current_id;
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的Othercode
data.put("parameter", parameter);
return data;
}
if ((!id.equals("")) && id.equals("Othercode")) {
parameter = Integer.valueOf(Current_id)-2+"";
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的Othercode
data.put("parameter", parameter);
return data;
}
data.put("parameter", id);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
parameter = MapUtil.getValue("parameter", data);
Response re = RequestDataUtils.Del_Token(data,Client_token, "api/v1/room_files/"+parameter);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_files f ",
" f.id = '" + Current_id + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow()!=0){
result = result && false;
failReason = failReason + "xyu_room_files info in DB is wrong;";
} else {
Log.logInfo("xyu_room_files info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb.process;
import io.restassured.http.Headers;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 流程-打开小雨直播登录后台首页
*
* @author puhui
*
*/
public class webAdmin extends XYZB implements API {
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Get_Notoken(data, "/web/admin");
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
Headers headers=re.getHeaders();
// System.out.println(headers.toString());
// System.out.println(re.getSessionId());
// System.out.println(MapUtil.showMap_String(re.getCookies()));
XSRF_token=re.getCookie("XSRF-TOKEN");
laravel_session=re.getCookie("laravel_session");
// System.out.println(XSRF_token);
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if((data.get("custom") != null && !re.asString().contains("</html>"))
) {
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ String.valueOf(json) + ". ";
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb.process;
import io.restassured.http.Headers;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 流程-页面登录
*
* @author puhui
*
*/
public class weblogin extends XYZB implements API {
public String parameter;//参数集合
public String Description;//用例名称
public String name;//姓名
public String password;//密码
// public String _token;//token
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
// _token = MapUtil.getParameter(parameter, "_token").trim();
name = MapUtil.getParameter(parameter, "name").trim();
password = MapUtil.getParameter(parameter, "password").trim();
// if ((!_token.equals("")) && _token.equals("code")) {
// parameter = parameter.replace("\"_token\":code", "\"_token\":\""+ Page_token + "\"");
// }
if ((!name.equals("")) && name.equals("Enterprise_users")) {
parameter = parameter.replace("\"name\":Enterprise_users", "\"name\":\""+ Enterprise_users.get("name") + "\"");
}
if ((!password.equals("")) && password.equals("Enterprise_users")) {
parameter = parameter.replace("\"password\":Enterprise_users", "\"password\":\""+ Enterprise_users.get("pwd") + "\"");
}
if ((!name.equals("")) && name.equals("Business_Administrator")) {
parameter = parameter.replace("\"name\":Business_Administrator", "\"name\":\""+ Business_Administrator.get("name") + "\"");
}
if ((!password.equals("")) && password.equals("Business_Administrator")) {
parameter = parameter.replace("\"password\":Business_Administrator", "\"password\":\""+ Business_Administrator.get("pwd") + "\"");
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_NOToken(data, "/web/login");
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
Headers headers=re.getHeaders();
// System.out.println(headers.toString());
// System.out.println(re.getSessionId());
//
// System.out.println(MapUtil.showMap_String(re.getCookies()));
//保存cookie
laravel_session=re.getCookie("laravel_session");
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && !re.asString().contains("</html>")){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 拉流
*
* @author puhui
*
*/
public class pull extends XYZB implements API {
public String Description;//参数集合
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, Url, Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, Url, Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken(data, Url);
return re;
}
Response re = RequestDataUtils.Get_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if((data.get("custom") != null) && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null){
//获取data数组里面的第一个参数的值,存放在小雨直播业务流程数据组中
String rtmp=jp.getString("data.rtmp");
pull_xyzb.put("rtmp", rtmp);
String hls=jp.getString("data.hls");
pull_xyzb.put("hls", hls);
String hdl=jp.getString("data.hdl");
pull_xyzb.put("hdl", hdl);
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 推流
*
* @author puhui
*
*/
public class push extends XYZB implements API {
public String Description;//参数集合
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, Url, Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, Url, Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken(data, Url);
return re;
}
Response re = RequestDataUtils.Get_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if((data.get("custom") != null) && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null){
//获取data数组里面的第一个参数的值,存放在小雨直播业务流程数据组中
String rtmp=jp.getString("data.rtmp");
push_xyzb.put("rtmp", rtmp);
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 添加问题
*
* @author puhui
*
*/
public class questions extends XYZB implements API {
public String parameter;//参数集合
public String name;//问题内容
public String room_id;//房间名称
public String user_id;//房间用户id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
user_id=Current_user_id;
parameter = MapUtil.getValue("parameter", data);
name = MapUtil.getParameter(parameter, "name").trim();
if(Current_password.contains("Not_started")){
room_id=ReadProperties.GetinformationByKey("Not_started_xyzbid");
}else if(Current_password.contains("Running_xyzb")){
room_id=ReadProperties.GetinformationByKey("Running_xyzbid");
}else if(Current_password.contains("Finished_xyzb")){
room_id=ReadProperties.GetinformationByKey("Finished_xyzbid");
}else if(Current_password.contains("Invalid_xyzb")){
room_id=ReadProperties.GetinformationByKey("Invalid_xyzbid");
}else if(Current_password.contains("Not_edited_xyzb")){
room_id=ReadProperties.GetinformationByKey("Not_edited_xyzbid");
}
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_question ",
" 1 = 1");
rs_bankcard.last();
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_room_question info is not in DB;";
} else {
String act_room_id = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("room_id")));
String act_name = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("name")));
String act_user_id = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("user_id")));
Current_questions_id=String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("id")));
// System.out.println(name);
// System.out.println(StringUtils.decodeUnicode(act_name));
if ((!room_id.equals(act_room_id))
|| (!name.equals(StringUtils.decodeUnicode(act_name)))
|| (!user_id.equals(act_user_id))){
result = result && false;
failReason = failReason + "xyu_room_question info in DB is wrong;";
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_question info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取房间问题
*
* @author puhui
*
*/
public class questions_get extends XYZB implements API {
public String parameter;//参数集合
public String Description;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/questions", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/questions", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken(data, "/api/v1/questions");
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, "/api/v1/questions",Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if((data.get("custom") != null) && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data.data") != null) {
parameter = MapUtil.getValue("parameter", data);
String dataarr[] =jp.getString("data.data").split("answer");
// System.out.println(jp.getString("data.data"));
// System.out.println(Current_room_id);
try {
ResultSet xyu_room_question=null;
xyu_room_question = this.selectFromDB(
" xyu_room_question q ",
" q.room_id = '" + Current_room_id + "' ");
xyu_room_question.last();
// System.out.println(dataarr.length);
// System.out.println(xyu_room_question.getRow());
if (xyu_room_question.getRow()!=(dataarr.length-1)) {
result = result && false;
failReason = failReason + "xyu_room_question id is not find;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_question info in DB;";
e.printStackTrace();
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 创建房间(不在测试范围)
*
* @author puhui
*
*/
public class room extends XYZB implements API {
public String parameter;//参数集合
public String room_name;//房间名称
public String teacher_password;
public String student_password;
public String assistant_password;
public String host_password;
public String room_num;
public String id;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
room_name = MapUtil.getParameter(parameter, "room_name").trim();
if ((!room_name.equals("")) && room_name.equals("random")) {
// SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmmss");
// String dateStr = dateformat.format(new Date());
String dateStr =new Random().nextInt(999999)+"";
room_name="ys"+dateStr;
parameter = parameter.replace("\"room_name\":random", "\"room_name\":\""+ room_name + "\"");
}
// 替换原来的data
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Salesman_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null){
teacher_password=jp.getString("data.teacher_password");
student_password=jp.getString("data.student_password");
assistant_password=jp.getString("data.assistant_password");
host_password=jp.getString("data.host_password");
room_num=jp.getString("data.room_num");
id=jp.getString("data.id");
Not_edited_xyzb.put("teacher_password", teacher_password);
Not_edited_xyzb.put("student_password", student_password);
Not_edited_xyzb.put("assistant_password", assistant_password);
Not_edited_xyzb.put("host_password", host_password);
Not_edited_xyzb.put("id", id);
String room_num=jp.getString("data.room_num");
room_nums.put("Not_edited", room_num);//存储房间编号
room_names.put("Not_edited", room_name);//存储房间名称
ReadProperties.updateProperty("Not_edited_xyzbid", id);
ReadProperties.updateProperty("Not_edited_xyzbroom_nums", room_num);
ReadProperties.updateProperty("Not_edited_xyzbroom_names", room_name);
ReadProperties.updateProperty("Not_edited_xyzbteacher_password", Not_edited_xyzb.get("teacher_password").toString());
ReadProperties.updateProperty("Not_edited_xyzbstudent_password",Not_edited_xyzb.get("student_password").toString());
ReadProperties.updateProperty("Not_edited_xyzbassistant_password", Not_edited_xyzb.get("assistant_password").toString());
ReadProperties.updateProperty("Not_edited_xyzbhost_password", Not_edited_xyzb.get("host_password").toString());
}
//是否是线上环境
if (!isProduct) {
teacher_password = MapUtil.killQuotes(teacher_password, "\"");//去掉双引号的bankNo
student_password = MapUtil.killQuotes(student_password, "\"");//去掉双引号的bankNo
assistant_password = MapUtil.killQuotes(assistant_password, "\"");//去掉双引号的bankNo
host_password = MapUtil.killQuotes(host_password, "\"");//去掉双引号的bankNo
room_num = MapUtil.killQuotes(room_num, "\"");//去掉双引号的bankName
id = MapUtil.killQuotes(id, "\"");//去掉双引号的bankCode
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room r ",
" r.id = '" + id + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_users info is not in DB;";
} else {
teacher_password = (teacher_password != null)
? String.valueOf(teacher_password).trim() : "";
student_password = (student_password != null)
? String.valueOf(student_password).trim() : "";
assistant_password = (assistant_password != null)
? String.valueOf(assistant_password).trim() : "";
host_password = (host_password != null)
? String.valueOf(host_password).trim() : "";
room_num = (room_num != null)
? String.valueOf(room_num).trim() : "";
String act_teacher_password = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("teacher_password")));
String act_student_password = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("student_password")));
String assistant_password = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("assistant_password")));
String host_password = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("host_password")));
String room_num = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("room_num")));
if ((!teacher_password.equals(act_teacher_password))
|| (!student_password.equals(act_student_password))
|| (!assistant_password.equals(assistant_password))
|| (!host_password.equals(host_password))
|| (!room_num.equals(room_num))) {
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
} else {
Log.logInfo("xyu_room info in DB is correct;");
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 创建文件信息
*
* @author puhui
*
*/
public class room_files extends XYZB implements API {
public String parameter;//参数集合
public String name;//房间名称
public String id;//房间名称
public String room_id;//房间名称
public String link;
public String type;
public String private_;
public String files_size;
public String is_courseware;
public String hash;
public String doc_type;
public String path;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
name = MapUtil.getParameter(parameter, "name").trim();
link = MapUtil.getParameter(parameter, "link").trim();
type = MapUtil.getParameter(parameter, "type").trim();
private_ = MapUtil.getParameter(parameter, "private").trim();
if (!private_.equals("")) {
parameter = parameter.replace("\"private_\"", "\"private\"");
}
files_size = MapUtil.getParameter(parameter, "files_size").trim();
is_courseware = MapUtil.getParameter(parameter, "is_courseware").trim();
hash = MapUtil.getParameter(parameter, "hash").trim();
doc_type = MapUtil.getParameter(parameter, "doc_type").trim();
path = MapUtil.getParameter(parameter, "path").trim();
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
name=jp.getString("data.name").substring(1,jp.getString("data.name").length()-1);
id=jp.getString("data.id").substring(1,jp.getString("data.id").length()-1);
room_id=jp.getString("data.room_id").substring(1,jp.getString("data.room_id").length()-1);
link=jp.getString("data.link").substring(1,jp.getString("data.link").length()-1);
type=jp.getString("data.type").substring(1,jp.getString("data.type").length()-1);
private_=jp.getString("data.private").substring(1,jp.getString("data.private").length()-1);
files_size=jp.getString("data.files_size").substring(1,jp.getString("data.files_size").length()-1);
is_courseware=jp.getString("data.is_courseware").substring(1,jp.getString("data.is_courseware").length()-1);
hash=jp.getString("data.hash").substring(1,jp.getString("data.hash").length()-1);
doc_type=jp.getString("data.doc_type").substring(1,jp.getString("data.doc_type").length()-1);
path=jp.getString("data.path").substring(1,jp.getString("data.path").length()-1);
name = MapUtil.killQuotes(name, "\"");//去掉双引号的bankNo
id = MapUtil.killQuotes(id, "\"");//去掉双引号的bankNo
room_id = MapUtil.killQuotes(room_id, "\"");//去掉双引号的bankNo
link = MapUtil.killQuotes(link, "\"");//去掉双引号的bankNo
type = MapUtil.killQuotes(type, "\"");//去掉双引号的bankName
private_ = MapUtil.killQuotes(private_, "\"");//去掉双引号的bankName
files_size = MapUtil.killQuotes(files_size, "\"");//去掉双引号的bankName
is_courseware = MapUtil.killQuotes(is_courseware, "\"");//去掉双引号的bankName
hash = MapUtil.killQuotes(hash, "\"");//去掉双引号的bankName
doc_type = MapUtil.killQuotes(doc_type, "\"");//去掉双引号的bankName
path = MapUtil.killQuotes(path, "\"");//去掉双引号的bankName
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_files f ",
" f.id = '" + id + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_room_files info is not in DB;";
} else {
name = (name != null)? String.valueOf(name).trim() : "";
id = (id != null)? String.valueOf(id).trim() : "";
room_id = (room_id != null)? String.valueOf(room_id).trim() : "";
link = (link != null)? String.valueOf(link).trim() : "";
type = (type != null)? String.valueOf(type).trim() : "";
private_ = (private_ != null)? String.valueOf(private_).trim() : "";
files_size = (files_size != null)? String.valueOf(files_size).trim() : "";
is_courseware = (is_courseware != null)? String.valueOf(is_courseware).trim() : "";
hash = (hash != null)? String.valueOf(hash).trim() : "";
doc_type = (doc_type != null)? String.valueOf(doc_type).trim() : "";
path = (path != null)? String.valueOf(path).trim() : "";
String act_name = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("name")));
String act_id = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("id")));
String act_room_id = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("room_id")));
String act_link = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("link")));
String act_type = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("type")));
String act_private = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("private")));
String act_files_size = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("files_size")));
String act_is_courseware = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("is_courseware")));
String act_hash = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("hash")));
String act_doc_type = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("doc_type")));
String act_path = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("path")));
if ((!name.equals(act_name))
|| (!id.equals(act_id))
|| (!room_id.equals(act_room_id))
|| (!link.equals(act_link))
|| (!type.equals(act_type))
|| (!private_.equals(act_private))
|| (!files_size.equals(act_files_size))
|| (!is_courseware.equals(act_is_courseware))
|| (!hash.equals(act_hash))
|| (!doc_type.equals(act_doc_type))
|| (!path.equals(act_path))){
result = result && false;
failReason = failReason + "xyu_room_files info in DB is wrong;";
} else {
Current_id=id;
Log.logInfo("xyu_room_files info in DB is correct;");
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 删除文件信息
*
* @author puhui
*
*/
public class room_files_del extends XYZB implements API {
public String parameter;//参数集合
public String Description;//参数集合
public String id;//文件id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
id = MapUtil.getParameter(parameter, "id").trim();
if ((!id.equals("")) && id.equals("code")) {
parameter = Current_id;
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的Othercode
data.put("parameter", parameter);
return data;
}
if ((!id.equals("")) && id.equals("Othercode")) {
parameter = Integer.valueOf(Current_id)-2+"";
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的Othercode
data.put("parameter", parameter);
return data;
}
data.put("parameter", id);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
parameter = MapUtil.getValue("parameter", data);
Response re = RequestDataUtils.Del_Token(data,Client_token, "api/v1/room_files/"+parameter);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_files f ",
" f.id = '" + Current_id + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow()!=0){
result = result && false;
failReason = failReason + "xyu_room_files info in DB is wrong;";
} else {
Log.logInfo("xyu_room_files info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取文件信息
*
* @author puhui
*
*/
public class room_files_get extends XYZB implements API {
public String Description;//参数集合
public int id;//房间id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/room_files", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/room_files", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken_NoCookie(data, "/api/v1/room_files");
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, "/api/v1/room_files",Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
ArrayList<Object> list=(ArrayList<Object>) re.body().jsonPath().getList("data");
// System.out.println(jp.getString("data.room_id").substring(1,jp.getString("data.room_id").length()-1));
// System.out.println(!"".equals(jp.getString("data.room_id").substring(1,jp.getString("data.room_id").length()-1)));
String idarr=jp.getString("data.room_id").substring(1,jp.getString("data.room_id").length()-1);
if(!"".equals(idarr)){
String arr[]=idarr.split(",");
id=arr.length;
}else{
id=0;
}
// String arr[]=.split(",");
// id=arr.length;
// System.out.println(list.size());
// System.out.println(id);
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_files f ",
" f.id = '" + id + "' ");
rs_bankcard.last();
if (list.size()!=id){
result = result && false;
failReason = failReason + "xyu_room_files info in DB is wrong;";
} else {
Log.logInfo("xyu_room_files info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 修改文件信息
*
* @author puhui
*
*/
public class room_files_update extends XYZB implements API {
public String parameter;//参数集合
public String Description;//参数集合
public String private_;//是否显示文件
public String id;//文件id
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
private_ = MapUtil.getParameter(parameter, "private").trim();
id = MapUtil.getParameter(parameter, "id").trim();
if ((!id.equals("")) && id.equals("code")) {
parameter = Current_id;
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的Othercode
data.put("parameter", parameter);
return data;
}
if ((!id.equals("")) && id.equals("Othercode")) {
parameter = Integer.valueOf(Current_id)-2+"";
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的Othercode
data.put("parameter", parameter);
return data;
}
data.put("parameter", id);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
parameter = MapUtil.getValue("parameter", data);
if(private_.length()>0){
jsonAsMap.put("private", private_);
}
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, "api/v1/room_files/"+parameter,jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))
&& !private_.equals("")
&& private_!=null){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_files f ",
" f.id = '" + Current_id + "' ");
rs_bankcard.last();
String act_private = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("private")));
if (!private_.equals(act_private)){
result = result && false;
failReason = failReason + "xyu_room_files info in DB is wrong;";
} else {
Log.logInfo("xyu_room_files info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取房间信息
*
* @author puhui
*
*/
public class room_info extends XYZB implements API {
public String Description;//参数集合
public String room_num;
public String room_name;
public String start_time;
public String end_time;
public String create_time;
public String province;
public String city;
public String area;
public String office_type;
public String is_ask;
public String is_banned;
public String banned_time;
public String address;
public String online_num;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, Url, Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, Url, Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken_NoCookie(data, Url);
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
/**
* public String room_num;
public String room_name;
public String start_time;
public String end_time;
public String create_time;
public String province;
public String city;
public String area;
public String office_type;
public String is_ask;
public String is_banned;
public String banned_time;
public String address;
public String online_num;
*/
room_num =jp.getString("data.room_num");
room_name =jp.getString("data.room_name");
start_time =jp.getString("data.start_time");
end_time =jp.getString("data.end_time");
create_time =jp.getString("data.create_time");
province =jp.getString("data.province");
area =jp.getString("data.area");
office_type =jp.getString("data.office_type");
is_ask =jp.getString("data.is_ask");
is_banned =jp.getString("data.is_banned");
banned_time =jp.getString("data.banned_time");
// address =jp.getString("data.address");
online_num =jp.getString("data.online_num");
//是否是线上环境
if (!isProduct) {
try {
ResultSet xyu_room_users = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
xyu_room_users.last();
String act_room_num = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("room_num")));
String act_room_name = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("room_name")));
String act_start_time = xyu_room_users.getString(xyu_room_users.findColumn("start_time"));
act_start_time=act_start_time.substring(0, act_start_time.length()-2);
String act_end_time = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("end_time")));
act_end_time=act_end_time.substring(0, act_end_time.length()-2);
String act_create_time = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("create_time")));
act_create_time=act_create_time.substring(0, act_create_time.length()-2);
String act_province = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("province")));
String act_area = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("area")));
String act_office_type = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("office_type")));
String act_is_ask = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("is_ask")));
String act_is_banned = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("is_banned")));
String act_banned_time = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("banned_time")));
// String act_address = String.valueOf(xyu_room_users.getString(xyu_room_users.findColumn("address")));
ResultSet xyu_room_users_online = this.selectFromDB(
" xyu_room_users r ",
" r.room_num = '" + Current_room + "' and online = 1 ");
xyu_room_users_online.last();
String act_online = String.valueOf(xyu_room_users_online.getRow());
System.out.println("接口返回在线人数:"+online_num);
System.out.println("数据库在线人数:"+act_online);
if ((!room_num.equals(act_room_num)) ||
(!room_name.equals(act_room_name)) ||
(!start_time.equals(act_start_time)) ||
(!end_time.equals(act_end_time)) ||
(!create_time.equals(act_create_time)) ||
(!province.equals(act_province)) ||
(!area.equals(act_area)) ||
(!office_type.equals(act_office_type)) ||
(!is_ask.equals(act_is_ask)) ||
(!is_banned.equals(act_is_banned)) ||
(!banned_time.equals(act_banned_time))||
// (!address.equals(act_address)) ||
(!online_num.equals(act_online)) ){
result = result && false;
failReason = failReason + "xyu_room info in DB is wrong;";
} else {
Log.logInfo("xyu_room info in DB is correct;");
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
/**
* 更新房间信息
*
* @author puhui
*
*/
public class room_info_up extends XYZB implements API {
public String parameter;//参数集合
public String Description;
public String room_name;//nickname
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
room_name = MapUtil.getParameter(parameter, "room_name").trim();
if ((!room_name.equals("")) && room_name.equals("random")) {
room_name="ys"+(new Random().nextInt(90000000)+ 10000000);
parameter = parameter.replace("\"room_name\":random", "\"room_name\":\""+ room_name + "\"");
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
parameter = MapUtil.getValue("parameter", data);
room_name = MapUtil.getParameter(parameter, "room_name").trim();
room_name = MapUtil.killQuotes(room_name, "\"");//去掉双引号的name
jsonAsMap.put("room_name", room_name);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, "/api/v1/room_info",jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
try {
parameter = MapUtil.getValue("parameter", data);
ResultSet rs_bankcard=null;
if(!parameter.contains("role")){
rs_bankcard = this.selectFromDB(
" xyu_room r ",
" r.room_name = '" + room_name + "' ");
rs_bankcard.last();
System.out.println(rs_bankcard.getRow());
}
// System.out.println(rs_bankcard.getString("id"));
if(rs_bankcard.getRow()==0){
result = result && false;
failReason = failReason + "xyu_room is not find;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取通讯录
*
* @author puhui
*
*/
public class room_mails extends XYZB implements API {
public String parameter;//参数集合
public String Description;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/announce", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/announce", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken(data, "/api/v1/announce");
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if((data.get("custom") != null) && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null) {
parameter = MapUtil.getValue("parameter", data);
List<Object> datalist =jp.getList("data");
// System.out.println(datalist.toString());
try {
ResultSet xyu_announcement=null;
xyu_announcement = this.selectFromDB(
" xyu_room_mails a ",
" a.room_num = '" + Current_room + "' ");
xyu_announcement.last();
// System.out.println(datalist.size());
// System.out.println(xyu_announcement.getRow());
if (xyu_announcement.getRow()!=datalist.size()) {
result = result && false;
failReason = failReason + "xyu_announcement.getRow() is not dataarr.length;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_announcement info in DB;";
e.printStackTrace();
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 新增通讯录
*
* @author puhui
*
*/
public class room_mails_add extends XYZB implements API {
public String parameter;//参数集合
public String name;//房间名称
public String phone;//房间名称
public String room_num;//房间名称
public String identity;
public String id;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
name = MapUtil.getParameter(parameter, "name").trim();
phone = MapUtil.getParameter(parameter, "phone").trim();
room_num = MapUtil.getParameter(parameter, "room_num").trim();
identity = MapUtil.getParameter(parameter, "identity").trim();
if ((!room_num.equals("")) && room_num.equals("code")) {
room_num=Current_room;
parameter = parameter.replace("\"room_num\":code", "\"room_num\":\""+ room_num + "\"");
}
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct && !(room_num.equals("'"))) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_mails f ",
" f.room_num = '" + room_num + "' ");
rs_bankcard.last();
// System.out.println(rs_bankcard.getRow());
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_room_mails info is not in DB;";
} else {
String act_identity = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("identity")));
String act_name = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("name")));
String act_phone = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("phone")));
id = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("id")));
name = MapUtil.killQuotes(name, "\"");//去掉双引号的name
if ((!name.equals(act_name))
|| (!identity.equals(act_identity))
|| (!phone.equals(act_phone))
){
result = result && false;
failReason = failReason + "xyu_room_files info in DB is wrong;";
} else {
Current_mails_id=id;
Log.logInfo("xyu_room_files info in DB is correct;");
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 删除通讯录
*
* @author puhui
*
*/
public class room_mails_delete extends XYZB implements API {
public String parameter;//参数集合
public String id;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
id = MapUtil.getParameter(parameter, "id").trim();
if ((!id.equals("")) && id.equals("code")) {
id=Current_mails_id;
parameter = parameter.replace("\"id\":code", "\"id\":\""+ id + "\"");
}
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct && !(id.equals("'"))) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_mails f ",
" f.id = '" + id + "' ");
rs_bankcard.last();
System.out.println(rs_bankcard.getRow());
if (rs_bankcard.getRow() != 0) {
result = result && false;
failReason = failReason + "xyu_room_mails info is not in DB;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 房间发起推流,开始录制(此时房间应为直播中)
*
* @author puhui
*
*/
public class room_record extends XYZB implements API {
public String parameter;//参数集合
public String uuid;//
public String room_num;//
public String stream;//
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
uuid = MapUtil.getParameter(parameter, "uuid").trim();
room_num = MapUtil.getParameter(parameter, "room_num").trim();
// content = MapUtil.killQuotes(content, "\"");//去掉双引号的bankName
if ((!uuid.equals("")) && uuid.equals("code")) {
parameter = parameter.replace("\"uuid\":code", "\"uuid\":"+ Current_uuid );
}
if ((!room_num.equals("")) && room_num.equals("code")) {
parameter = parameter.replace("\"room_num\":code", "\"room_num\":"+ Current_room );
}
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
/**
* 更新房间状态,休息或不休息
*
* @author puhui
*
*/
public class room_rest_status extends XYZB implements API {
public String parameter;//参数集合
public String Description;
public String rest_status;//rest_status
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
rest_status = MapUtil.getParameter(parameter, "rest_status").trim();
rest_status = MapUtil.killQuotes(rest_status, "\"");//去掉双引号的bankName
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
jsonAsMap.put("rest_status", rest_status);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, Url,jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
try {
parameter = MapUtil.getValue("parameter", data);
ResultSet rs_bankcard=null;
rs_bankcard = this.selectFromDB(
" xyu_room r ",
" r.room_num = '" + Current_room + "' ");
rs_bankcard.last();
String act_rest_status = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("rest_status")));
if(!rest_status.equals(act_rest_status)){
result = result && false;
failReason = failReason + "xyu_room is not find;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
/**
* 房间下课
*
* @author puhui
*
*/
public class room_status_down extends XYZB implements API {
public String parameter;//参数集合
public String Description;
// public String nickname;//nickname
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
// parameter = MapUtil.getValue("parameter", data);
// nickname = MapUtil.getParameter(parameter, "nickname").trim();
//
// if ((!nickname.equals("")) && nickname.equals("random")) {
// Current_nickname="ys"+(new Random().nextInt(90000000)+ 10000000);
// parameter = parameter.replace("\"nickname\":random", "\"nickname\":\""+ Current_nickname + "\"");
// }
// 替换原来的parameter
// data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
// parameter = MapUtil.getValue("parameter", data);
// nickname = MapUtil.getParameter(parameter, "nickname").trim();
//
// jsonAsMap.put("nickname", nickname);
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, Url,jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 检测房间是否有推流
*
* @author puhui
*
*/
public class room_stream extends XYZB implements API {
public String parameter;//参数集合
public String room_num;//反馈内容
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
room_num = MapUtil.getParameter(parameter, "room_num").trim();
room_num = MapUtil.killQuotes(room_num, "\"");//去掉双引号的bankName
if ((!room_num.equals("")) && room_num.equals("code")) {
room_num=Current_room;
parameter = parameter.replace("\"room_num\":code", "\"room_num\":\""+ room_num + "\"");
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 更新房间UUID
*
* @author puhui
*
*/
public class room_uuid extends XYZB implements API {
public String parameter;//参数集合
public String action;//
public String uuid;//
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
action = MapUtil.getParameter(parameter, "action").trim();
uuid = MapUtil.getParameter(parameter, "uuid").trim();
// content = MapUtil.killQuotes(content, "\"");//去掉双引号的bankName
if ((!uuid.equals("")) && uuid.equals("code")) {
uuid=Current_uuid;
parameter = parameter.replace("\"uuid\":code", "\"uuid\":\""+ uuid + "\"");
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room s",
" s.room_num = '" + Current_room + "' ");
rs_bankcard.last();
if (rs_bankcard.getString("uuid").length()<5) {
result = result && false;
failReason = failReason + "xyu_room info is not in DB;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 添加意见反馈
*
* @author puhui
*
*/
public class suggest extends XYZB implements API {
public String parameter;//参数集合
public String content;//反馈内容
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
content = MapUtil.getParameter(parameter, "content").trim();
content = MapUtil.killQuotes(content, "\"");//去掉双引号的bankName
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Post_token(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_suggest s",
" s.nickname = '" + Current_nickname + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_suggest info is not in DB;";
} else {
String act_content = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("content")));
if (!content.equals(act_content)){
result = result && false;
failReason = failReason + "xyu_suggest info in DB is wrong;";
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_suggest info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取意见反馈列表
*
* @author puhui
*
*/
public class suggest_get extends XYZB implements API {
public String parameter;//参数集合
public String id;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Get_token(data, "/api/v1/suggest",Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
id =jp.getString("data.total");
Current_suggest_id =jp.getString("data.data.id[0]");
// System.out.println(Current_suggest_id+"----------------");
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_suggest a",
" 1 = 1 ");
rs_bankcard.last();
if (rs_bankcard.getRow() != Integer.valueOf(id)) {
result = result && false;
failReason = failReason + "xyu_suggest info is not in DB;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_suggest info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 获取意见反馈列表
*
* @author puhui
*
*/
public class suggest_get_id extends XYZB implements API {
public String parameter;//参数集合
public String id;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
id = MapUtil.getParameter(parameter, "id").trim();
if ((!id.equals("")) && id.equals("code")) {
id = Current_suggest_id;
id = MapUtil.killQuotes(id, "\"");//去掉双引号的
return data;
}else{
id = MapUtil.killQuotes(id, "\"");//去掉双引号的
return data;
}
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Get_token(data, "/api/v1/suggest/"+id,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
// id =jp.getString("data.total");
Current_suggest_id =jp.getString("data.id");
//是否是线上环境
if (!isProduct) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_suggest a",
" 1 = 1 ");
rs_bankcard.last();
if (rs_bankcard.getRow() == 0) {
result = result && false;
failReason = failReason + "xyu_suggest info is not in DB;";
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_suggest info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 意见反馈类别列表
*
* @author puhui
*
*/
public class suggest_type extends XYZB implements API {
public String Description;//参数集合
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// 获取parameter对应的内容
Description = MapUtil.getValue("Description", data);
if(Description.contains("错误token")){
Response re = RequestDataUtils.Get_Errtoken(data, "/api/v1/room_files", Client_token);
return re;
}else if(Description.contains("超长token")){
Response re = RequestDataUtils.Get_Longtoken(data, "/api/v1/room_files", Client_token);
return re;
}else if(Description.contains("无token")){
Response re = RequestDataUtils.Get_Notoken_NoCookie(data, "/api/v1/room_files");
return re;
}
Response re = RequestDataUtils.Get_Noparameter(data, Url,Client_token);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 修改通讯录
*
* @author puhui
*
*/
public class update extends XYZB implements API {
public String parameter;//参数集合
public String name;//房间名称
public String phone;//房间名称
public String room_num;//房间名称
public String identity;
public String id;
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
name = MapUtil.getParameter(parameter, "name").trim();
phone = MapUtil.getParameter(parameter, "phone").trim();
room_num = MapUtil.getParameter(parameter, "room_num").trim();
identity = MapUtil.getParameter(parameter, "identity").trim();
id = MapUtil.getParameter(parameter, "id").trim();
if ((!room_num.equals("")) && room_num.equals("code")) {
room_num=Current_room;
parameter = parameter.replace("\"room_num\":code", "\"room_num\":\""+ room_num + "\"");
}
if ((!id.equals("")) && id.equals("code")) {
id = Current_mails_id;
parameter = parameter.replace("\"id\":code", "\"id\":\""+ id + "\"");
}
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
jsonAsMap.put("id", id);
jsonAsMap.put("name", name);
jsonAsMap.put("phone", phone);
jsonAsMap.put("room_num", room_num);
jsonAsMap.put("identity", identity);
Response re = RequestDataUtils.Put_Token(data, Client_token,Url,jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
//是否是线上环境
if (!isProduct && !(room_num.equals("'"))) {
try {
ResultSet rs_bankcard = this.selectFromDB(
" xyu_room_mails f ",
" f.room_num = '" + room_num + "' ");
rs_bankcard.last();
if (rs_bankcard.getRow() < 1) {
result = result && false;
failReason = failReason + "xyu_room_mails info is not in DB;";
} else {
String act_identity = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("identity")));
String act_name = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("name")));
String act_phone = String
.valueOf(rs_bankcard.getString(rs_bankcard.findColumn("phone")));
act_name = MapUtil.killQuotes(act_name, "\"");//去掉双引号的name
name = MapUtil.killQuotes(name, "\"");//去掉双引号的name
System.out.println(name);
System.out.println(act_name);
if ((!name.equals(act_name))
|| (!identity.equals(act_identity))
|| (!phone.equals(act_phone))
){
result = result && false;
failReason = failReason + "xyu_room_files info in DB is wrong;";
} else {
Log.logInfo("xyu_room_files info in DB is correct;");
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room_files info in DB;";
e.printStackTrace();
}
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
/**
* 更改用户状态
*
* @author puhui
*
*/
public class updateUser extends XYZB implements API {
public String parameter;//参数集合
public String Description;
public String uuid;
public String speaking_status;//是否禁言 ,1表示是,0表示不是
public String enabled;//是否踢人,1表示是,0表示不是
@Override
public void initialize(HashMap<String, Object> data) {
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
// 获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
speaking_status = MapUtil.getParameter(parameter, "speaking_status").trim();
enabled = MapUtil.getParameter(parameter, "enabled").trim();
uuid = MapUtil.getParameter(parameter, "uuid").trim();
uuid = MapUtil.killQuotes(uuid, "\"");//去掉双引号的education
if ((!uuid.equals("")) && uuid.equals("code")) {
parameter = Current_uuid;
parameter = MapUtil.killQuotes(parameter, "\"");//去掉双引号的parameter
data.put("parameter", parameter);
return data;
}
// 替换原来的parameter
data.put("parameter", uuid);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Map<String, Object> jsonAsMap = new HashMap<>();
parameter = MapUtil.getValue("parameter", data);
if(speaking_status.length()>0){
jsonAsMap.put("speaking_status", speaking_status);
}
if(enabled.length()>0){
jsonAsMap.put("enabled", enabled);
}
// System.out.println(room_nums.get("Not_edited"));
Response re = RequestDataUtils.Put_Token(data,Client_token, "/api/v1/users/"+parameter,jsonAsMap);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data").length()>4){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if("操作成功".equals(jp.getString("msg"))){
try {
parameter = MapUtil.getValue("parameter", data);
ResultSet rs_bankcard=null;
if(!parameter.contains("role")){
rs_bankcard = this.selectFromDB(
" xyu_room_users r ",
" r.uuid = '" + parameter + "' ");
rs_bankcard.last();
// System.out.println(rs_bankcard.getString("count(*)"));
}
if (speaking_status=="1" || speaking_status=="0"){
if(!(rs_bankcard.getString("speaking_status").equals(speaking_status))){
result = result && false;
failReason = failReason + "speaking_status is not find;";
}
}
if (enabled=="1" || enabled=="0") {
if(!(rs_bankcard.getString("enabled")).equals(enabled)){
result = result && false;
failReason = failReason + "enabled is not find;";
}
}
} catch (Exception e) {
result = result && false;
failReason = failReason + "cannot verify xyu_room info in DB;";
e.printStackTrace();
}
}
}
if (result){
return "Pass";
}else{
return "Fail:" + failReason;
}
}
}
package com.offcn.api.xyzb;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Random;
import org.json.simple.JSONArray;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.MyDateUtil;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.RequestDataUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.interfaces.API;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import net.sf.json.JSONObject;
/**
* 客户端登陆
*
* @author puhui
*
*/
public class users extends XYZB implements API {
public String parameter;//参数集合
public String Description;//用例名称
public String password;//姓名
public String nickname;//昵称
public String uuid;//
public String zgl_clienttype;//学生或者是老师
public String zgl_systemtype;//系统
@Override
public void initialize(HashMap<String, Object> data) {
if (!isProduct && data.get("CleanDB").toString().contains("Y")) {
this.cleanRoom_numsFromDB();//清除房间内已登录的用户信息
}
}
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
parameter = MapUtil.getValue("parameter", data);
password = MapUtil.getParameter(parameter, "password").trim();
nickname = MapUtil.getParameter(parameter, "nickname").trim();
uuid = MapUtil.getParameter(parameter, "uuid").trim();
Description = MapUtil.getValue("Description", data);
zgl_clienttype="ZgLiveStudent";//没有口令时候默认学生身份
if (!password.equals("") && password.length()!=12){//12位是不需要替换的明文口令
//保存当前用户类型
Current_password=password;
if(password.contains("student")){
zgl_clienttype="ZgLiveStudent";
}else{
zgl_clienttype="ZgLiveTeacher";
}
//保存当前用户口令和房间号
Current_user=ReadProperties.GetinformationByKey(password);
if ((!password.equals("")) && password.contains("Not_edited")) {
Current_room=ReadProperties.GetinformationByKey("Not_edited_xyzbroom_nums");
Current_room_id=ReadProperties.GetinformationByKey("Not_edited_xyzbid");
}
if ((!password.equals("")) && password.contains("Not_started")) {
Current_room=ReadProperties.GetinformationByKey("Not_started_xyzbroom_nums");
Current_room_id=ReadProperties.GetinformationByKey("Not_started_xyzbid");
}
if ((!password.equals("")) && password.contains("Running_xyzb")) {
Current_room=ReadProperties.GetinformationByKey("Running_xyzbroom_nums");
Current_room_id=ReadProperties.GetinformationByKey("Running_xyzbid");
}
if ((!password.equals("")) && password.contains("Finished_xyzb")) {
Current_room=ReadProperties.GetinformationByKey("Finished_xyzbroom_nums");
Current_room_id=ReadProperties.GetinformationByKey("Finished_xyzbid");
}
if ((!password.equals("")) && password.contains("Invalid_xyzb")) {
Current_room=ReadProperties.GetinformationByKey("Invalid_xyzbroom_nums");
Current_room_id=ReadProperties.GetinformationByKey("Invalid_xyzbid");
}
parameter = parameter.replace("\"password\":"+password,
"\"password\":\""+ Current_user + "\"");
if("Not_started_xyzbstudent_password".equals(password) && Description.contains("正向")){
BasicsGM.updateOrderStatus(" xyu.xyu_room "," start_time = '"+MyDateUtil.getTime(0, -10, 0)+"' ", " student_password ='"+ReadProperties.GetinformationByKey(password)+"'");
}
if("Not_started_xyzbstudent_password".equals(password) && Description.contains("反向")){
BasicsGM.updateOrderStatus(" xyu.xyu_room "," start_time = '"+MyDateUtil.getTime(0, 40, 0)+"' ", " student_password ='"+ReadProperties.GetinformationByKey(password)+"'");
}
}
if ((!nickname.equals("")) && nickname.equals("random")) {
Current_nickname="ys"+(new Random().nextInt(90000000)+ 10000000);
parameter = parameter.replace("\"nickname\":random", "\"nickname\":\""+ Current_nickname + "\"");
}
if ((!uuid.equals("")) && uuid!=null) {
Current_uuid=uuid;
}
if ((!uuid.equals("")) && uuid.equals("random")) {
Current_uuid="ys"+(new Random().nextInt(90000000)+ 10000000);
parameter = parameter.replace("\"uuid\":random", "\"uuid\":\""+ Current_uuid + "\"");
}
// 替换原来的parameter
data.put("parameter", parameter);
return data;
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
// Response re = RequestDataUtils.Post_NOToken(data, Url);
Response re = RequestDataUtils.Post_headers(data, Url,zgl_clienttype);
return re;
}
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
// System.out.println(json);
//
// System.out.println(data.get("statusCode"));
// System.out.println(re.getStatusCode());
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString().equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(jp.getString("msg"));
if ((data.get("code") != null )
&& ((jp.getString("code") == null) || (!jp.getString(
"code").equals(data.get("code").toString())))) {
result = result && false;
failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually "
+ jp.getString("code") + ".";
}
if ((data.get("msg") != null)
&& ((msg == null) || (!msg.equals(data.get("msg").toString())))) {
result = result && false;
failReason = failReason + "msg is expected "
+ data.get("msg").toString() + " but actually "
+ jp.getString("msg") + ".";
}
if(data.get("custom") != null && jp.getString("data")!=null){
String custom=data.get("custom").toString();
String[] ArrayString=StringUtils.getArrayString(custom,",");
if(!StringUtils.VerificationString(jp.getString("data"),ArrayString)){
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("data") + ".";
}
}
if (jp.getString("data") != null){
String token_data=jp.getString("data.access_token");
// String[] token_arr=token_data.split(",");
// String[] token_value=token_arr[0].split(":");
// Client_token=token_value[1];
Client_token=token_data;
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
}
package com.offcn.interfaces;
import io.restassured.response.Response;
import java.util.HashMap;
public interface API {
//初始化方法
void initialize(HashMap<String, Object> data);
//输入前处理数据,返回处理结果
HashMap<String, Object> handleInput(HashMap<String, Object> data);
//发送请求的方法
Response SendRequest(HashMap<String, Object> data,String Url,String Request);
//输出结果前处理数据,返回Pass或者Fail+信息
String handleOutput(Response re, HashMap<String, Object> data);
}
package com.offcn.listener;
import java.util.Arrays;
import java.util.TreeSet;
import org.testng.IInvokedMethod;
import org.testng.IInvokedMethodListener;
import org.testng.ITestResult;
/**
* method
* //method.getDate()
* @author Administrator
*
*/
public class ProcessTestng implements IInvokedMethodListener {
public static String NO="";
public static String NOTE="";
public static TreeSet<Integer> treeSet= new TreeSet<Integer>();
@Override
public void beforeInvocation(IInvokedMethod method, ITestResult result) {
Object s[]=result.getParameters();
String TCNO=getParameter(Arrays.toString(s),"TCNO");
String []Parameters=TCNO.split("_");
String Parameter_before=Parameters[0];
//获得用例编号
String TestNO=getParameter(Arrays.toString(s),"NO");
if(!("".equals(TestNO.trim()))){
int a2=Integer.parseInt(TestNO.trim());
if(NOTE.equals(Parameter_before)){
int w=(a2-1);
treeSet.add(w);
}
}
}
@Override
public void afterInvocation(IInvokedMethod method, ITestResult result) {
// System.out.println(result.isSuccess());
if(result.isSuccess()){
}else{
//总体算法是第一个减去第二个数加1
Object s[]=result.getParameters();
//分离第二个参数的前后
String TCNO=getParameter(Arrays.toString(s),"TCNO");
// System.out.println("TCNO="+TCNO);
String []Parameters=TCNO.split("_");
String Parameter_before=Parameters[0];
NOTE=Parameter_before;
String Parameter_after=Parameters[1];
int NOTE_NO=Integer.parseInt(Parameter_after.trim());
//获取第一个参数的值
String TestNO=getParameter(Arrays.toString(s),"NO");
int Test_NO=Integer.parseInt(TestNO);
//最终得数
int su=Test_NO-NOTE_NO;
//在记录本中记录
for(int i=su;i<Test_NO;i++){
treeSet.add(i);
}
}
}
//在parameter中查看,是否有(第二个参数)verifyCode的关键字,有的话返回他的字母值
public static String getParameter(String parameter,String Letter){
if(parameter==null){
return "";
}
String[] strcomma=parameter.split(",");
int comma=strcomma.length;
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
//此时是多个,,,
String[] str=strcomma[k].split("=");
String str_strcomma=Arrays.toString(str);
// System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
//在找到后的位置开始查找数字,最后把数字的字符串返回
if(str_strcomma.contains(Letter)){
int start=str_strcomma.indexOf(',');
sb.append(str_strcomma.substring(start+2,str_strcomma.length()-1));
return sb.toString();
}
}
return sb.toString();
}
}
package com.offcn.listener;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.TreeSet;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.testng.IReporter;
import org.testng.ISuite;
import org.testng.xml.XmlSuite;
public class ResultTestng implements IReporter {
@Override
public void generateReport(List<XmlSuite> XmlSuite, List<ISuite> ISuite,
String arg2) {
TreeSet<Integer> treeSet=ProcessTestng.treeSet;
Iterator<Integer> it=treeSet.iterator();
StringBuffer sb=new StringBuffer();
while(it.hasNext()){
sb.append(it.next());
sb.append(" ");
}
System.out.println("sb="+sb);
// 创建文档。
Document document = DocumentHelper.createDocument();
// 设置文档DocType
document.addDocType("suite", null, "http://testng.org/testng-1.0.dtd");
// 文档增加节点,即根节点
Element root = document.addElement("suite");
root.addAttribute("name", "Failed suite-ys");
// 根节点下添加节点
Element first = root.addElement("test");
// 节点添加属性
first.addAttribute("name", "Default test-ys");
// 节点下添加节点
Element info = first.addElement("classes");
Element class1 = info.addElement("class");
class1.addAttribute("name", "com.puhui.test.RenMai_APITest");
Element methods = class1.addElement("methods");
Element include = methods.addElement("include");
include.addAttribute("name", "f");
include.addAttribute("invocation-numbers", sb.toString());
XMLWriter writer =null;
FileOutputStream fos =null;
try {
// 创建格式化类
OutputFormat format = OutputFormat.createPrettyPrint();
// 设置编码格式,默认UTF-8
format.setEncoding("UTF-8");
// 创建输出流,此处要使用Writer,需要指定输入编码格式,使用OutputStream则不用
fos = new FileOutputStream("src/DefectTest.xml");
// 创建xml输出流
writer = new XMLWriter(fos, format);
// 生成xml文件
writer.write(document);
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
if(fos!=null)
fos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
try {
if(writer!=null)
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
package com.offcn.process;
import io.restassured.response.Response;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.XMLread;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public abstract class BasicsGM {
// //数据提取
// public static HashMap<String, Object> data_ext=new HashMap<String, Object>();
//
// //用户验证码<电话号码,验证码>
// public static HashMap<String, String> verifyCode=new HashMap<String, String>();
//
// public static List<String> cust_ids = new ArrayList<String>();//客户表id,
//
// public static List<String> contractId_dd = new ArrayList<String>();//任买合同id,
//
// public static List<String> prod_ids = new ArrayList<String>();//商品信息表id
//
// public static List<String> order_ids = new ArrayList<String>();//订单表id
//
// public static HashMap<String, String> thirdBusi = new HashMap<String, String>();//子商户表id
//
// public static List<String> rulesEngine_ids = new ArrayList<String>();//决策引擎customer表 id
//
public static Connection conn = null;
public static Statement stmt = null;
//
public static Map<String,Object> map=new XMLread().getSystem();// 读取XML配置文件
//
public static boolean isProduct = false;
//
//更改huimai.bestbuy_order表,条件是id=orderId,值该为orderStatus
public static Integer updateOrderStatus(String fromName,String setCondition, String whereCondition) {
Integer result=null;
String sql =null;
try {
sql = " update "+fromName+" set "+setCondition+" where " + whereCondition;
result = stmt.executeUpdate(sql);//
if (result == -1) {
Log.logInfo("update failed! "+sql);
}else{
Log.logInfo("update OK! " + sql);
}
} catch (SQLException e) {
Log.logError("update failed! "+sql);
}
return result;
}
//查询表名tableName的条件是condition的结果集
public ResultSet selectFromDB(String tableName, String condition) throws Exception {
String sql;
ResultSet rs = null;
sql = " select * from " + tableName + " where " + condition;
// System.out.println(sql);
rs = stmt.executeQuery(sql);
return rs;
}
//查询表名tableName的条件是condition的结果集,返回数量
public ResultSet selectCountFromDB(String tableName, String condition) throws Exception {
String sql;
ResultSet rs = null;
sql = " select count(*) from " + tableName + " where " + condition;
// Log.logInfo(sql);
rs = stmt.executeQuery(sql);
return rs;
}
//具体的删除动作,tableName=表名,key列,value值使用的like删除
public void deleteFromDB(String tableName, String key, String value) throws Exception {
String sql = "delete from " + tableName + " where " + key + " like '" + value + "'";
Log.logInfo("sql==="+sql);
int result = stmt.executeUpdate(sql);
Log.logInfo("result==="+result);
if (result == -1) {
Log.logError("Clean failed!");
}
}
// 如果cust_ids集合有值,则循环删除map_table集合内,表名=KEY,列名=value,值=cust_ids得遍历结果
public void cleanCustomerInfo() {
HashMap<String, String> map_table = new HashMap<String, String>();
//用户验证所需的表格
map_table.put("bestbuy_third_user", "cust_id");//任买外接第三方用户表
map_table.put("bestbuy_customer", "id");//用户表
//工作族基本信息
map_table.put("bestbuy_doc", "rela_id");//用户身份证照片
map_table.put("bestbuy_customer_info", "customer_id");//用户信息表
map_table.put("bestbuy_bankcard", "customer_id");//银行卡信息表
map_table.put("bestbuy_customer_book", "customer_id");//用户电话簿信息表
map_table.put("bestbuy_customer_licensesinfo", "customer_id");//用户第三方授权信息表
map_table.put("bestbuy_module_auth", "cust_id");//用户授权表
map_table.put("bestbuy_audit_record", "cust_id");//人工信审工单处理记录表
/*
map_table.put("bestbuy_customer_auth", "customer_id");//用户授权表 ---APP端
map_table.put("bestbuy_bank_record", "customer_id");//绑卡记录表
*/
map_table.put("bestbuy_customer_com", "customer_id");//客户公司信息表
map_table.put("bestbuy_customer_location", "customer_id");//客户地址信息
map_table.put("bestbuy_relationship", "customer_id");//用户关系表
map_table.put("bestbuy_order", "customer_id");//订单表
//合同表bestbuy_contract,暂时不清除,因为需要orderid,并且合同表关联到保理业务。。
// Iterator<String> it_cust = cust_ids.iterator();//客户表id
//
// while (it_cust.hasNext()) {
// Iterator<Entry<String, String>> it_table = map_table.entrySet().iterator();
// String cust = it_cust.next();
// while (it_table.hasNext()) {
// Map.Entry<String, String> entry = (Map.Entry<String, String>) it_table.next();
// try {
// this.deleteFromDB(entry.getKey(), entry.getValue(), cust);
// } catch (Exception e) {
// System.out.println("Fail to clean customer info!");
// }
// }
// }
// cust_ids.clear();
}
//
// //按照customer_id删除决策引擎中用户的数据-预授信模式
// public void cleanStreamingCustomerInfo(String customer_id) {
// HashMap<String, String> map_table = new HashMap<String, String>();
// map_table.put("streaming.customer", "id");//决策引擎用户表
// map_table.put("streaming.customer_info", "customer_id");//决策引擎用户表
// map_table.put("streaming.customer_data_info", "customer_id");//决策引擎用户数据表
// map_table.put("streaming.customer_limit_account_log", "customer_id");//用户身份证照片
// map_table.put("streaming.customer_limit_account", "customer_id");//客户额度账户表
// map_table.put("streaming.customer_merchant_info", "customer_id");//商户信息表
//
// Iterator<Entry<String, String>> it_table = map_table.entrySet().iterator();
// while (it_table.hasNext()) {
// Map.Entry<String, String> entry = (Map.Entry<String, String>) it_table.next();
// try {
// this.deleteFromDB(entry.getKey(), entry.getValue(), customer_id);
// } catch (Exception e) {
// System.out.println("Fail to clean customer info!");
// }
// }
// }
//
// //按照streaming_process_info_id删除决策引擎中用户的数据-订单模式
// public void cleanStreamingOrder(String id) {
// HashMap<String, String> map_table = new HashMap<String, String>();
// map_table.put("streaming.third_ylzc_advanced_data", "id");//决策引擎用户表
// map_table.put("streaming.third_ylzc_base_data", "id");//决策引擎用户数据表
// map_table.put("streaming.third_ylzc_basic_data_past_all_month", "id");//用户身份证照片
// map_table.put("streaming.third_ylzc_basic_data_recent_1_3_month", "id");//客户额度账户表
// map_table.put("streaming.third_ylzc_basic_data_recent_12_month", "id");//商户信息表
// map_table.put("streaming.third_ylzc_basic_data_recent_6_month", "id");//商户信息表
// map_table.put("streaming.third_ylzc_classical_data", "id");//商户信息表
// map_table.put("streaming.third_ylzc_customized_data", "id");//商户信息表
// map_table.put("streaming.streaming_customer_licensesinfo", "work_id");//用户授权信息表
// map_table.put("streaming.streaming_process_info", "id");//流程信息
//
// Iterator<Entry<String, String>> it_table = map_table.entrySet().iterator();
// while (it_table.hasNext()) {
// Map.Entry<String, String> entry = (Map.Entry<String, String>) it_table.next();
// try {
// this.deleteFromDB(entry.getKey(), entry.getValue(), id);
// } catch (Exception e) {
// System.out.println("Fail to clean customer info!");
// }
// }
// }
//
//
//
//
//
//
// //清除list集合prod_ids,表名"bestbuy_goods",列名id,值prod_ids得遍历结果
//
//
// public void cleanProductsFromDB() {
// Iterator<String> it_prod = prod_ids.iterator();
//
// while (it_prod.hasNext()) {
// try {
// this.deleteFromDB("bestbuy_goods", "id", it_prod.next());
// } catch (Exception e) {
// System.out.println("Fail to clean product info!");
// }
//
// }
// prod_ids.clear();
//
// }
//
// //清除list集合order_ids,表名"bestbuy_order",列名id,值order_ids得遍历结果
//
// public void cleanOrdersFromDB() {
// Iterator<String> it_order = order_ids.iterator();
//
// while (it_order.hasNext()) {
// try {
// this.deleteFromDB("bestbuy_order", "id", it_order.next());
// } catch (Exception e) {
// System.out.println("Fail to clean order info!");
// }
//
// }
// order_ids.clear();
//
// }
//
// //清除list集合order_ids,表名"bestbuy_order",列名id,值order_ids得遍历结果
//
// public void cleanRulesEngine_idsFromDB() {
// Iterator<String> it_rulesEngine = rulesEngine_ids.iterator();
//
// Statement stmt_RulesEngine =null;
//
// while (it_rulesEngine.hasNext()) {
// try {
// stmt_RulesEngine = conn.createStatement();
// String sql = "delete from " + "streaming.customer" + " where " + "id_no" + " like '" + it_rulesEngine.next() + "'";
// System.out.println("sql==="+sql);
// int result = stmt_RulesEngine.executeUpdate(sql);
// System.out.println("result==="+result);
// if (result == -1) {
// System.out.println("Clean failed!");
// }
// } catch (Exception e) {
// System.out.println("Fail to clean order info!");
// }finally{
// if (stmt_RulesEngine != null){
// try {
// stmt_RulesEngine.close();
// } catch (SQLException e) {
// e.printStackTrace();
// }
// }
// }
// }
//
// rulesEngine_ids.clear();
//
// }
//
//
// //从thirdBusi这个map集合中,往huimai.bestbuy_sub_busi这个表添加信息
//
// public void addTestThirdBusiInfoFromDB() {
// Statement stmt;
// try {
// stmt = conn.createStatement();
//
// String sql = "insert into huimai.bestbuy_sub_busi (busi_id,sub_busi_name,busi_id_third,create_time) "
// + "values('999','" + thirdBusi.get("busiName") + "','" + thirdBusi.get("busiId") + "', NOW())";
// // System.out.println(sql);
// int result = stmt.executeUpdate(sql);//
// if (result == -1) {
// System.out.println("Insert failed!");
// }
// } catch (SQLException e) {
// System.out.println("Insert failed!");
// }
//
// }
//
// //从thirdBusi这个map集合中,在huimai.bestbuy_sub_busi这个表删除信息
//
// public void cleanTestThirdBusiInfoFromDB() {
// Statement stmt;
// try {
// stmt = conn.createStatement();
//
// String sql = "delete from huimai.bestbuy_sub_busi where " + "sub_busi_name ='"
// + thirdBusi.get("busiName") + "' and busi_id_third='" + thirdBusi.get("busiId") + "'";
// // System.out.println(sql);
// int result = stmt.executeUpdate(sql);//
// if (result == -1) {
// System.out.println("clean busi info failed!");
// }
// } catch (SQLException e) {
// System.out.println("clean busi info failed!");
// }
//
// }
//
//
// //更改
//
// public void updateTableValueWithCondition(String table, String setStatement, String whereStatement) {
// Statement stmt;
// try {
// stmt = conn.createStatement();
//
// String sql = "update "+table+" set "+setStatement+" where "+whereStatement;
//// System.out.println(sql);
// int result = stmt.executeUpdate(sql);//
// if (result == -1) {
// System.out.println("update table value failed!");
// }
// } catch (SQLException e) {
// System.out.println("update table value failed!");
// }
// }
//
//
// // 字符串转换成时间类型
//
// public Date convertStrToDate(String dateStr) {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
// Date date = null;
// try {
// date = sdf.parse(dateStr);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return date;
//
// }
//
// //时间转换成字符串类型
// public String convertDateToStr(Date date) {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
// String dateStr = null;
// try {
// dateStr = sdf.format(date);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return dateStr;
//
// }
//
// public String getContractId(){
// for(int i=0;i<contractId_dd.size();i++){
// if(contractId_dd.get(i)!=null){
// return contractId_dd.get(i);
// }
// }
// return null;
// }
//
//判断字符串是否是空或者是“”
public boolean StringIsNull(String str){
if(str==null || "".equals(str)){
return false;
}else{
return true;
}
}
//获取errcode或code,或者msg或errmsg,返回去作为用例输出结果
public String getCodeOrErrcode( Response re){
try {
String code=JSONObject.fromObject(re.body().asString()).getString("code");
if(StringIsNull(code)){
return code;
}
} catch (Exception e) {
return "无code返回";
}
try {
String errcode=JSONObject.fromObject(re.body().asString()).getString("errcode");
if(StringIsNull(errcode)){
return errcode;
}
} catch (Exception e) {
return "无code返回";
}
return "";
}
//获取errcode或code,或者msg或errmsg,返回去作为用例输出结果
public String getMsgOrErrmsg( Response re){
try {
String msg=JSONObject.fromObject(re.body().asString()).getString("msg");
if(StringIsNull(msg)){
return msg;
}
} catch (Exception e) {
}
try {
String errmsg=JSONObject.fromObject(re.body().asString()).getString("errmsg");
if(StringIsNull(errmsg)){
return errmsg;
}
} catch (Exception e) {
}
try {
String errmsg=JSONObject.fromObject(re.body().asString()).getString("message");
if(StringIsNull(errmsg)){
return errmsg;
}
} catch (Exception e) {
return "无msg返回";
}
return "";
}
//
// //加解密
// public HashMap<String, Object> EncryptionAnddecryption(HashMap<String, Object> data) {
// // 获取parameter对应的内容
// String parameter="";//参数集合
// String list="";//参数集合
// String phone="";//电话
// String idNo="";//身份证号
//
// parameter = MapUtil.getValue("parameter", data);
// phone = MapUtil.getParameter(parameter, "phone").trim();
// phone = MapUtil.killQuotes(phone, "\"");
// idNo = MapUtil.getParameter(parameter, "idNo").trim();
// idNo = MapUtil.killQuotes(idNo, "\"");
// list = MapUtil.getParameter(parameter, "\"list\":").trim();
//
//
// if (phone != null && !"".equals(phone)) {
// parameter = parameter.replace(phone, EncryptionUtil.encrypt(phone));
// }
// if (idNo != null && !"".equals(idNo)) {
// parameter = parameter.replace(idNo, EncryptionUtil.encrypt(idNo));
// }
//
// if (list != null && !"".equals(list)) {
// JSONArray ja = JSONArray.fromObject(list);
// Iterator<?> it = ja.iterator();
//
// while (it.hasNext()) {
// JSONObject jo = (JSONObject) it.next();
// phone = jo.has("phone") ? jo.getString("phone") : "";
// if (phone != null && !"".equals(phone)) {
// parameter = parameter.replace(phone, EncryptionUtil.encrypt(phone));
// }
// }
// }
// // 替换原来的data
// data.put("parameter", parameter);
// return data;
// }
}
package com.offcn.process;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.cmdUtil;
import com.offcn.system.system;
public class XYZB extends BasicsGM{
public static String Page_token="";//登录页面token
public static HashMap<String, Object> Enterprise_users=new HashMap<String, Object>();//企业用户
public static HashMap<String, Object> Business_Administrator=new HashMap<String, Object>();//业务管理员
public static String Salesman_token="";//业务员登录token
public static String Client_token="";//客户端登录token
public static String laravel_session="";//cookie
public static String XSRF_token="";// XSRF-token
public static String Current_mails_id="";// 当前用户通讯录表主键
public static String Current_user_id="";// 当前用户user表主键
public static String Current_questions_id="";// questions表id主键
public static String Current_announcement_id="";// 公告announcement表id主键
public static String Current_suggest_id="";// 反馈列表id
public static String Current_user="";// 当前用户口令
public static String Current_room="";// 当前房间号
public static String Current_room_id="";// 当前房间主键id
public static String Current_nickname="";// 当前用户昵称
public static String Current_uuid="";// 当前用户uuid
public static String Current_password="";// 当前用户类型
public static String Current_id="";// 房间文件id
//未编辑--口令
public static HashMap<String, Object> Not_edited_xyzb=new HashMap<String, Object>();
//未开始--口令
public static HashMap<String, Object> Not_started_xyzb=new HashMap<String, Object>();
//直播中--口令
public static HashMap<String, Object> Running_xyzb=new HashMap<String, Object>();
//已结束--口令
public static HashMap<String, Object> Finished_xyzb=new HashMap<String, Object>();
//已失效--口令
public static HashMap<String, Object> Invalid_xyzb=new HashMap<String, Object>();
//房间编号
public static HashMap<String, Object> room_nums=new HashMap<String, Object>();
//房间名称
public static HashMap<String, Object> room_names=new HashMap<String, Object>();
//推流
public static HashMap<String, Object> push_xyzb=new HashMap<String, Object>();
//拉流
public static HashMap<String, Object> pull_xyzb=new HashMap<String, Object>();
static{
//初始环境设置DNS
// if(!cmdUtil.run("nslookup www.qq.com").contains("192.168.10.222")){
// Log.logInfo("正在设置dns地址为:192.168.10.222,如果失败,请断开有限网络,用无线网络连接");
// cmdUtil.run("netsh interface ip set dns \"无线网络连接(media-test)\" static 192.168.10.222");
// }else{
// Log.logInfo("dns地址正确无需设置");
// }
//本地数据库连接
// try {
// Class.forName("com.mysql.jdbc.Driver");
// conn = DriverManager.getConnection(((system)map.get("xyzb")).getSqlurl(),
// ((system)map.get("xyzb")).getSqlname(),
// ((system)map.get("xyzb")).getSqlpwd());
// stmt = conn.createStatement();
//
// } catch (Exception e) {
// e.printStackTrace();
// }
//线上数据库连接
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(((system)map.get("xyzbxs")).getSqlurl(),
((system)map.get("xyzbxs")).getSqlname(),
((system)map.get("xyzbxs")).getSqlpwd());
stmt = conn.createStatement();
} catch (Exception e) {
e.printStackTrace();
}
//初始化数据录入
if(!ReadProperties.isBoolean()){
Log.logInfo("加载数据源。。。");
Enterprise_users.put("name", ReadProperties.GetinformationByKey("Enterprise_users"));
Business_Administrator.put("name", ReadProperties.GetinformationByKey("Business_Administrator"));
Not_edited_xyzb.put("teacher_password", ReadProperties.GetinformationByKey("Not_edited_xyzbteacher_password"));
Not_edited_xyzb.put("student_password", ReadProperties.GetinformationByKey("Not_edited_xyzbstudent_password"));
Not_edited_xyzb.put("assistant_password", ReadProperties.GetinformationByKey("Not_edited_xyzbassistant_password"));
Not_edited_xyzb.put("host_password", ReadProperties.GetinformationByKey("Not_edited_xyzbhost_password"));
room_nums.put("Not_edited", ReadProperties.GetinformationByKey("Not_edited_xyzbroom_nums"));//存储房间编号
room_names.put("Not_edited", ReadProperties.GetinformationByKey("Not_edited_xyzbroom_names"));//存储房间名称
Not_started_xyzb.put("teacher_password", ReadProperties.GetinformationByKey("Not_started_xyzbteacher_password"));
Not_started_xyzb.put("student_password", ReadProperties.GetinformationByKey("Not_started_xyzbstudent_password"));
Not_started_xyzb.put("assistant_password", ReadProperties.GetinformationByKey("Not_started_xyzbassistant_password"));
Not_started_xyzb.put("host_password", ReadProperties.GetinformationByKey("Not_started_xyzbhost_password"));
room_nums.put("Not_started", ReadProperties.GetinformationByKey("Not_started_xyzbroom_nums"));
room_names.put("Not_started", ReadProperties.GetinformationByKey("Not_started_xyzbroom_names"));
Running_xyzb.put("teacher_password", ReadProperties.GetinformationByKey("Running_xyzbteacher_password"));
Running_xyzb.put("student_password", ReadProperties.GetinformationByKey("Running_xyzbstudent_password"));
Running_xyzb.put("assistant_password", ReadProperties.GetinformationByKey("Running_xyzbassistant_password"));
Running_xyzb.put("host_password", ReadProperties.GetinformationByKey("Running_xyzbhost_password"));
room_nums.put("Running_xyzb", ReadProperties.GetinformationByKey("Running_xyzbroom_nums"));
room_names.put("Running_xyzb", ReadProperties.GetinformationByKey("Running_xyzbroom_names"));
Finished_xyzb.put("teacher_password", ReadProperties.GetinformationByKey("Finished_xyzbteacher_password"));
Finished_xyzb.put("student_password", ReadProperties.GetinformationByKey("Finished_xyzbstudent_password"));
Finished_xyzb.put("assistant_password",ReadProperties.GetinformationByKey("Finished_xyzbassistant_password"));
Finished_xyzb.put("host_password", ReadProperties.GetinformationByKey("Finished_xyzbhost_password"));
room_nums.put("Finished_xyzb", ReadProperties.GetinformationByKey("Finished_xyzbroom_nums"));
room_names.put("Finished_xyzb", ReadProperties.GetinformationByKey("Finished_xyzbroom_names"));
Invalid_xyzb.put("teacher_password", ReadProperties.GetinformationByKey("Invalid_xyzbteacher_password"));
Invalid_xyzb.put("student_password",ReadProperties.GetinformationByKey("Invalid_xyzbstudent_password"));
Invalid_xyzb.put("assistant_password", ReadProperties.GetinformationByKey("Invalid_xyzbassistant_password"));
Invalid_xyzb.put("host_password", ReadProperties.GetinformationByKey("Invalid_xyzbhost_password"));
room_nums.put("Invalid_xyzb", ReadProperties.GetinformationByKey("Invalid_xyzbroom_nums"));
room_names.put("Invalid_xyzb", ReadProperties.GetinformationByKey("Invalid_xyzbroom_names"));
}
}
//清除map集合Enterprise_users(企业用户),表名"xyu_users",列名name,
public void cleanEnterprise_usersFromDB() {
try {
deleteFromDB("xyu_users", "name", Enterprise_users.get("name").toString());
} catch (Exception e) {
e.printStackTrace();
}
}
//清除map集合room_nums,表名"xyu_room_users",列名room_num,
public void cleanRoom_numsFromDB() {
try {
deleteFromDB("xyu_room_users", "room_num", room_nums.get("Not_edited").toString());
deleteFromDB("xyu_room_users", "room_num", room_nums.get("Not_started").toString());
deleteFromDB("xyu_room_users", "room_num", room_nums.get("Running_xyzb").toString());
deleteFromDB("xyu_room_users", "room_num", room_nums.get("Finished_xyzb").toString());
deleteFromDB("xyu_room_users", "room_num", room_nums.get("Invalid_xyzb").toString());
} catch (Exception e) {
e.printStackTrace();
}
}
//清除map集合Business_Administrator(业务管理员),表名"xyu_users",列名name,
public void cleanBusiness_AdministratorFromDB() {
try {
deleteFromDB("xyu_users", "name", Business_Administrator.get("name").toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.offcn.system;
public class system {
private String access_token_uri;
private String client_id;
private String client_secret;
private String grant_type;
private String isProduct;
private String RM_URI;
private String RM_port;
private String RM_basePath;
private String redis_URI;
private String redis_db_index;
private String sqlurl;
private String sqlname;
private String sqlpwd;
public String getAccess_token_uri() {
return access_token_uri;
}
public void setAccess_token_uri(String access_token_uri) {
this.access_token_uri = access_token_uri;
}
public String getClient_id() {
return client_id;
}
public void setClient_id(String client_id) {
this.client_id = client_id;
}
public String getClient_secret() {
return client_secret;
}
public void setClient_secret(String client_secret) {
this.client_secret = client_secret;
}
public String getGrant_type() {
return grant_type;
}
public void setGrant_type(String grant_type) {
this.grant_type = grant_type;
}
public String getIsProduct() {
return isProduct;
}
public void setIsProduct(String isProduct) {
this.isProduct = isProduct;
}
public String getRM_URI() {
return RM_URI;
}
public void setRM_URI(String rM_URI) {
RM_URI = rM_URI;
}
public String getRM_port() {
return RM_port;
}
public void setRM_port(String rM_port) {
RM_port = rM_port;
}
public String getRM_basePath() {
return RM_basePath;
}
public void setRM_basePath(String rM_basePath) {
RM_basePath = rM_basePath;
}
public String getRedis_URI() {
return redis_URI;
}
public void setRedis_URI(String redis_URI) {
this.redis_URI = redis_URI;
}
public String getRedis_db_index() {
return redis_db_index;
}
public void setRedis_db_index(String redis_db_index) {
this.redis_db_index = redis_db_index;
}
public String getSqlurl() {
return sqlurl;
}
public void setSqlurl(String sqlurl) {
this.sqlurl = sqlurl;
}
public String getSqlname() {
return sqlname;
}
public void setSqlname(String sqlname) {
this.sqlname = sqlname;
}
public String getSqlpwd() {
return sqlpwd;
}
public void setSqlpwd(String sqlpwd) {
this.sqlpwd = sqlpwd;
}
public system(String access_token_uri, String client_id,
String client_secret, String grant_type, String isProduct,
String rM_URI, String rM_port, String rM_basePath,
String redis_URI, String redis_db_index, String sqlurl,
String sqlname, String sqlpwd) {
super();
this.access_token_uri = access_token_uri;
this.client_id = client_id;
this.client_secret = client_secret;
this.grant_type = grant_type;
this.isProduct = isProduct;
RM_URI = rM_URI;
RM_port = rM_port;
RM_basePath = rM_basePath;
this.redis_URI = redis_URI;
this.redis_db_index = redis_db_index;
this.sqlurl = sqlurl;
this.sqlname = sqlname;
this.sqlpwd = sqlpwd;
}
public system() {
super();
}
}
package com.offcn.test;
import io.restassured.response.Response;
import java.sql.SQLException;
import java.util.HashMap;
import net.sf.json.JSONObject;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import com.offcn.TestData.offcn_api_testData;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.OAuthTokenUnti;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.Reflect_api;
import com.offcn.TestUnti.SheetUtils;
import com.offcn.TestUnti.StringUtils;
import com.offcn.TestUnti.XMLread;
import com.offcn.interfaces.API;
import com.offcn.listener.ProcessTestng;
import com.offcn.listener.ResultTestng;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
@Listeners({ ProcessTestng.class ,ResultTestng.class })
public class APITest extends XYZB{
@Test(dataProvider = "renmai", dataProviderClass = offcn_api_testData.class)
public void f(HashMap<String, Object> data) {
Log.logInfo(data.get("TCNO").toString() + " Step " + data.get("Description").toString() + " is running......");
// if(data.get("TCNO").toString().contains("3")){
// System.out.println("到啦");
// }
// if(data.get("TCNO").toString().contains("4")){
// System.out.println("到啦");
// }
// if(data.get("TCNO").toString().contains("5")){
// System.out.println("到啦");
// }
API obj = new Reflect_api().Reflections(data);
BasicsGM.map=new XMLread().getSystem();
obj.initialize(data);
data = obj.handleInput(data);
String parameter = MapUtil.getValue("parameter", data);
Long startTime=System.currentTimeMillis();
Response re = obj.SendRequest(data, data.get("serviceUrl").toString(), data.get("Request").toString());
Long endTime=System.currentTimeMillis();
String time=(endTime-startTime)+"毫秒";
String body=re.asString();
String codeORerrcode="";
String msgORerrmsy="";
String result = "";
if(body.contains("<title>")){
int Alength="<title>".length();
int start=body.indexOf("<title>");
int end=body.indexOf("</title>")+1;
body="页面标题:"+body.substring(start+Alength, end-1);
result=body;
if(data.get("Description").toString().contains("流程")){
result = obj.handleOutput(re, data);
}
}else{
result = obj.handleOutput(re, data);
}
codeORerrcode=getCodeOrErrcode(re);
msgORerrmsy=getMsgOrErrmsg(re);
System.out.println();
Log.logInfo("返回结果="+StringUtils.decodeUnicode(body));
//数据回写
// HashMap<String, Object> ExpectResult=MapUtil.Expect(data);
// SheetUtils sheet = new SheetUtils("DataAll.xls", "Output");
// sheet.writeExcel(
// data.get("NO").toString(),
// data.get("TCNO").toString() + "_Step" + data.get("Step").toString(),
// data.get("Description").toString(),
// parameter,
// JSONObject.fromObject(ExpectResult).toString(),
// StringUtils.decodeUnicode(re.asString()),
// codeORerrcode,
// msgORerrmsy,
// result,
// time
// );
if(result.indexOf("Fail")!=-1){
Assert.assertTrue(false);
}else{
Assert.assertTrue(true);
}
// OAuthTokenUnti.token=null;
}
@AfterClass
public void afterClass() {
//测试结束删除测试所用的数据
if (!isProduct) {
// cleanEnterprise_usersFromDB();//清除企业用户
// cleanBusiness_AdministratorFromDB();//清除企业管理员
// ReadProperties.ClearProperty();//清除环境配置文件
try {
if(stmt!=null){
stmt.close();
}
if (conn != null){
conn.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
Log.logInfo("========测试结束========");
}
}
package com.offcn.test;
import com.offcn.TestUnti.ReadProperties;
public class delTable {
public static void main(String[] args) {
ReadProperties.ClearProperty();//清除环境配置文件
}
}
log4j.rootLogger=INFO,console,dra
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%p|%d{yyyy/MM/dd HH:mm}|=>%c.%M()[%F:%L] : %m%n
log4j.appender.fileappender=org.apache.log4j.FileAppender
log4j.appender.fileappender.layout=org.apache.log4j.SimpleLayout
log4j.appender.fileappender.file=log\\RenMai.log
log4j.appender.dra=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dra.layout=org.apache.log4j.PatternLayout
log4j.appender.dra.layout.ConversionPattern=%p|%d{yyyy/MM/dd HH:mm}|=>%c.%M()[%F:%L] : %m%n
log4j.appender.dra.file=log\\RenMai.log
log4j.appender.dra.datePattern='.'yyyy-MM-dd
\ No newline at end of file
package makeTestCase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
public class HelloHongShu {
/**
* 获取N个集合的笛卡尔积
* <p/>
* 说明:假如传入的字符串为:"1,2,3==5,6==7,8"
* 转换成字符串数组为:[[1, 2, 3], [5, 6], [7, 8]]
* a=[1, 2, 3]
* b=[5, 6]
* c=[7, 8]
* 其大小分别为:a_length=3,b_length=2,c_length=2,
* 目标list的总大小为:totalSize=3*2*2 = 12
* 对每个子集a,b,c,进行循环次数=总记录数/(元素个数*后续集合的笛卡尔积个数)
* 对a中的每个元素循环次数=总记录数/(元素个数*后续集合的笛卡尔积个数)=12/(3*4)=1次,每个元素每次循环打印次数:后续集合的笛卡尔积个数=2*2个
* 对b中的每个元素循环次数=总记录数/(元素个数*后续集合的笛卡尔积个数)=12/(2*2)=3次,每个元素每次循环打印次数:后续集合的笛卡尔积个数=2个
* 对c中的每个元素循环次数=总记录数/(元素个数*后续集合的笛卡尔积个数)=12/(2*1)=6次,每个元素每次循环打印次数:后续集合的笛卡尔积个数=1个
* <p/>
* 运行结果:
* [[1, 2, 3], [5, 6], [7, 8]]
* 1,5,7,
* 1,5,8,
* 1,6,7,
* 1,6,8,
* 2,5,7,
* 2,5,8,
* 2,6,7,
* 2,6,8,
* 3,5,7,
* 3,5,8,
* 3,6,7,
* 3,6,8]
* <p/>
* 从结果中可以看到:
* a中的每个元素每个元素循环1次,每次打印4个
* b中的每个元素每个元素循环3次,每次打印2个
* c中的每个元素每个元素循环6次,每次打印1个
*
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// String str = "a,b,c==d,e,f==x,y,z";
String str = "x,y==x,y";
Set<String> result = getSet(str);
// System.out.println("set个数="+result.size());
Iterator it=result.iterator();
while(it.hasNext()){
System.out.println(it.next());
}
}
public static Set<String> getSet(String str){
List<String> result = descartes(str);
// System.out.println("list个数="+result.size());
Set<String> set=new HashSet<String>();
set.addAll(result);//给set填充
// result.clear();//清空list,不然下次把set元素加入此list的时候是在原来的基础上追加元素的
return set;
}
@SuppressWarnings("rawtypes")
public static List<String> descartes(String str) {
String[] list = str.split("==");
List<List> strs = new ArrayList<List>();
for (int i = 0; i < list.length; i++) {
strs.add(Arrays.asList(list[i].split(",")));
}
// System.out.println(strs);
int total = 1;
for (int i = 0; i < strs.size(); i++) {
total *= strs.get(i).size();
}
String[] mysesult = new String[total];
int now = 1;
//每个元素每次循环打印个数
int itemLoopNum = 1;
//每个元素循环的总次数
int loopPerItem = 1;
for (int i = 0; i < strs.size(); i++) {
List temp = strs.get(i);
now = now * temp.size();
//目标数组的索引值
int index = 0;
int currentSize = temp.size();
itemLoopNum = total / now;
loopPerItem = total / (itemLoopNum * currentSize);
int myindex = 0;
for (int j = 0; j < temp.size(); j++) {
//每个元素循环的总次数
for (int k = 0; k < loopPerItem; k++) {
if (myindex == temp.size())
myindex = 0;
//每个元素每次循环打印个数
for (int m = 0; m < itemLoopNum; m++) {
mysesult[index] = (mysesult[index] == null ? "" : mysesult[index] + ",").trim() + ((String) temp.get(myindex)).trim();
index++;
}
myindex++;
}
}
}
return Arrays.asList(mysesult);
}
}
package makeTestCase;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.offcn.TestUnti.SheetUtils;
import net.sf.json.JSONObject;
public class MakeTestCases {
public static int state=0;//代表有其他页面没有,0标示没有,1表示有一个,2表示有两个
public static List<String> SheetList=new ArrayList<String>();//sheet页面的名称,里面存的是sheet2,sheet3之类的sheet页名称
public static List<String> nameList=new ArrayList<String>();//包含sheet页面对应的字段名称
public static List<String> List_1=new ArrayList<String>();//List_1
public static List<String> List_4=new ArrayList<String>();//List_4
public static List<String> List_5=new ArrayList<String>();//List_5
public static List<List<String>> list_all=new ArrayList<List<String>>();//缺失字段,最后判断是否应该算正向还是反向
public static void main(String[] args) {
make("TestData/CaseMake.xls","Sheet1");
}
public static void make(String FilePath,String SheetName){
//获取用例
List<String> listSum=TestCase(FilePath,SheetName);
Set<String> set=new HashSet<String>();
set.addAll(listSum);
listSum.clear();
listSum.addAll(set);
for (String string : listSum) {
System.out.println(string);
}
List<String> TeseName= TestCaseName(listSum);
// System.out.println("用例数"+listSum.size());
// System.out.println("用例名字数"+TeseName.size());
//获取接口全信息
String AllPath="";
try {
AllPath=new readExcels().readExcels_path(FilePath,SheetName);
} catch (Exception e) {
e.printStackTrace();
}
String[] apipath=AllPath.split("/");
//获取接口类名
String leiming=apipath[apipath.length-1];
//获取接口路径
int w=AllPath.indexOf("/");
String path=AllPath.substring(w);
String name=FilePath.split("/")[1];
//获取接口名
String jieKouMing=apipath[0];
//生成测试用例
for(int i=0;i<listSum.size();i++){
outCase(i,leiming,jieKouMing,TeseName.get(i),path,listSum.get(i),name,"OutPage");
}
}
//第一个参数是数量,第二个参数是接口类名,第三个参数是中文名
public static void outCase(int i,String leiming,String jieKouMing,String TeseName,String path,String cases,String wenjianming,String Sheet){
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String s = sdf.format(d);
//数据回写
SheetUtils sheet = new SheetUtils(wenjianming,Sheet);
sheet.writeExcel(
// s,
(i+1)+"",
leiming + "_" + (i+1),
(i+1)+"",
jieKouMing+"-"+TeseName,
"xyzb",
path,
"N",
"post",
"200",
cases
);
}
//所有测试集合的用例名称
public static List<String> TestCaseName(List<String> list){
//所有测试集合的用例名称
List<String> listt=new ArrayList<String>();
List<String> list1_4=zhengxiang(List_1,List_4);
List<String> list1_5=zhengxiang(List_1,List_5);
//先把测试用例遍历
for (int i=0;i<list.size();i++) {
String name="";
// System.out.println("用例名称:"+listt.toString());
// System.out.println();
// System.out.println("测试用例:"+list.get(i));
// System.out.println("字段:"+List_1.toString());
// System.out.println("反向:"+list1_5.toString());
//每一条测试用例
//查看是否缺少字段
List<String> list_true=zhengxiang(list.get(i));
name=baohan(List_1,list_true);
if(!"未缺失".equals(name)){
listt.add(name);
continue;
}
name=list1_5(list1_5,list.get(i));
if(!"正向用例".equals(name)){
listt.add(name);
continue;
}
name=list1_4(list1_4,list.get(i));
listt.add(name);
}
return listt;
}
//获取正向所有精确字段
public static List<String> zhengxiang(String stra){
//预返回的集合
List<String> listt=new ArrayList<String>();
//循环获取到每一个字段的正确集合
String ziduan []=stra.split(",");
String zuo="";
for(int i=0;i<ziduan.length;i++){
zuo=ziduan[i];
String zhong []=zuo.split(":");
// 获取到每一个字段的正确中的一个2,3,4,5,6,
if(zhong[0]!=null && zhong[0].length()>2){
String a1=zhong[0].substring(1,zhong[0].length()-1);
listt.add(a1);
}
}
return listt;
}
//两个集合:list——1,list——4拼接成正向集合
public static List<String> zhengxiang(List<String> list_1,List<String> list_4){
//预返回的集合
List<String> listt=new ArrayList<String>();
String str="";
//循环获取到每一个字段的正确集合
for(int i=0;i<list_1.size();i++){
// 获取到每一个字段的正确中的一个2,3,4,5,6,
String zhengxiangfenjie []=list_4.get(i).split(",");
for(int j=0;j<zhengxiangfenjie.length;j++){
str="\""+list_1.get(i)+"\":"+zhengxiangfenjie[j];
listt.add(str);
}
}
return listt;
}
//用例中是否包含list——5中的信息,如果包含返回"反向用例-XXX"
public static String list1_5(List<String> list1_5,String str){
String queshideziduan="";
for(int i=0;i<list1_5.size();i++){
if(str.contains(list1_5.get(i))){
queshideziduan=list1_5.get(i);
}
}
if("".equals(queshideziduan)){
return "正向用例";
}else{
return "反向用例-"+queshideziduan;
}
}
//用例中是否包含list——4中的信息,如果包含返回"正向用例"
public static String list1_4(List<String> list1_4,String str){
String fenjie[] =str.split(",");
//测试用例集合
List<String> listSum=new ArrayList<String>();
for(int i=0;i<fenjie.length;i++){
listSum.add(fenjie[i]);
}
listSum.removeAll(list1_4);
// System.out.println(listSum.toString());
if(listSum.isEmpty()){
return "正向用例";
}else{
return "反向用例-"+listSum.toString();
}
}
//用例中是否包含list——1中的信息,如果没有返回XXXX字段缺失
public static String baohan(List<String> list_1,List<String> list_true){
//测试用例集合
List<String> listSum=new ArrayList<String>();
listSum.addAll(list_1);
String queshideziduan="";
// System.out.println(listSum.size());
// System.out.println(list_true.size());list_all
if(listSum.size()!=list_true.size()){
listSum.removeAll(list_true);
queshideziduan=listSum.toString();
}
if("".equals(queshideziduan)){
return "未缺失";
}else{
queshideziduan=queshideziduan.substring(1, queshideziduan.length()-1);
for(int i=0;i<list_all.size();i++){
String NorY=list_all.get(i).toString();
// System.out.println(NorY);
// System.out.println((", "+queshideziduan+","));
// System.out.println(NorY.contains(", "+queshideziduan+","));
// System.out.println(NorY.contains(", N,"));
if(NorY.contains(", "+queshideziduan+",") && NorY.contains(", N,")){
return "正向用例-"+queshideziduan+"非必输项缺失";
}
}
return "反向用例-"+queshideziduan+"缺失";
}
}
public static List<String> TestCase(String path,String Sheet){
//测试用例集合
List<String> listSum=new ArrayList<String>();
readExcels readExcels= new readExcels();
List<List<String>> list=null;
try {
list=readExcels.readExcels_return(path,Sheet);
list_all.addAll(list);
} catch (Exception e) {
e.printStackTrace();
}
List<Set<String>> listt=new ArrayList<Set<String>>();
List<Set<String>> listf=new ArrayList<Set<String>>();
for (int i=0;i<list.size();i++) {
List<String> li=list.get(i);
Set<String> sett=new HashSet<String>();
Set<String> setf=new HashSet<String>();
String name="";
Object [] objt=null;
Object [] objf=null;
for (int j=0;j<li.size();j++) {
if(j==1){
name=li.get(j).trim();
List_1.add(name);
}
if(j==4){
// if("N".equals(li.get(j-1).trim())){
// String str=(li.get(j).trim()+",null");
// objt=str.split(",");
// List_4.add(li.get(j).trim());
// List_4.add(null);
// }else{
objt=li.get(j).trim().split(",");
List_4.add(li.get(j).trim());
// }
}
if(j==5){
String s="";
if("".equals(li.get(j).trim()) || li.get(j).trim()==null){
s=""+li.get(2).trim()+","+li.get(3).trim();
List_5.add(s);
}else{
s=""+li.get(j).trim()+","+li.get(2).trim()+","+li.get(3).trim();
List_5.add(s);
}
objf=s.split(",");
}
}
sett=getObject(name,objt,objt[0]+"");
setf=getObject(name,objf,objt[0]+"");
listt.add(sett);
listf.add(setf);
}
// System.out.println("正向用例"+listt.toString());
// System.out.println("反向用例"+listf.toString());
//如果random_String.state不等于0说明存在其他sheet页面,如果是2就说明有其他两个sheet页
// System.out.println(state);
// System.out.println(SheetList);
// System.out.println(nameList);
for(int i=0;i<MakeTestCases.state;i++){
List<Set<String>> a=TestCase_N("TestData/CaseMake.xls",SheetList.get(i),nameList.get(i));
listt.add(a.get(0));
listf.add(a.get(1));
}
SheetList.clear();
nameList.clear();
// System.out.println(listt);
// System.out.println(listf);
//产生正向的用例
Set<String> sum1=getZReslut(listt);
Iterator it1 = sum1.iterator();
String yongli="";
while(it1.hasNext()){
// System.out.println(qudouhao(it1.next()+""));
yongli=(qudouhao(it1.next()+""));
yongli=yongli.replace("~", ",");//将用例所有的波浪线替换回来,替换成逗号
listSum.add(yongli);
}
//产生反向的用例,第一个参数是正确的参数集合支取一个,第二个参数集合是错误的集合
for(int i=0;i<listf.size();i++){
Set<String> sum2=getFReslut(sum1,listf.get(i));
// System.out.println("sum2="+sum2);
Iterator it2 = sum2.iterator();
while(it2.hasNext()){
// System.out.println(qudouhao(it2.next()+""));
String ssss=(String) it2.next();
// System.out.println(ssss);
yongli=qudouhao(ssss+"");
yongli=yongli.replace("~", ",");//将用例所有的波浪线替换回来,替换成逗号
// System.out.println("yongli="+yongli);
listSum.add(yongli);
// System.out.println("listSum="+listSum);
}
}
// System.out.println(listSum.toString());
return listSum;
}
public static List<Set<String>> TestCase_N(String path,String Sheet,String ziduanname){
//测试用例集合
List<Set<String>> listSum=new ArrayList<Set<String>>();
readExcels readExcels= new readExcels();
List<List<String>> list=null;
try {
list=readExcels.readExcels_return(path,Sheet);
} catch (Exception e) {
e.printStackTrace();
}
List<Set<String>> listt=new ArrayList<Set<String>>();
List<Set<String>> listf=new ArrayList<Set<String>>();
for (int i=0;i<list.size();i++) {
List<String> li=list.get(i);
Set<String> sett=new HashSet<String>();
Set<String> setf=new HashSet<String>();
String name="";
Object [] objt=null;
Object [] objf=null;
for (int j=0;j<li.size();j++) {
if(j==1){
name=li.get(j).trim();
}
if(j==4){
objt=li.get(j).trim().split(",");
}
if(j==5){
String s="";
if("".equals(li.get(j).trim()) || li.get(j).trim()==null){
s=""+li.get(2).trim()+","+li.get(3).trim();
}else{
s=""+li.get(j).trim()+","+li.get(2).trim()+","+li.get(3).trim();
}
objf=s.split(",");
}
// System.out.println(objf.toString());
}
sett=getObject(name,objt,objt[0]+"");
setf=getObject(name,objf,objt[0]+"");
listt.add(sett);
listf.add(setf);
}
System.out.println("正向用例"+listt.toString());
System.out.println("反向用例"+listf.toString());
//正确和错误的集合
Set<String> set_n_t=new HashSet<String>();
Set<String> set_n_f=new HashSet<String>();
//产生正向的用例
Set<String> sum1=getZReslut(listt);
Iterator it1 = sum1.iterator();
String linshiyongli="";
while(it1.hasNext()){
// System.out.println(qudouhao(it1.next()+""));
linshiyongli=qudouhao(it1.next()+"");
linshiyongli=linshiyongli.replace(",", "~");
set_n_t.add("\""+ziduanname+"\""+":{"+linshiyongli+"}");
}
//产生反向的用例,第一个参数是正确的参数集合支取一个,第二个参数集合是错误的集合
for(int i=0;i<listf.size();i++){
Set<String> sum2=getFReslut(sum1,listf.get(i));
Iterator it2 = sum2.iterator();
while(it2.hasNext()){
// System.out.println(qudouhao(it2.next()+""));
linshiyongli=qudouhao(it2.next()+"");
linshiyongli=linshiyongli.replace(",", "~");
set_n_f.add("\""+ziduanname+"\""+":{"+linshiyongli+"}");
}
}
listSum.add(set_n_t);
listSum.add(set_n_f);
return listSum;
}
//去掉逗号
public static String qudouhao(String str){
str=str.trim();
if(str.length()>0 && str.charAt(0)==','){
str=str.substring(1);
}else if(str.length()>0 && str.charAt(str.length()-1)==','){
str=str.substring(0,str.length()-1);
}
return str;
}
//生成正确的用例
public static Set<String> getZReslut(List<Set<String>> list){
String str="";
for(int i=0;i<list.size();i++){
String str1="";
Object[] obj=setjihe(list.get(i));
str1=Arrays.toString(obj).trim();
str=str+str1.substring(1, str1.length()-1)+"==".trim();
}
str=str.substring(0, str.length()-2);
Set<String> result = HelloHongShu.getSet(str);
return result;
}
public static Object[] setjihe(Set<String> set){
Object[] obj=set.toArray();
return obj;
}
//生成错误的用例
public static Set<String> getFReslut(Set<String> set1,Set<String> set2){
Set<String> set=new HashSet<String>();
Object[] obj1=set1.toArray();
Object[] obj2=set2.toArray();
//获取正确用例的其中一个
String zhengque=obj1[0]+"";
String linshi="";
String cuowulinshi="";
Object [] zhengque1=zhengque.split(",");
StringBuffer sb=new StringBuffer();
for(int i=0;i<zhengque1.length;i++){
sb.append(zhengque1[i]);
sb.append(",");
}
String jihe=sb.toString().substring(0,sb.toString().length()-1);
// System.out.println(jihe);
//用正确的用例为模板,找到与错误部分相同的一节内容进行替换操作
for(int i=0;i<zhengque1.length;i++){
// System.out.println(11111111);
// for(int j=0;j<obj2.length;j++){
for(int j=(obj2.length-1);j>=0;j--){
//错误用例中分号前面的那段信息
String cuowu=obj2[j]+"";
cuowulinshi=cuowu.trim();
cuowu=(cuowu.split(":")[0]).trim();
linshi=(zhengque1[i]+"").trim();
if(!linshi.contains(cuowu)){
break;
}
zhengque=jihe;
// System.out.println("被替代前="+zhengque);
// System.out.println("被替代内容="+linshi);
// System.out.println("替代为="+cuowulinshi);
zhengque=zhengque.replace(linshi, cuowulinshi);
zhengque=quchongfudouhao(zhengque);
set.add(zhengque);
// System.out.println("被替代后="+zhengque);
// System.out.println("set="+set);
}
}
return set;
}
public static String quchongfudouhao(String str){
return str.replace(",,", ",");
}
//第一个参数是变量名,第二个参数是参数集合,第三个参数是正的需要被类型转换的参数
public static Set<String> getObject(String name , Object[] obj,String s){
// Object w1[]=new Object[obj.length];
Set<String> set=new HashSet<String>();
String linshi="";
for(int j=0;j<obj.length;j++){
if(obj[j]==null || "code".equals(obj[j])){
linshi="\""+name+"\""+":"+obj[j];
}else if("Y".equals(obj[j])){
linshi="";
}else if("N".equals(obj[j])){
linshi="";
// continue;
}else if("String".equals(obj[j])){
Long w=StringToInt(s);
// System.out.println("w="+w);
if(w!=0){
linshi="\""+name+"\""+":"+w;
}else{
linshi="\""+name+"\""+":"+0;//字符串转换成int类型失败后,将字符串变为0
// System.out.println(linshi);
}
}else if("int".equals(obj[j])){
linshi="\""+name+"\""+":"+"\""+s+"\"";
}else{
linshi="\""+name+"\""+":"+""+obj[j]+"";
}
// System.out.println(linshi);
set.add(linshi);
// System.out.println(set);
}
return set;
}
public static Long StringToInt(String str){
Long a=0L;
try {
a=Long.parseLong(str);
} catch (Exception e) {
// System.out.println("转换异常");
}
return a;
}
}
package makeTestCase;
import java.io.File;
import java.io.FileInputStream;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
public class readExcels {
public static void main(String[] args) {
readExcels readExcels= new readExcels();
List<List<String>> list=null;
try {
list=readExcels.readExcels_return("TestData/abc.xls","Sheet1");
// String s=readExcels.readExcels_path("d:/abc.xls","Sheet1");
// System.out.println(s);
} catch (Exception e) {
e.printStackTrace();
}
//显示读取的数据
for (List<String> list2 : list) {
for (String string : list2) {
System.out.print(string+" ");
}
System.out.println();
}
}
//获取用例数据
@SuppressWarnings({ "unused", "resource"})
public List<List<String>> readExcels_return(String path,String Sheet) throws Exception{
String targetFile = path;
FileInputStream fis = new FileInputStream(new File(targetFile));
Workbook wb = WorkbookFactory.create(new File(targetFile));
Sheet sheet = wb.getSheet(Sheet);
List<List<String>> listTestData = new ArrayList<List<String>>();
List<String> listData =null;
//反射测试数据对象内容到Object
for(int i = 2 ; i < sheet.getPhysicalNumberOfRows() ; i++){
Row r = sheet.getRow(i);
listData = new ArrayList<String>();
// System.out.println("列="+r.getPhysicalNumberOfCells());
for (int j = 0; j < r.getPhysicalNumberOfCells(); j++) {
Cell cell = r.getCell(j);
String brandName = this.getCellValue(cell);
if(brandName.indexOf("Sheet")!=-1){//如果在文件里找到了包含Sheet的字段就不存储这一行数据
MakeTestCases.SheetList.add(brandName);//记录那个sheet页面
MakeTestCases.nameList.add(this.getCellValue(r.getCell(1)));//保存包含sheet页面的字段名称
++MakeTestCases.state; //状态执为true,代表还需要循环读取其他sheet页面
listData.clear(); //清理这一行数据的存储
break;
}
listData.add(brandName);
}
if(!listData.isEmpty()){
// System.out.println("非空才存");
listTestData.add(listData);
}
// System.out.println(listTestData.toString());
}
// System.out.println("readExcel结束未见异常");
return listTestData;
}
//获取接口地址
@SuppressWarnings({ "unused", "resource"})
public String readExcels_path(String path,String Sheet) throws Exception{
String targetFile = path;
FileInputStream fis = new FileInputStream(new File(targetFile));
Workbook wb = WorkbookFactory.create(new File(targetFile));
Sheet sheet = wb.getSheet(Sheet);
String brandName ="";
//反射测试数据对象内容到Object
for(int i = 0 ; i < 1 ; i++){
Row r = sheet.getRow(i);
for (int j = 0; j < 1; j++) {
Cell cell = r.getCell(j);
brandName = this.getCellValue(cell);
}
}
return brandName;
}
private String getCellValue(Cell cell){
int cellType = cell.getCellType();
String value = "";
if(cellType == Cell.CELL_TYPE_STRING){
value = cell.getStringCellValue();
}else if(cellType == Cell.CELL_TYPE_NUMERIC){
value = String.valueOf(cell.getNumericCellValue());
}else if(cellType == Cell.CELL_TYPE_BOOLEAN){
value = String.valueOf(cell.getBooleanCellValue());
}else if(cellType == Cell.CELL_TYPE_BLANK){
value = "";
}else if(cellType == Cell.CELL_TYPE_FORMULA){
value = String.valueOf(cell.getCellFormula());
}else{
value = "";
}
return value;
}
}
xyzb=com.offcn.api.xyzb.
tk=com.offcn.api.tk.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<customers>
<customer active="false">
<xml_name>王炎炎</xml_name>
<xml_idNo>130426199201270329</xml_idNo>
<xml_bankNo>6227000210250635768</xml_bankNo>
<xml_phone>18230065651</xml_phone>
</customer>
<customer active="true">
<xml_name>王炎炎</xml_name>
<xml_idNo>130426199201270329</xml_idNo>
<xml_bankNo>6227000210250635768</xml_bankNo>
<xml_phone>18230065651</xml_phone>
</customer>
</customers>
\ No newline at end of file
/user/register=register
/userInfo/bank/save=bank_save
/userInfo/bank/update=bank_update
/userInfo/bank/change=bank_change
/userInfo/personal/update=companyinfo
/userInfo/practitioner/update=WorkerAndStudent
/userInfo/contacts/save=contactsinfo_save
/userInfo/contacts=userInfoContacts
/v1/customer/photo/upload=photo_upload
/photo/list/=list
/v1/third/getMoxieH5Url=getMoxieH5Url_app
/v1/customer/identification=identification
/v1/customer/modifyWorkerInfo=modifyWorkerInfo
/v1/customer/modifyStudentInfo=modifyStudentInfo
/v1/customer/canModify=canModify
/v1/customer/isIdentified=isIdentified
/v1/customer/queryInfo=queryInfo
/v1/customer/schoolOptions=schoolOptions
/user/resetPwd=resetPwd
/sms/resetPwd=getResetPwd
/contract/template=template
/v1/sms/login=smsLogin
/user/exchange=exchange
/v1/grab/location=location
/v1/order/confirm=orderConfirm
/v1/order/cancel=cancelOrder
/v1/bill/list=billList
/v1/bankcard/check=check
/v1/bill/detail=billDetail
/v1/bankcard/getBankcard=getBankcard
/v1/customer/licenses=licenses
/v1/merchant=merchant
/v1/order=order
/v1/order/submit=submit
/city/support=CitySupport
/user/send/code/login=SendCodeLogin
/user/login=login
/userInfo/personal=Personal
/user/twoSubmit=TwoSubmit
/userInfo/identity/save=IdentitySaveAndUpdate
/userInfo/identity/update=IdentitySaveAndUpdate
/buy/save=Save
/userInfo/identity=Identity
/userInfo/identity/upload=IdentityUpload
/userInfo/contacts=Contacts
/v1/grab/contacts=contacts
/order/list=OrderList
/order/status/confirm=Confirm
/order/status/cancel=OrderCancel
/order/success=OrderSuccess
/order/detail=OrderDetails
/order/contract=Contract
/order/pwd/isExist=PasswordExistance
/user/send/code/setDeal=SetDeal
/user/mobileCodeConfirm/setDeal=MobileCodeConfirm
/userCenter/setDealPwd/save=DealPwdSave
/decision/busiagree=BusiAgree
/userCenter/setDealPwd/update=ResetDealPwd
/api/business/hot=Hot
/api/business/detail=BusinessDetail
/user/getContacts=GetContacts
/user/getCurCity=GetCurCity
/api/business/getShareContent=GetShareContent
/api/business/detail/pic=BusinessDetailPic
/user/getLocation=GetLocation
/user/register/sms=RegisterSms
/user/exist=UserIfExist
/oauth/v1/receive/data/rental=DataRental
/v1/order/create=CreateOrder
/v1/procedure/list=ProcedureList
/v1/order/queryInfo=orderQreryInfo
/v1/channel/queryConfig=queryConfig
/oauth/v1/receive/data/rental=rental
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<systems>
<system name="xyzb"><!-- 小雨直播 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://live.offcncloud.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://192.168.10.222:3306/xyu?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull</sqlurl>
<sqlname>root</sqlname>
<sqlpwd>offcn.com</sqlpwd>
</system>
<system name="xyzbxs"><!-- 小雨直播 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://live.offcncloud.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://59.110.207.90:3306/xyu</sqlurl>
<sqlname>master</sqlname>
<sqlpwd>EDCdd22LLZBCADF123</sqlpwd>
</system>
</systems>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<systems>
<system name="gmysx"><!-- 更美预授信 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://t1.zuul.pub.puhuifinance.com</RM_URI>
<RM_port>80</RM_port>
<RM_basePath>/bestbuy-pclacceptance/api</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/huimai_safe?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="gmdd"><!-- 更美订单 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://t1.zuul.pub.puhuifinance.com</RM_URI>
<RM_port>80</RM_port>
<RM_basePath>/bestbuy-pclacceptance/api</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/huimai_safe?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="rgxs"><!-- 人工信审 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://ut1.zuul.pub.puhuifinance.com</RM_URI>
<RM_port>8765</RM_port>
<RM_basePath>/bestbuy-pclacceptance/api</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/streaming?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="bl"><!-- 保理系统 -->
<access_token_uri>http://t.uaa.pub.puhuifinance.com:8082/uaa/oauth/token</access_token_uri>
<client_id>factoring-server</client_id>
<client_secret>factoring-server</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://10.10.121.184</RM_URI>
<RM_port>8888</RM_port>
<RM_basePath>/baoli</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/streaming?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="zy"><!-- 自营订单 -->
<!--<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>-->
<!--<client_id>bestbuy-acceptance</client_id>-->
<!--<client_secret>bestbuy-acceptance</client_secret>-->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>gengmei</client_id>
<client_secret>gengmei</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://10.10.155.181</RM_URI>
<RM_port>3000</RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/huimai_safe?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
<system name="sh"><!-- 商户微信 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>gengmei</client_id>
<client_secret>gengmei</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://t1.zuul.pub.puhuifinance.com</RM_URI>
<RM_port>80</RM_port>
<RM_basePath>/bestbuy-pclacceptance/api</RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://10.10.231.135:3306/huimai_safe?user=root&amp;password=OYLDASuPfbpsEQB6&amp;useUnicode=true&amp;characterEncoding=UTF8</sqlurl>
</system>
</systems>
\ No newline at end of file
package test;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
public class CanshuTiQu {
public static void main(String[] args) {
String str="\"phone\":\"13910960649\",\"thirdSource\":\"GM\",\"thirdSourceId\":\"ys\",\"verifyCode\":code_own\"";
String a=getAll(str,"verifyCode");
System.out.println("a="+a);
}
// 在parameter中查看,是否有(第二个参数)verifyCode的关键字,有的话返回他的字母值
public static String getAll(String parameter, String Letter) {
String[] strcomma = parameter.split(",");
int comma = strcomma.length;
StringBuffer sb = new StringBuffer();
for (int k = 0; k < comma; k++) {
// 此时是多个,,,
String[] str = strcomma[k].split(":");
String str_strcomma = Arrays.toString(str);
// System.out.println("str="+Arrays.toString(str));
// 按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
// 在找到后的位置开始查找数字,最后把数字的字符串返回
if (str_strcomma.contains(Letter)) {
int start = str_strcomma.indexOf(',');
sb.append(str_strcomma.substring(start + 2,
str_strcomma.length() - 1));
}
}
return sb.toString();
}
}
package test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Date;
public class HttpRequest implements Runnable{
private String url;
private String param;
public HttpRequest(String url, String param) {
this.url = url;
this.param = param;
}
public static void main(String[] args) {
HttpRequest hr=new HttpRequest("http://106.75.3.8:8765/bestbuy-pclacceptance/api/pcl/user/worker/workerinfo",
"{\"openId\":\"b386bbc0fe3d412bb87d09d356e094df\",\"name\":\"张莉梅\",\"idNo\":\"532901199203200929\",\"idCardUp\":\"http://idcard.private.gmei.com/installment/2017/02/17/1825/68e2aead6a50?e=1487329005&token=UPCOYIJkZOMcdd9FDzpBqYjzWUh55fBpVi3AhWpL:L-ieyDwgUL5r2-Udxelzqmdbt8k=\",\"idCardDown\":\"http://idcard.private.gmei.com/installment/2017/02/17/1825/2a72c27a8a5a?e=1487329005&token=UPCOYIJkZOMcdd9FDzpBqYjzWUh55fBpVi3AhWpL:X5fUiLJ1xfQfdh9N_hi98WPQ0QU=\",\"idCardHand\":\"http://idcard.private.gmei.com/installment/2017/02/17/1825/16af787a51ce?e=1487329005&token=UPCOYIJkZOMcdd9FDzpBqYjzWUh55fBpVi3AhWpL:gtC8Hy0qSmfZvVeIo19snCkhNww=\",\"bankName\":\"中国建设银行\",\"bankCode\":\"105\",\"bankNo\":\"6217001210066384668\",\"bankPhone\":\"13818170218\",\"education\":6,\"marriage\":0,\"children\":0,\"house\":0,\"addr\":\"鹿城区下吕浦凤凰组团1栋605\",\"qq\":\"639201513\",\"email\":\"639201513@qq.com\",\"province\":330000,\"city\":330300,\"list\":[{\"name\":\"阿邦\",\"phone\":\"136-8170-0738\"},{\"name\":\"阿宾\",\"phone\":\"137-6111-1323\"},{\"name\":\"阿葱\",\"phone\":\"13587681288\"},{\"name\":\"阿德 铜川路\",\"phone\":\"152-1668-8693\"},{\"name\":\"阿东\",\"phone\":\"13816716678\"},{\"name\":\"阿疯\",\"phone\":\"138-5772-9711\"},{\"name\":\"阿峰\",\"phone\":\"0577-56962318\"},{\"name\":\"阿峰\",\"phone\":\"138-1699-9515\"},{\"name\":\"阿贵88酒吧\",\"phone\":\"135-8571-3808\"},{\"name\":\"阿姐\",\"phone\":\"158-1219-5571\"},{\"name\":\"阿姐\",\"phone\":\"65121\"},{\"name\":\"阿康鱼圆\",\"phone\":\"88571118\"},{\"name\":\"阿力\",\"phone\":\"+86 187-2510-8242\"},{\"name\":\"阿亮\",\"phone\":\"151-9881-1117\"},{\"name\":\"阿亮\",\"phone\":\"13661781998\"},{\"name\":\"阿廖叔\",\"phone\":\"13577242788\"},{\"name\":\"阿洛\",\"phone\":\"13162004667\"},{\"name\":\"阿茂\",\"phone\":\"135-8753-3776\"},{\"name\":\"阿三\",\"phone\":\"15858838855\"},{\"name\":\"阿三\",\"phone\":\"136-7155-5576\"},{\"name\":\"阿三\",\"phone\":\"131-2081-1888\"},{\"name\":\"阿四 \",\"phone\":\"138-6267-5713\"},{\"name\":\"阿四\",\"phone\":\"13862675713\"},{\"name\":\"阿呀\",\"phone\":\"139-8874-1282\"},{\"name\":\"阿呀\",\"phone\":\"186-0887-8098\"},{\"name\":\"阿姨\",\"phone\":\"13611877396\"},{\"name\":\"阿英\",\"phone\":\"135-7722-0957\"},{\"name\":\"阿K\",\"phone\":\"138-1887-0383\"},{\"name\":\"啊良\",\"phone\":\"13636522226\"},{\"name\":\"啊水\",\"phone\":\"135-2410-2906\"},{\"name\":\"艾斯亮\",\"phone\":\"138-4487-0000\"},{\"name\":\"艾斯亮。\",\"phone\":\"186-0047-7777\"},{\"name\":\"艾远建\",\"phone\":\"182-8155-6673\"},{\"name\":\"爱慕\",\"phone\":\"137-7779-7506\"},{\"name\":\"爱游易、木了网\",\"phone\":\"0311-67596031\"},{\"name\":\"安臣\",\"phone\":\"180-1935-3900\"},{\"name\":\"安途网www.myantu.net\",\"phone\":\"400-000-1030\"},{\"name\":\"按摩师\",\"phone\":\"135-6486-4069\"},{\"name\":\"敖雨\",\"phone\":\"136-6431-6111\"},{\"name\":\"A吧\",\"phone\":\"183-7578-3803\"},{\"name\":\"Andy\",\"phone\":\"139-1689-5568\"},{\"name\":\"Anna EJ\",\"phone\":\"138-7929-0805\"},{\"name\":\"爸\",\"phone\":\"+8618787252844\"},{\"name\":\"白洪武\",\"phone\":\"15921307676\"},{\"name\":\"白停停\",\"phone\":\"13585678877\"},{\"name\":\"白队消防\",\"phone\":\"139-8856-9888\"},{\"name\":\"白静\",\"phone\":\"155-0105-6820\"},{\"name\":\"白味人家\",\"phone\":\"158-8738-1647\"},{\"name\":\"白熊生啤\",\"phone\":\"15901627346\"},{\"name\":\"白云彬\",\"phone\":\"135-0882-0276\"},{\"name\":\"百酷陈琦\",\"phone\":\"153-0571-9575\"},{\"name\":\"百酷网\",\"phone\":\"0571-87758495\"},{\"name\":\"百酷翁鸣\",\"phone\":\"0571-89938109\"},{\"name\":\"百世汇通\",\"phone\":\"132-4834-2629\"},{\"name\":\"百世汇通 长春\",\"phone\":\"0431-80851287\"},{\"name\":\"包场\",\"phone\":\"188-1736-5799\"},{\"name\":\"包房16人。张女士\",\"phone\":\"156-1852-6026\"},{\"name\":\"包艳昆明\",\"phone\":\"137-5942-8874\"},{\"name\":\"宝宝\",\"phone\":\"135-3523-1705\"},{\"name\":\"宝洁赵大姐\",\"phone\":\"183-0172-2961\"},{\"name\":\"保洁23\",\"phone\":\"138-1610-1444\"},{\"name\":\"保洁李大姐\",\"phone\":\"150-2654-8831\"},{\"name\":\"保洁石爱萍\",\"phone\":\"150-2132-1563\"},{\"name\":\"保洁周大姐\",\"phone\":\"158-0049-0019\"},{\"name\":\"保罗立佳小季\",\"phone\":\"137-6486-3592\"},{\"name\":\"报考\",\"phone\":\"18143105606\"},{\"name\":\"豹\",\"phone\":\"13758807878\"},{\"name\":\"北京订房\",\"phone\":\"139-1062-1032\"},{\"name\":\"蓓蓓\",\"phone\":\"134-7288-3250\"},{\"name\":\"扁头明\",\"phone\":\"13567799957\"},{\"name\":\"扁头忠\",\"phone\":\"13505775528\"},{\"name\":\"表妹\",\"phone\":\"159-4871-0600\"},{\"name\":\"宾客网\",\"phone\":\"021-60806285\"},{\"name\":\"宾客网\",\"phone\":\"028-65118202\"},{\"name\":\"宾客网小周\",\"phone\":\"028-65118201\"},{\"name\":\"彬\",\"phone\":\"150-0176-2155\"},{\"name\":\"缤客、终\",\"phone\":\"028-62942200\"},{\"name\":\"兵哥。纠纠\",\"phone\":\"189-5801-0776\"},{\"name\":\"不居一格小霞\",\"phone\":\"138-1064-9004\"},{\"name\":\"BB衣服\",\"phone\":\"130-0470-9977\"},{\"name\":\"BM保洁主管\",\"phone\":\"187-2150-3685\"},{\"name\":\"蔡亚婷\",\"phone\":\"136-2079-5118\"},{\"name\":\"蔡支刚\",\"phone\":\"186-0444-5858\"},{\"name\":\"苍??票务,香格里拉丽江\",\"phone\":\"0872-2380980\"},{\"name\":\"曹厨师\",\"phone\":\"183-1428-1383\"},{\"name\":\"曹万云饵丝\",\"phone\":\"183-8726-6505\"},{\"name\":\"曹渔强BM\",\"phone\":\"152-2199-1376\"},{\"name\":\"厕所门口大姐\",\"phone\":\"15843084260\"},{\"name\":\"茶松江\",\"phone\":\"182-8721-5718\"},{\"name\":\"柴昕昕\",\"phone\":\"185-0431-7122\"},{\"name\":\"常莎莎\",\"phone\":\"138-4306-7577\"},{\"name\":\"常缨客人\",\"phone\":\"137-0361-2038\"},{\"name\":\"超市 汽车公寓\",\"phone\":\"138-1772-7118\"},{\"name\":\"超市锦江\",\"phone\":\"0431-87873293\"},{\"name\":\"潮天门房东\",\"phone\":\"138-1841-2422\"},{\"name\":\"炒面\",\"phone\":\"137-6147-2292\"},{\"name\":\"炒面\",\"phone\":\"13482726206\"},{\"name\":\"车\",\"phone\":\"136-7184-1531\"},{\"name\":\"车管,段\",\"phone\":\"139-0872-0582\"},{\"name\":\"车市\",\"phone\":\"136-4166-6240\"},{\"name\":\"车行小裴\",\"phone\":\"13311693313\"},{\"name\":\"陈旭\",\"phone\":\"13957762978\"},{\"name\":\"陈 Wi-Fi\",\"phone\":\"136-5170-7195\"},{\"name\":\"陈贝贝\",\"phone\":\"186-0212-3978\"},{\"name\":\"陈发愿BM仓库\",\"phone\":\"182-0219-6019\"},{\"name\":\"陈(杭州)\",\"phone\":\"136-5719-9999\"},{\"name\":\"陈佳丽\",\"phone\":\"134-5629-2364\"},{\"name\":\"陈监控下关\",\"phone\":\"130-1336-4623\"},{\"name\":\"陈建\",\"phone\":\"135-7729-1972\"},{\"name\":\"陈建欧\",\"phone\":\"158-0219-7960\"},{\"name\":\"陈金良\",\"phone\":\"139-8851-1817\"},{\"name\":\"陈金龙\",\"phone\":\"139-1695-9390\"},{\"name\":\"陈锦辉\",\"phone\":\"133-1278-7308\"},{\"name\":\"陈晶\",\"phone\":\"152-1439-5809\"},{\"name\":\"陈静\",\"phone\":\"158-8733-6562\"},{\"name\":\"陈静\",\"phone\":\"0872-3149471\"},{\"name\":\"陈开周\",\"phone\":\"+8615901722397\"},{\"name\":\"陈昆\",\"phone\":\"138-8830-3120\"},{\"name\":\"陈老乡\",\"phone\":\"139-0289-8424\"},{\"name\":\"陈灵\",\"phone\":\"131-9789-9991\"},{\"name\":\"陈南\",\"phone\":\"137-5667-1105\"},{\"name\":\"陈倩\",\"phone\":\"+8615208910703\"},{\"name\":\"陈世辉\",\"phone\":\"139-0872-6722\"},{\"name\":\"陈伟BM\",\"phone\":\"159-2135-3565\"},{\"name\":\"陈玮梅\",\"phone\":\"151-2513-3412\"},{\"name\":\"陈晓玲网站\",\"phone\":\"135-2992-6101\"},{\"name\":\"陈孝明\",\"phone\":\"+86 189-1121-2861\"},{\"name\":\"陈毅华客人\",\"phone\":\"137-1387-3882\"},{\"name\":\"陈盈\",\"phone\":\"139-1695-0206\"},{\"name\":\"陈雨\",\"phone\":\"184-8752-8578\"},{\"name\":\"陈圆\",\"phone\":\"157-5838-6419\"},{\"name\":\"陈真定8??13-14标准间2间已付\",\"phone\":\"133-6392-6911\"},{\"name\":\"陈子\",\"phone\":\"133-3055-6608\"},{\"name\":\"程\",\"phone\":\"136-2205-2222\"},{\"name\":\"程双\",\"phone\":\"152-2157-4086\"},{\"name\":\"充电q\",\"phone\":\"*3370#\"},{\"name\":\"虫子\",\"phone\":\"132-5999-9092\"},{\"name\":\"出品吧阿楠\",\"phone\":\"187-5575-8753\"},{\"name\":\"厨师长房东\",\"phone\":\"187-1796-6141\"},{\"name\":\"褚处长\",\"phone\":\"138-8729-6166\"},{\"name\":\"川菜\",\"phone\":\"138-1764-8999\"},{\"name\":\"春之声\",\"phone\":\"158-2180-0798\"},{\"name\":\"崔瑞\",\"phone\":\"159-1159-8191\"},{\"name\":\"崔亚磊\",\"phone\":\"131-6717-6778\"},{\"name\":\"存\",\"phone\":\"135-1212-3707\"},{\"name\":\"长春烧烤\",\"phone\":\"13166879987\"},{\"name\":\"长春顺丰\",\"phone\":\"130-1913-5476\"},{\"name\":\"长寿路快客\",\"phone\":\"62987163\"},{\"name\":\"carl\",\"phone\":\"138-1777-1840\"},{\"name\":\"Co\",\"phone\":\"13738727655\"},{\"name\":\"达安快递\",\"phone\":\"18017337810\"},{\"name\":\"大刘\",\"phone\":\"13512195079\"},{\"name\":\"大姨\",\"phone\":\"13917030277\"},{\"name\":\"大奥手机\",\"phone\":\"135-6495-1688\"},{\"name\":\"大厨廖兴渝\",\"phone\":\"135-5202-0209\"},{\"name\":\"大刚\",\"phone\":\"150-4403-5858\"},{\"name\":\"大哥\",\"phone\":\"150-4300-6875\"},{\"name\":\"大理烧烤\",\"phone\":\"13577243838\"},{\"name\":\"大索道\",\"phone\":\"0872-5364980\"},{\"name\":\"大伟\",\"phone\":\"136-4441-7499\"},{\"name\":\"大卫。厨房\",\"phone\":\"187-0210-5337\"},{\"name\":\"大众点评\",\"phone\":\"188-0175-8645\"},{\"name\":\"丹丹\",\"phone\":\"158-6962-5687\"},{\"name\":\"导游\",\"phone\":\"133-3190-3635\"},{\"name\":\"倒骑驴张师父\",\"phone\":\"135-2422-7835\"},{\"name\":\"灯箱小鲁\",\"phone\":\"147-8721-8209\"},{\"name\":\"登喜路定制\",\"phone\":\"139-0657-5767\"},{\"name\":\"电\",\"phone\":\"151241393004\"},{\"name\":\"电费\",\"phone\":\"160-0266-880\"},{\"name\":\"电三向\",\"phone\":\"160-2293-185\"},{\"name\":\"电信\",\"phone\":\"0872-2675556\"},{\"name\":\"电信队长\",\"phone\":\"133-7872-2919\"},{\"name\":\"电赵哥\",\"phone\":\"130-8741-5230\"},{\"name\":\"店长Jerry谢\",\"phone\":\"136-0165-8458\"},{\"name\":\"调音\",\"phone\":\"13636406662\"},{\"name\":\"调酒师\",\"phone\":\"137-0180-6823\"},{\"name\":\"调料周仕亮\",\"phone\":\"136-2177-0998\"},{\"name\":\"丁俊\",\"phone\":\"15288328607\"},{\"name\":\"订机票\",\"phone\":\"021-62149595\"},{\"name\":\"东东\",\"phone\":\"152-2142-5966\"},{\"name\":\"东辉\",\"phone\":\"130-7433-2727\"},{\"name\":\"东盟\",\"phone\":\"158-7777-0995\"},{\"name\":\"东盟、段\",\"phone\":\"182-8725-8321\"},{\"name\":\"东盟玉石城\",\"phone\":\"0872-8866902\"},{\"name\":\"东南水产\",\"phone\":\"13120982722\"},{\"name\":\"董佳惠\",\"phone\":\"139-1707-4679\"},{\"name\":\"董佳曼\",\"phone\":\"156-0160-8153\"},{\"name\":\"董育壮\",\"phone\":\"135-7720-9538\"},{\"name\":\"懂望能地板\",\"phone\":\"130-1344-7085\"},{\"name\":\"杜定团、文献静苑\",\"phone\":\"135-0872-8398\"},{\"name\":\"杜钢窗\",\"phone\":\"130-1339-1048\"},{\"name\":\"杜芊BM\",\"phone\":\"135-6482-7608\"},{\"name\":\"杜永贵\",\"phone\":\"158-8734-4291\"},{\"name\":\"段东\",\"phone\":\"135-7728-3695\"},{\"name\":\"段怀美\",\"phone\":\"138-8393-3834\"},{\"name\":\"段老师\",\"phone\":\"135-7787-9389\"},{\"name\":\"段新兰\",\"phone\":\"131-7069-1328\"},{\"name\":\"段租房、苏秦\",\"phone\":\"139-9637-6388\"},{\"name\":\"对面水果??\",\"phone\":\"13504416121\"},{\"name\":\"d\",\"phone\":\"139-6882-1979\"},{\"name\":\"Dean 李师傅 EJ\",\"phone\":\"15221060910\"},{\"name\":\"Dear~\",\"phone\":\"+8618889996806\"},{\"name\":\"峨眉老乡\",\"phone\":\"189-9062-8302\"},{\"name\":\"洱海秀\",\"phone\":\"135-2964-7505\"},{\"name\":\"饵丝阿弟\",\"phone\":\"182-8724-3451\"},{\"name\":\"二\",\"phone\":\"15858512378\"},{\"name\":\"二姑\",\"phone\":\"155-0447-2525\"},{\"name\":\"二货\",\"phone\":\"159-2121-1998\"},{\"name\":\"二姐\",\"phone\":\"130-5219-1119\"},{\"name\":\"E Club办公室\",\"phone\":\"54355675\"},{\"name\":\"EVa\",\"phone\":\"135-6451-8538\"},{\"name\":\"发姐BM\",\"phone\":\"135-2486-3843\"},{\"name\":\"樊洋洋\",\"phone\":\"137-7061-4563\"},{\"name\":\"方丈。尹健\",\"phone\":\"131-2251-3067\"},{\"name\":\"房东\",\"phone\":\"136-2173-5522\"},{\"name\":\"房东\",\"phone\":\"13524598671\"},{\"name\":\"房东的\",\"phone\":\"130-4660-7528\"},{\"name\":\"房东爹\",\"phone\":\"139-8724-0232\"},{\"name\":\"房东东兴运大厦\",\"phone\":\"+86 189-1811-8751\"},{\"name\":\"房东姐姐\",\"phone\":\"159-5143-7168\"},{\"name\":\"房东娘\",\"phone\":\"139-8720-2455\"},{\"name\":\"房东媳妇花店\",\"phone\":\"139-8726-6373\"},{\"name\":\"飞飞\",\"phone\":\"13641887187\"},{\"name\":\"费秋联\",\"phone\":\"139-8722-8843\"},{\"name\":\"疯丫头\",\"phone\":\"139-4277-6479\"},{\"name\":\"峰\",\"phone\":\"138-1698-5155\"},{\"name\":\"冯媳\",\"phone\":\"159-8760-8260\"},{\"name\":\"伏月芬\",\"phone\":\"182-8826-1900\"},{\"name\":\"服务员仁波\",\"phone\":\"155-0216-5729\"},{\"name\":\"服务员小杰\",\"phone\":\"150-2197-2007\"},{\"name\":\"服务员朱敏\",\"phone\":\"135-0586-4315\"},{\"name\":\"服装潮天门\",\"phone\":\"130-6193-8029\"},{\"name\":\"福林-海鲜\",\"phone\":\"186-0215-6997\"},{\"name\":\"富禾味\",\"phone\":\"021-61800670\"},{\"name\":\"f\",\"phone\":\"150-2124-7352\"},{\"name\":\"感通赵淋\",\"phone\":\"135-7726-4505\"},{\"name\":\"高沙\",\"phone\":\"137-6133-6637\"},{\"name\":\"高主任\",\"phone\":\"137-0177-6868\"},{\"name\":\"高自强\",\"phone\":\"150-7799-0752\"},{\"name\":\"高宗BM\",\"phone\":\"137-6419-9098\"},{\"name\":\"高总!三亚万豪\",\"phone\":\"138-7679-9088\"},{\"name\":\"郜秀杰\",\"phone\":\"138-1852-4152\"},{\"name\":\"戈茹\",\"phone\":\"13905779596\"},{\"name\":\"格格\",\"phone\":\"186-9862-5184\"},{\"name\":\"葛肖英客人\",\"phone\":\"137-0121-5233\"},{\"name\":\"耿亮BM\",\"phone\":\"139-1353-7344\"},{\"name\":\"公新佳\",\"phone\":\"187-4418-0888\"},{\"name\":\"龚三志\",\"phone\":\"131-2250-7889\"},{\"name\":\"龚网站.宾客网\",\"phone\":\"021-60807285\"},{\"name\":\"狗贼\",\"phone\":\"135-0433-8345\"},{\"name\":\"苟林BM\",\"phone\":\"182-0183-9056\"},{\"name\":\"古城派出所\",\"phone\":\"0872-2664398\"},{\"name\":\"古城西门警务室\",\"phone\":\"0872-2156755\"},{\"name\":\"谷嘉诚\",\"phone\":\"13888838369\"},{\"name\":\"顾\",\"phone\":\"15250420584\"},{\"name\":\"顾大姐\",\"phone\":\"181-4976-0627\"},{\"name\":\"顾警官\",\"phone\":\"135-8557-8163\"},{\"name\":\"顾。蟹庄\",\"phone\":\"152-5027-2637\"},{\"name\":\"光头丰\",\"phone\":\"13681616155\"},{\"name\":\"光头眼镜\",\"phone\":\"136-2182-2223\"},{\"name\":\"光泽牛奶\",\"phone\":\"18584315927\"},{\"name\":\"广安小弟导游\",\"phone\":\"186-8262-5931\"},{\"name\":\"广发\",\"phone\":\"139-0249-3435\"},{\"name\":\"广告牌字\",\"phone\":\"138-8726-6769\"},{\"name\":\"郭锋\",\"phone\":\"135-6435-5077\"},{\"name\":\"郭红伟\",\"phone\":\"186-2710-2288\"},{\"name\":\"郭鹏\",\"phone\":\"136-1180-6921\"},{\"name\":\"郭义和\",\"phone\":\"159-2165-4437\"},{\"name\":\"郭K\",\"phone\":\"150-0021-1689\"},{\"name\":\"孩子爷爷\",\"phone\":\"13705777558\"},{\"name\":\"海底捞服务员\",\"phone\":\"137-7802-7549\"},{\"name\":\"海东住房的\",\"phone\":\"187-8724-5897\"},{\"name\":\"海俊\",\"phone\":\"137-6499-6493\"},{\"name\":\"海口奔驰一李\",\"phone\":\"130-1621-1278\"},{\"name\":\"海敏\",\"phone\":\"139-1871-7333\"},{\"name\":\"海燕阿姨\",\"phone\":\"135-2963-3896\"},{\"name\":\"韩冰\",\"phone\":\"186-8676-3595\"},{\"name\":\"韩峰\",\"phone\":\"130-2017-4185\"},{\"name\":\"韩金红\",\"phone\":\"138-8825-9359\"},{\"name\":\"韩面试\",\"phone\":\"131-6280-4739\"},{\"name\":\"韩哲K\",\"phone\":\"131-2119-1443\"},{\"name\":\"翰墨辉\",\"phone\":\"18213033223\"},{\"name\":\"航\",\"phone\":\"13917995166\"},{\"name\":\"郝老爹\",\"phone\":\"135-7876-0455\"},{\"name\":\"何建国\",\"phone\":\"182-8433-2258\"},{\"name\":\"何建国\",\"phone\":\"138-8138-4866\"},{\"name\":\"何琳玉\",\"phone\":\"182-8721-5299\"},{\"name\":\"核弹王境\",\"phone\":\"183-2194-4992\"},{\"name\":\"贺英平\",\"phone\":\"186-6658-1616\"},{\"name\":\"黑的李师\",\"phone\":\"159-1124-7278\"},{\"name\":\"黑的面包阿白弟\",\"phone\":\"138-8720-2970\"},{\"name\":\"黑的面包、赵辉\",\"phone\":\"138-8725-9854\"},{\"name\":\"黑的杨汝林\",\"phone\":\"139-8850-8207\"},{\"name\":\"黑的杨师\",\"phone\":\"159-1262-3500\"},{\"name\":\"黑的张师\",\"phone\":\"139-8729-0213\"},{\"name\":\"黑的张师\",\"phone\":\"139-8729-5735\"},{\"name\":\"黑的张协林\",\"phone\":\"139-8854-2675\"},{\"name\":\"黑的张勋\",\"phone\":\"136-0882-8673\"},{\"name\":\"黑的赵师\",\"phone\":\"139-8853-4265\"},{\"name\":\"黑的赵雄\",\"phone\":\"153-3433-1020\"},{\"name\":\"洪锦涛\",\"phone\":\"139-8724-5690\"},{\"name\":\"洪银\",\"phone\":\"15201906094\"},{\"name\":\"侯飞\",\"phone\":\"138-1739-2421\"},{\"name\":\"后天Aking\",\"phone\":\"0431-85640009\"},{\"name\":\"候明、酒\",\"phone\":\"183-1316-5922\"},{\"name\":\"虎跳峡李悠、饭店\",\"phone\":\"131-1690-3445\"},{\"name\":\"护照\",\"phone\":\"87974610\"},{\"name\":\"花\",\"phone\":\"131-6206-6978\"},{\"name\":\"花店\",\"phone\":\"137-6158-1613\"},{\"name\":\"花花\",\"phone\":\"152-8721-6053\"},{\"name\":\"花梅\",\"phone\":\"13564267006\"},{\"name\":\"华邦高伟\",\"phone\":\"136-3655-1823\"},{\"name\":\"化妆\",\"phone\":\"+86 139-1692-4687\"},{\"name\":\"桦\",\"phone\":\"131-6244-8726\"},{\"name\":\"黄飞\",\"phone\":\"13916313623\"},{\"name\":\"黄风丽江\",\"phone\":\"187-8765-1565\"},{\"name\":\"黄富华BM\",\"phone\":\"138-1674-6575\"},{\"name\":\"黄慧慧\",\"phone\":\"182-1745-9805\"},{\"name\":\"黄娟\",\"phone\":\"136-8774-0722\"},{\"name\":\"黄开普\",\"phone\":\"136-3661-7879\"},{\"name\":\"黄凯国上海\",\"phone\":\"133-1181-7719\"},{\"name\":\"黄猛\",\"phone\":\"13681836845\"},{\"name\":\"黄淼BM\",\"phone\":\"186-2151-5008\"},{\"name\":\"黄世军\",\"phone\":\"153-2866-3909\"},{\"name\":\"黄,网站刷屏\",\"phone\":\"151-7200-6975\"},{\"name\":\"黄伟祥 郑州\",\"phone\":\"188-3823-9938\"},{\"name\":\"黄艳平\",\"phone\":\"139-8721-5386\"},{\"name\":\"卉\",\"phone\":\"+8615204266101\"},{\"name\":\"会计培训\",\"phone\":\"021-63561435\"},{\"name\":\"惠惠BM\",\"phone\":\"139-1600-0522\"},{\"name\":\"火车票古城\",\"phone\":\"0872-5369701\"},{\"name\":\"货车\",\"phone\":\"65376537\"},{\"name\":\"货运\",\"phone\":\"18601610327\"},{\"name\":\"机票\",\"phone\":\"139-0193-5389\"},{\"name\":\"鸡腿\",\"phone\":\"62273931\"},{\"name\":\"鸡足山、刘涛释正济\",\"phone\":\"135-2965-0091\"},{\"name\":\"吉的堡\",\"phone\":\"021-66110632\"},{\"name\":\"吉林广播电视大学\",\"phone\":\"0431-85379273\"},{\"name\":\"吉娜\",\"phone\":\"139-5006-4834\"},{\"name\":\"即招按摩\",\"phone\":\"139-8859-1988\"},{\"name\":\"家\",\"phone\":\"021-56357752\"},{\"name\":\"家\",\"phone\":\"043189613873\"},{\"name\":\"家具\",\"phone\":\"138-8725-1529\"},{\"name\":\"家里\",\"phone\":\"132-6287-1109\"},{\"name\":\"嘉定胖子\",\"phone\":\"13761214661\"},{\"name\":\"嘉华蛋糕\",\"phone\":\"0872-2515240\"},{\"name\":\"监控号\",\"phone\":\"319-046935\"},{\"name\":\"简泽平\",\"phone\":\"139-8855-7500\"},{\"name\":\"建儿\",\"phone\":\"13968811188\"},{\"name\":\"建国\",\"phone\":\"15821488306\"},{\"name\":\"建通一\",\"phone\":\"13989566666\"},{\"name\":\"建校\",\"phone\":\"136-0872-7608\"},{\"name\":\"江律师\",\"phone\":\"69770\"},{\"name\":\"姜\",\"phone\":\"131-2295-3154\"},{\"name\":\"姜建伟\",\"phone\":\"186-2191-8999\"},{\"name\":\"姜姜\",\"phone\":\"138-1887-9805\"},{\"name\":\"姜玲\",\"phone\":\"13888522174\"},{\"name\":\"将闫闫\",\"phone\":\"159-0180-5582\"},{\"name\":\"蒋一鸣\",\"phone\":\"139-1656-5602\"},{\"name\":\"交\",\"phone\":\"0872-2673038\"},{\"name\":\"交电费\",\"phone\":\"160-0261-130\"},{\"name\":\"交警小方\",\"phone\":\"150-9697-0582\"},{\"name\":\"娇娇BM\",\"phone\":\"182-0685-9995\"},{\"name\":\"杰文\",\"phone\":\"18801893011\"},{\"name\":\"姐\",\"phone\":\"138-5775-4596\"},{\"name\":\"金??\",\"phone\":\"156-1810-9099\"},{\"name\":\"金超\",\"phone\":\"188-6778-8055\"},{\"name\":\"金豆豆\",\"phone\":\"156-1810-9099\"},{\"name\":\"金哥\",\"phone\":\"189-0433-5566\"},{\"name\":\"金硅公司\",\"phone\":\"0872-2187969\"},{\"name\":\"金赫龙\",\"phone\":\"138-0432-3443\"},{\"name\":\"金华\",\"phone\":\"139-5777-7580\"},{\"name\":\"金洋\",\"phone\":\"13769121344\"},{\"name\":\"金玉\",\"phone\":\"15618109099\"},{\"name\":\"金卓\",\"phone\":\"18644050003\"},{\"name\":\"金卓\",\"phone\":\"13624004322\"},{\"name\":\"进军司机\",\"phone\":\"13676403313\"},{\"name\":\"晶晶\",\"phone\":\"158-8874-9965\"},{\"name\":\"晶晶\",\"phone\":\"13888835959\"},{\"name\":\"婧\",\"phone\":\"13888013495\"},{\"name\":\"纠纠\",\"phone\":\"131-6622-2998\"},{\"name\":\"玖月\",\"phone\":\"182-5710-1271\"},{\"name\":\"酒\",\"phone\":\"13636499929\"},{\"name\":\"酒商\",\"phone\":\"187-2165-7219\"},{\"name\":\"酒庄王宇\",\"phone\":\"136-0184-8884\"},{\"name\":\"军军BM\",\"phone\":\"139-1666-4858\"},{\"name\":\"Jacky Salsa\",\"phone\":\"138-1770-6951\"},{\"name\":\"Jerry Ma EJ\",\"phone\":\"137-8890-4524\"},{\"name\":\"Jessica\",\"phone\":\"150-0182-2025\"},{\"name\":\"justin\",\"phone\":\"13774366871\"},{\"name\":\"卡西欧\",\"phone\":\"152-1672-4410\"},{\"name\":\"开房\",\"phone\":\"135-7721-1069\"},{\"name\":\"凯文\",\"phone\":\"130-2213-8881\"},{\"name\":\"康\",\"phone\":\"135-7726-5965\"},{\"name\":\"康辉旅\",\"phone\":\"150-9694-0173\"},{\"name\":\"康辉旅\",\"phone\":\"189-8720-2383\"},{\"name\":\"康辉旅\",\"phone\":\"139-8856-9777\"},{\"name\":\"康旅老板\",\"phone\":\"153-3433-1888\"},{\"name\":\"康旅刘师傅计调\",\"phone\":\"187-6096-6018\"},{\"name\":\"康旅张师\",\"phone\":\"130-3862-8881\"},{\"name\":\"科技城长江路电脑\",\"phone\":\"15124303531\"},{\"name\":\"可口可乐\",\"phone\":\"139-1851-5774\"},{\"name\":\"可做宿舍中介\",\"phone\":\"187-2156-3979\"},{\"name\":\"客人对面\",\"phone\":\"186-0738-6776\"},{\"name\":\"客人锅底小凤\",\"phone\":\"139-1683-7991\"},{\"name\":\"客人老外\",\"phone\":\"139-1111-5553\"},{\"name\":\"客人、莫\",\"phone\":\"157-2145-6679\"},{\"name\":\"客运北站\",\"phone\":\"2258724\"},{\"name\":\"肯德基宅急送\",\"phone\":\"4008823823\"},{\"name\":\"空调郑总\",\"phone\":\"180-0888-3555\"},{\"name\":\"孔医生\",\"phone\":\"+8613818525559\"},{\"name\":\"快递\",\"phone\":\"4008111111\"},{\"name\":\"快递\",\"phone\":\"18017337809\"},{\"name\":\"快递静安\",\"phone\":\"02151580557\"},{\"name\":\"快乐租\",\"phone\":\"400-087-8866\"},{\"name\":\"昆明客人\",\"phone\":\"182-1388-1311\"},{\"name\":\"K阿哲\",\"phone\":\"188-1699-0272\"},{\"name\":\"Kevin(m2)\",\"phone\":\"13501673099\"},{\"name\":\"kevn。E\",\"phone\":\"136-6151-0356\"},{\"name\":\"KK\",\"phone\":\"139-0433-4123\"},{\"name\":\"拉面\",\"phone\":\"52130881\"},{\"name\":\"拉手网\",\"phone\":\"010-64398482\"},{\"name\":\"捞皇王总\",\"phone\":\"186-2169-6600\"},{\"name\":\"老白白\",\"phone\":\"13564689898\"},{\"name\":\"老叶\",\"phone\":\"13908872888\"},{\"name\":\"老戴\",\"phone\":\"138-8729-2237\"},{\"name\":\"老范 保安\",\"phone\":\"139-7932-2795\"},{\"name\":\"老姑夫\",\"phone\":\"156-4362-6087\"},{\"name\":\"老海\",\"phone\":\"159-1266-5222\"},{\"name\":\"老虎\",\"phone\":\"189-8724-5219\"},{\"name\":\"老家\",\"phone\":\"0833-5577105\"},{\"name\":\"老妈\",\"phone\":\"18213370826\"},{\"name\":\"老母\",\"phone\":\"158-7778-2446\"},{\"name\":\"老穆\",\"phone\":\"189-8720-5777\"},{\"name\":\"老婆\",\"phone\":\"138-8897-2651\"},{\"name\":\"老婆\",\"phone\":\"13888972651\"},{\"name\":\"老钱\",\"phone\":\"135-0180-8209\"},{\"name\":\"老师\",\"phone\":\"139-9199-9011\"},{\"name\":\"老四\",\"phone\":\"139-4400-4114\"},{\"name\":\"老王\",\"phone\":\"135-8591-9058\"},{\"name\":\"老杨\",\"phone\":\"158-7773-6988\"},{\"name\":\"李创根\",\"phone\":\"134-0496-9286\"},{\"name\":\"李大哥\",\"phone\":\"189-7708-1062\"},{\"name\":\"李丹\",\"phone\":\"139-8792-8836\"},{\"name\":\"李饭店\",\"phone\":\"139-8724-0123\"},{\"name\":\"李飞\",\"phone\":\"139-8854-2124\"},{\"name\":\"李桂容老师\",\"phone\":\"158-7775-3810\"},{\"name\":\"李机顶合\",\"phone\":\"159-1121-0248\"},{\"name\":\"李兰华\",\"phone\":\"131-8768-7999\"},{\"name\":\"李兰华\",\"phone\":\"158-8731-5999\"},{\"name\":\"李磊客栈\",\"phone\":\"187-2188-2985\"},{\"name\":\"李莉\",\"phone\":\"187-0718-5529\"},{\"name\":\"李秋平河南\",\"phone\":\"139-3987-5552\"},{\"name\":\"李晓燕保\",\"phone\":\"157-5023-2559\"},{\"name\":\"李亚雄\",\"phone\":\"137-0060-7606\"},{\"name\":\"李阳\",\"phone\":\"151-9876-6667\"},{\"name\":\"李朝艳\",\"phone\":\"135-5021-2911\"},{\"name\":\"李订房\",\"phone\":\"189-3621-7737\"},{\"name\":\"李订房15号\",\"phone\":\"137-0832-7793\"},{\"name\":\"李定房7??1-3大 床房已付\",\"phone\":\"138-9285-1059\"},{\"name\":\"李国巨客人\",\"phone\":\"153-6613-6146\"},{\"name\":\"李灰灰\",\"phone\":\"139-8869-0804\"},{\"name\":\"李佳\",\"phone\":\"159-4430-9515\"},{\"name\":\"李杰\",\"phone\":\"131-5065-9299\"},{\"name\":\"李坤\",\"phone\":\"18288224708\"},{\"name\":\"李亮BM\",\"phone\":\"18721100052\"},{\"name\":\"李倩文巴中\",\"phone\":\"189-8066-3923\"},{\"name\":\"李锐\",\"phone\":\"138-8844-1154\"},{\"name\":\"李润\",\"phone\":\"134-0890-0775\"},{\"name\":\"李世明\",\"phone\":\"139-8729-3616\"},{\"name\":\"李水电\",\"phone\":\"136-0882-3295\"},{\"name\":\"李小唐\",\"phone\":\"131-6269-8511\"},{\"name\":\"李晓伟\",\"phone\":\"13810965892\"},{\"name\":\"李晓燕峨眉\",\"phone\":\"133-9825-9419\"},{\"name\":\"李新娜\",\"phone\":\"137-1868-6222\"},{\"name\":\"李永建\",\"phone\":\"151-9838-7388\"},{\"name\":\"李永平\",\"phone\":\"189-0878-6991\"},{\"name\":\"李永平\",\"phone\":\"139-8726-6835\"},{\"name\":\"李瑜\",\"phone\":\"139-0876-8976\"},{\"name\":\"李远达\",\"phone\":\"136-7168-8381\"},{\"name\":\"李远达\",\"phone\":\"131-8069-9066\"},{\"name\":\"李、朱晓芳朋友\",\"phone\":\"183-8725-9560\"},{\"name\":\"李G+\",\"phone\":\"137-6149-3137\"},{\"name\":\"理惠\",\"phone\":\"021-56079846\"},{\"name\":\"丽江高姐\",\"phone\":\"136-2888-7676\"},{\"name\":\"丽江花花\",\"phone\":\"150-1222-3293\"},{\"name\":\"丽丽\",\"phone\":\"13671700004\"},{\"name\":\"丽丽\",\"phone\":\"137-6177-1250\"},{\"name\":\"利星于康\",\"phone\":\"13764312080\"},{\"name\":\"利波哥\",\"phone\":\"138-8722-0044\"},{\"name\":\"莉莉\",\"phone\":\"138-1630-7446\"},{\"name\":\"连队 EJ\",\"phone\":\"131-6271-1011\"},{\"name\":\"莲花岛小徐\",\"phone\":\"15862407240\"},{\"name\":\"梁董姐姐\",\"phone\":\"135-2446-6877\"},{\"name\":\"梁静\",\"phone\":\"182-0178-3616\"},{\"name\":\"梁宙倩25号子母房2晚\",\"phone\":\"135-9004-6857\"},{\"name\":\"梁总\",\"phone\":\"136-0177-9935\"},{\"name\":\"廖春梅\",\"phone\":\"189-8726-2166\"},{\"name\":\"廖昊\",\"phone\":\"182-8727-9007\"},{\"name\":\"廖军\",\"phone\":\"159-8339-8305\"},{\"name\":\"廖俊丽\",\"phone\":\"150-7233-3676\"},{\"name\":\"廖临\",\"phone\":\"151-2655-5967\"},{\"name\":\"廖明\",\"phone\":\"139-9065-7904\"},{\"name\":\"廖明洪\",\"phone\":\"133-8827-4355\"},{\"name\":\"廖明洪\",\"phone\":\"135-4193-8252\"},{\"name\":\"廖伟久\",\"phone\":\"130-8741-8413\"},{\"name\":\"林杰\",\"phone\":\"13311999999\"},{\"name\":\"林子杰\",\"phone\":\"+1?(626)?800-9498\"},{\"name\":\"林风\",\"phone\":\"137-6576-1658\"},{\"name\":\"林海定房2-4标准间\",\"phone\":\"130-0865-4815\"},{\"name\":\"林辉\",\"phone\":\"136-0882-0443\"},{\"name\":\"林雪\",\"phone\":\"150-2184-4779\"},{\"name\":\"林雪\",\"phone\":\"131-2275-2675\"},{\"name\":\"林姸\",\"phone\":\"1795113888004755\"},{\"name\":\"林正茂(总)\",\"phone\":\"137-0186-5513\"},{\"name\":\"林子杰K\",\"phone\":\"135-1022-7483\"},{\"name\":\"林总\",\"phone\":\"150-0098-7986\"},{\"name\":\"领队\",\"phone\":\"18143105620\"},{\"name\":\"刘\",\"phone\":\"137-5870-8773\"},{\"name\":\"刘博\",\"phone\":\"183-2113-7622\"},{\"name\":\"刘大爷\",\"phone\":\"151-6439-9179\"},{\"name\":\"刘导\",\"phone\":\"158-9457-6398\"},{\"name\":\"刘洪涛\",\"phone\":\"150-4433-6600\"},{\"name\":\"刘惠\",\"phone\":\"139-8723-0799\"},{\"name\":\"刘惠\",\"phone\":\"189-0872-3309\"},{\"name\":\"刘健\",\"phone\":\"13501891805\"},{\"name\":\"刘洁英\",\"phone\":\"137-1061-4800\"},{\"name\":\"刘经理宿舍\",\"phone\":\"156-0192-4110\"},{\"name\":\"刘梦丽\",\"phone\":\"182-0173-1887\"},{\"name\":\"刘明宇\",\"phone\":\"15000919316\"},{\"name\":\"刘明雨\",\"phone\":\"180-5942-0999\"},{\"name\":\"刘铭双\",\"phone\":\"189-6459-4965\"},{\"name\":\"刘难难\",\"phone\":\"156-9215-8960\"},{\"name\":\"刘。日系调酒\",\"phone\":\"135-6493-9055\"},{\"name\":\"刘胜云\",\"phone\":\"138-8724-5503\"},{\"name\":\"刘世礼\",\"phone\":\"135-7729-9221\"},{\"name\":\"刘世龙\",\"phone\":\"152-2188-6988\"},{\"name\":\"刘双\",\"phone\":\"182-0689-4167\"},{\"name\":\"刘太平\",\"phone\":\"139-8855-5603\"},{\"name\":\"刘文文\",\"phone\":\"159-0190-8035\"},{\"name\":\"刘先生\",\"phone\":\"186-0566-5112\"},{\"name\":\"刘显文\",\"phone\":\"189-8724-0070\"},{\"name\":\"刘小辉12号标1\",\"phone\":\"133-8093-7677\"},{\"name\":\"刘亚男\",\"phone\":\"186-8667-4805\"},{\"name\":\"刘亚楠BM\",\"phone\":\"182-6992-1366\"},{\"name\":\"刘艳荣、阿英朋友\",\"phone\":\"+86 136-6971-7437\"},{\"name\":\"刘艳荣姐夫\",\"phone\":\"138-8861-6858\"},{\"name\":\"刘燕\",\"phone\":\"138-1740-2261\"},{\"name\":\"刘尧\",\"phone\":\"186-2667-7465\"},{\"name\":\"刘耀岭\",\"phone\":\"158-2178-7783\"},{\"name\":\"刘月彤\",\"phone\":\"152-1666-8208\"},{\"name\":\"刘玥彤\",\"phone\":\"15216668208\"},{\"name\":\"龙\",\"phone\":\"17091602732\"},{\"name\":\"龙玲玲\",\"phone\":\"180-0889-3222\"},{\"name\":\"龙云\","
+ "\"phone\":\"13777779595\"},{\"name\":\"龙四川香天下\",\"phone\":\"180-8027-8687\"},{\"name\":\"龙虾\",\"phone\":\"18019841368\"},{\"name\":\"楼下外卖\",\"phone\":\"138-1772-7118\"},{\"name\":\"楼下宵夜\",\"phone\":\"159-2111-6329\"},{\"name\":\"卢亮亮BM\",\"phone\":\"15800803157\"},{\"name\":\"鲁丽芹\",\"phone\":\"138-8722-3887\"},{\"name\":\"鲁妹\",\"phone\":\"136-4872-7666\"},{\"name\":\"吕峨眉\",\"phone\":\"136-5819-7013\"},{\"name\":\"吕丽 K\",\"phone\":\"186-0546-7222\"},{\"name\":\"吕燕\",\"phone\":\"180-8061-0713\"},{\"name\":\"吕燕\",\"phone\":\"135-5167-9419\"},{\"name\":\"吕燕\",\"phone\":\"15912113730\"},{\"name\":\"旅游局\",\"phone\":\"0872-2508233\"},{\"name\":\"绿化\",\"phone\":\"156-0189-5373\"},{\"name\":\"绿园顺丰\",\"phone\":\"13756106193\"},{\"name\":\"栾总\",\"phone\":\"139-0872-8098\"},{\"name\":\"论文老师\",\"phone\":\"189-4366-0162\"},{\"name\":\"罗浩\",\"phone\":\"13187887788\"},{\"name\":\"罗琼、彝家客栈\",\"phone\":\"151-8725-9505\"},{\"name\":\"罗微\",\"phone\":\"139-8761-6337\"},{\"name\":\"罗玺平\",\"phone\":\"135-7788-7888\"},{\"name\":\"罗晓东,瞄\",\"phone\":\"139-8859-8962\"},{\"name\":\"罗兄\",\"phone\":\"189-8722-2799\"},{\"name\":\"Lisa。BM\",\"phone\":\"136-8199-1755\"},{\"name\":\"Lucy EJ\",\"phone\":\"186-1625-3259\"},{\"name\":\"妈\",\"phone\":\"18887246730\"},{\"name\":\"妈店\",\"phone\":\"0872-3120718\"},{\"name\":\"妈妈\",\"phone\":\"139-9062-7917\"},{\"name\":\"妈咪\",\"phone\":\"131-0447-3520\"},{\"name\":\"麻将钢窗\",\"phone\":\"159-1120-6094\"},{\"name\":\"麻将卖\",\"phone\":\"150-9694-5822\"},{\"name\":\"麻麻\",\"phone\":\"13578901919\"},{\"name\":\"马订房\",\"phone\":\"130-5009-1998\"},{\"name\":\"马定房\",\"phone\":\"153-2025-4798\"},{\"name\":\"马克\",\"phone\":\"189-6402-2799\"},{\"name\":\"马克思\",\"phone\":\"158-0045-1058\"},{\"name\":\"马老师\",\"phone\":\"135-6471-6200\"},{\"name\":\"马磊\",\"phone\":\"139-2428-7773\"},{\"name\":\"马里奥\",\"phone\":\"132-6255-3607\"},{\"name\":\"马龙\",\"phone\":\"152-0191-6616\"},{\"name\":\"马妹\",\"phone\":\"139-8859-0715\"},{\"name\":\"马米\",\"phone\":\"161805\"},{\"name\":\"马双林\",\"phone\":\"136-9900-3567\"},{\"name\":\"马嫣敏\",\"phone\":\"139-0183-5295\"},{\"name\":\"马医生\",\"phone\":\"138-8723-1938\"},{\"name\":\"蚂蚁短租\",\"phone\":\"400-069-6060\"},{\"name\":\"麦兜后妈\",\"phone\":\"18686679117\"},{\"name\":\"麦茜欣BM\",\"phone\":\"188-1652-8134\"},{\"name\":\"卖车的\",\"phone\":\"139-8725-6119\"},{\"name\":\"馒头\",\"phone\":\"139-6883-5662\"},{\"name\":\"毛良军\",\"phone\":\"135-7729-9593\"},{\"name\":\"毛军\",\"phone\":\"139-8853-6565\"},{\"name\":\"玫瑰整容\",\"phone\":\"18512112596\"},{\"name\":\"眉毛活动\",\"phone\":\"13756138262\"},{\"name\":\"美人鱼\",\"phone\":\"138-7637-4859\"},{\"name\":\"美团\",\"phone\":\"181-0132-9730\"},{\"name\":\"美团顾千婷婷\",\"phone\":\"187-6096-0039\"},{\"name\":\"美团华江芹\",\"phone\":\"186-0885-1971\"},{\"name\":\"萌萌\",\"phone\":\"186-4282-5256\"},{\"name\":\"萌萌\",\"phone\":\"186-4287-1310\"},{\"name\":\"孟凡\",\"phone\":\"138-1740-8788\"},{\"name\":\"梦语\",\"phone\":\"131-2076-7620\"},{\"name\":\"咪眼志\",\"phone\":\"13505770576\"},{\"name\":\"弥度燕\",\"phone\":\"187-8728-1339\"},{\"name\":\"米粉\",\"phone\":\"159-0188-5160\"},{\"name\":\"敏\",\"phone\":\"13806691505\"},{\"name\":\"明天订房\",\"phone\":\"155-0217-8712\"},{\"name\":\"莫公\",\"phone\":\"187-8969-7261\"},{\"name\":\"木。调酒师\",\"phone\":\"159-4182-7271\"},{\"name\":\"穆\",\"phone\":\"138-8729-7867\"},{\"name\":\"M2李秋亭\",\"phone\":\"138-8809-8994\"},{\"name\":\"Maggie Ej\",\"phone\":\"130-2317-7005\"},{\"name\":\"Miki\",\"phone\":\"186-1692-1916\"},{\"name\":\"Muse~Neko高桥\",\"phone\":\"131-6603-2526\"},{\"name\":\"拿货\",\"phone\":\"18611094987\"},{\"name\":\"娜娜杨子\",\"phone\":\"136-6197-7949\"},{\"name\":\"奶奶\",\"phone\":\"153-0677-8453\"},{\"name\":\"楠\",\"phone\":\"18087761535\"},{\"name\":\"倪Yoyo\",\"phone\":\"158-0187-6566\"},{\"name\":\"倪老乡\",\"phone\":\"186-0885-1676\"},{\"name\":\"宁显明\",\"phone\":\"136-0872-7753\"},{\"name\":\"宁波\",\"phone\":\"135-6644-0604\"},{\"name\":\"糯米朱\",\"phone\":\"151-6124-1018\"},{\"name\":\"Nike\",\"phone\":\"159-0086-6891\"},{\"name\":\"欧阳小羽\",\"phone\":\"15001835502\"},{\"name\":\"拍卖小伟\",\"phone\":\"130-0900-0123\"},{\"name\":\"派出所\",\"phone\":\"0872-2678116\"},{\"name\":\"潘博。上海敖雨\",\"phone\":\"+86 189-3082-7777\"},{\"name\":\"潘浩\",\"phone\":\"136-6441-9468\"},{\"name\":\"潘微\",\"phone\":\"139-4309-3332\"},{\"name\":\"潘小??\",\"phone\":\"186-4307-7336\"},{\"name\":\"潘洋\",\"phone\":\"186-4307-7336\"},{\"name\":\"潘玉鹏\",\"phone\":\"155-2826-5969\"},{\"name\":\"庞大姐\",\"phone\":\"158-0217-8531\"},{\"name\":\"胖子\",\"phone\":\"+8613758425778\"},{\"name\":\"胖子菜品供应商\",\"phone\":\"137-6442-7350\"},{\"name\":\"跑 友\",\"phone\":\"158-5851-0690\"},{\"name\":\"跑腿\",\"phone\":\"139-6881-4656\"},{\"name\":\"裴晓宇\",\"phone\":\"137-6156-9122\"},{\"name\":\"沛家军 蚂蚁\",\"phone\":\"155-6701-4401\"},{\"name\":\"彭老乡定房\",\"phone\":\"135-5061-3104\"},{\"name\":\"披萨\",\"phone\":\"62335969\"},{\"name\":\"平安保险\",\"phone\":\"0872-2323359\"},{\"name\":\"平利物流\",\"phone\":\"2674328\"},{\"name\":\"蒲订11月1.2.3号单间68\",\"phone\":\"159-2321-7963\"},{\"name\":\"普斤\",\"phone\":\"135-7753-9398\"},{\"name\":\"普斤座\",\"phone\":\"157-6997-9076\"},{\"name\":\"普燕玉石城\",\"phone\":\"138-8722-9549\"},{\"name\":\"POP李波\",\"phone\":\"130-1786-6652\"},{\"name\":\"Pos机\",\"phone\":\"180-1631-6351\"},{\"name\":\"仇丽\",\"phone\":\"139-1779-1212\"},{\"name\":\"七彩土豆\",\"phone\":\"158-1217-4500\"},{\"name\":\"妻管炎\",\"phone\":\"137-0866-6844\"},{\"name\":\"齐唱\",\"phone\":\"13916969701\"},{\"name\":\"齐飞\",\"phone\":\"13894191288\"},{\"name\":\"气客运东站\",\"phone\":\"0872-2310455\"},{\"name\":\"汽车古城客运、\",\"phone\":\"131-0872-5957\"},{\"name\":\"汽车古城客运龙哥\",\"phone\":\"139-8854-3007\"},{\"name\":\"汽车售票大理\",\"phone\":\"0872-2681431\"},{\"name\":\"汽车售票环城\",\"phone\":\"0872-2128922\"},{\"name\":\"汽车售票小花圆\",\"phone\":\"0872-2123436\"},{\"name\":\"汽车售票兴盛\",\"phone\":\"0872-2125281\"},{\"name\":\"汽修\",\"phone\":\"130-7434-3130\"},{\"name\":\"戚加威EJ\",\"phone\":\"150-5592-6822\"},{\"name\":\"千\",\"phone\":\"159-6871-2927\"},{\"name\":\"前台小雨BM\",\"phone\":\"130-4467-1269\"},{\"name\":\"強生搬运\",\"phone\":\"96811\"},{\"name\":\"强\",\"phone\":\"13888525555\"},{\"name\":\"乔\",\"phone\":\"151-6087-3868\"},{\"name\":\"乔丹\",\"phone\":\"+86 181-2122-9280\"},{\"name\":\"俏俏\",\"phone\":\"13818099158\"},{\"name\":\"秦姐\",\"phone\":\"138-1640-8899\"},{\"name\":\"秦勇\",\"phone\":\"138-8720-2628\"},{\"name\":\"青芒果\",\"phone\":\"0755-33399030\"},{\"name\":\"情人节Sky\",\"phone\":\"136-1174-9408\"},{\"name\":\"琼\",\"phone\":\"+86 137-6922-9795\"},{\"name\":\"琼瑶\",\"phone\":\"137-7775-9731\"},{\"name\":\"邱建国\",\"phone\":\"183-1716-8010\"},{\"name\":\"曲哥建材\",\"phone\":\"139-4509-5678\"},{\"name\":\"瞿晶晶\",\"phone\":\"186-0212-8838\"},{\"name\":\"去那白雪\",\"phone\":\"150-1140-8731\"},{\"name\":\"去那白雪\",\"phone\":\"156-8725-0821\"},{\"name\":\"去哪儿房态\",\"phone\":\"010-89676886\"},{\"name\":\"去哪儿网房太\",\"phone\":\"010-89954546\"},{\"name\":\"去哪结算\",\"phone\":\"010-89676836\"},{\"name\":\"去哪结算张淑萍\",\"phone\":\"183-0110-3559\"},{\"name\":\"去哪审核部\",\"phone\":\"010-89676001\"},{\"name\":\"去那大理公司\",\"phone\":\"0872-8812019\"},{\"name\":\"去那高凌露\",\"phone\":\"138-1018-8528\"},{\"name\":\"去那高零路\",\"phone\":\"157-5024-3925\"},{\"name\":\"去那施银梅\",\"phone\":\"151-2523-3996\"},{\"name\":\"全家超市\",\"phone\":\"62093831\"},{\"name\":\"戎涛\",\"phone\":\"+8618655891585\"},{\"name\":\"Rico。调酒师\",\"phone\":\"150-2674-4243\"},{\"name\":\"Rocky EJ\",\"phone\":\"150-0080-5215\"},{\"name\":\"沈聪\",\"phone\":\"150-4173-8344\"},{\"name\":\"沈洁红\",\"phone\":\"135-1872-6681\"},{\"name\":\"沈老师\",\"phone\":\"139-1725-8510\"},{\"name\":\"沈老头\",\"phone\":\"15844004030\"},{\"name\":\"单辉\",\"phone\":\"137-0666-6575\"},{\"name\":\"三老\",\"phone\":\"+8613634271931\"},{\"name\":\"三叔\",\"phone\":\"189-4315-6681\"},{\"name\":\"三叔\",\"phone\":\"13604328681\"},{\"name\":\"三塔票\",\"phone\":\"139-8856-6784\"},{\"name\":\"三文\",\"phone\":\"139-8720-7346\"},{\"name\":\"三亚_老李\",\"phone\":\"139-0760-0413\"},{\"name\":\"三亚_司机\",\"phone\":\"138-7658-7035\"},{\"name\":\"三亚小陈\",\"phone\":\"130-0607-9988\"},{\"name\":\"嫂\",\"phone\":\"135-7722-2697\"},{\"name\":\"森森\",\"phone\":\"187-4344-5500\"},{\"name\":\"森森\",\"phone\":\"136-8189-8939\"},{\"name\":\"杀虫\",\"phone\":\"136-8187-4447\"},{\"name\":\"沙县小吃\",\"phone\":\"136-6167-4675\"},{\"name\":\"莎莎\",\"phone\":\"138-1866-1226\"},{\"name\":\"闪光牌\",\"phone\":\"139-8853-6688\"},{\"name\":\"扇贝王\",\"phone\":\"0577-88368035\"},{\"name\":\"上官鱼鹰表演\",\"phone\":\"138-8723-3784\"},{\"name\":\"上海跑腿\",\"phone\":\"13661456439\"},{\"name\":\"上海跑腿 儿子\",\"phone\":\"158-0065-6500\"},{\"name\":\"上青1200\",\"phone\":\"150-0008-3630\"},{\"name\":\"上青1500\",\"phone\":\"136-6162-8515\"},{\"name\":\"烧烤\",\"phone\":\"135-7729-3534\"},{\"name\":\"烧烤 汽车公寓\",\"phone\":\"137-6193-5488\"},{\"name\":\"烧烤。志丹路\",\"phone\":\"136-2190-6179\"},{\"name\":\"设计师EJ\",\"phone\":\"186-7971-5210\"},{\"name\":\"申通\",\"phone\":\"02160341684\"},{\"name\":\"盛仿瓷\",\"phone\":\"139-8724-5633\"},{\"name\":\"施彦辰\",\"phone\":\"13888911355\"},{\"name\":\"施彦晨\",\"phone\":\"18987278266\"},{\"name\":\"施政委\",\"phone\":\"139-8720-2426\"},{\"name\":\"十一\",\"phone\":\"186-4601-0255\"},{\"name\":\"石\",\"phone\":\"139-5775-1111\"},{\"name\":\"石芹芳维西\",\"phone\":\"152-8457-1938\"},{\"name\":\"收银\",\"phone\":\"136-3645-8946\"},{\"name\":\"收银小徐\",\"phone\":\"150-2691-2581\"},{\"name\":\"疏通下水道\",\"phone\":\"183-8727-8780\"},{\"name\":\"曙光\",\"phone\":\"15104457775\"},{\"name\":\"双志\",\"phone\":\"159-1261-1842\"},{\"name\":\"水饺\",\"phone\":\"63744100\"},{\"name\":\"水心点心\",\"phone\":\"057788500525\"},{\"name\":\"司机进军\",\"phone\":\"+8613676403313\"},{\"name\":\"斯秦东A\",\"phone\":\"130-1339-9222\"},{\"name\":\"斯幼康\",\"phone\":\"138-8721-9157\"},{\"name\":\"四哥\",\"phone\":\"184-8755-9239\"},{\"name\":\"四海通\",\"phone\":\"133-1278-4976\"},{\"name\":\"四海通\",\"phone\":\"0872-2682678\"},{\"name\":\"四新媳妇\",\"phone\":\"158-9459-7738\"},{\"name\":\"宋 酒吧\",\"phone\":\"15618558983\"},{\"name\":\"宋平\",\"phone\":\"152-2110-3799\"},{\"name\":\"送菜\",\"phone\":\"135-2456-5448\"},{\"name\":\"送飞机场\",\"phone\":\"186-0345-0503\"},{\"name\":\"送水\",\"phone\":\"62050061\"},{\"name\":\"苏\",\"phone\":\"136-6877-8932\"},{\"name\":\"苏堤快客\",\"phone\":\"139-1816-5128\"},{\"name\":\"苏提_保洁\",\"phone\":\"15000986682\"},{\"name\":\"苏提水果\",\"phone\":\"136-1184-0885\"},{\"name\":\"苏缇外卖\",\"phone\":\"62668722\"},{\"name\":\"苏缇物业\",\"phone\":\"021-60835299\"},{\"name\":\"苏耀\",\"phone\":\"138-8729-8677\"},{\"name\":\"宿舍1800\",\"phone\":\"138-0166-5765\"},{\"name\":\"孙\",\"phone\":\"183-2176-5551\"},{\"name\":\"孙阿姨\",\"phone\":\"158-2109-7059\"},{\"name\":\"孙教练\",\"phone\":\"+86 151-4311-0324\"},{\"name\":\"孙小姐客人\",\"phone\":\"135-5496-6109\"},{\"name\":\"孙玉立\",\"phone\":\"155-6765-6767\"},{\"name\":\"孙总\",\"phone\":\"138-0195-7204\"},{\"name\":\"索道薛蕾\",\"phone\":\"139-8853-6251\"},{\"name\":\"索道学奎一日游\",\"phone\":\"139-8850-5132\"},{\"name\":\"S2陈建平\",\"phone\":\"+8615000389973\"},{\"name\":\"S2戴梦月\",\"phone\":\"158-2182-9554\"},{\"name\":\"S2杜大锐\",\"phone\":\"187-2194-2443\"},{\"name\":\"小顺BM\",\"phone\":\"139-1609-4963\"},{\"name\":\"租房206\",\"phone\":\"157-0884-4566\"},{\"name\":\"五姨夫\",\"phone\":\"132-2431-5655\"},{\"name\":\"302客人\",\"phone\":\"136-8111-7833\"},{\"name\":\"肖定8??10号三人间\",\"phone\":\"136-0125-2127\"},{\"name\":\"\",\"phone\":\"010-84939666\"},{\"name\":\"许伟\",\"phone\":\"136-1942-1883\"},{\"name\":\"田云龙\",\"phone\":\"133-2055-6082\"},{\"name\":\"婷婷\",\"phone\":\"180-4311-8088\"},{\"name\":\"志丹路烧烤\",\"phone\":\"136-2190-6179\"},{\"name\":\"王海峰\",\"phone\":\"138-1715-9852\"},{\"name\":\"香燕\",\"phone\":\"158-5851-1522\"},{\"name\":\"志丰\",\"phone\":\"13706634444\"},{\"name\":\"携程网昆明\",\"phone\":\"0871-63938427\"},{\"name\":\"赵俊丹\",\"phone\":\"158-2517-7671\"},{\"name\":\"钟翼\",\"phone\":\"138-8047-9784\"},{\"name\":\"许湖妍三棵??\",\"phone\":\"136-2872-5413\"},{\"name\":\"\",\"phone\":\"018163413274\"},{\"name\":\"S2王亚\",\"phone\":\"135-2431-3802\"},{\"name\":\"吴昌山\",\"phone\":\"136-1967-3413\"},{\"name\":\"途家、李\",\"phone\":\"028-83167955\"},{\"name\":\"张华昌\",\"phone\":\"139-8720-7992\"},{\"name\":\"S2徐浩卜\",\"phone\":\"158-0037-3062\"},{\"name\":\"杨雪芬\",\"phone\":\"133-3055-0378\"},{\"name\":\"振宇\",\"phone\":\"138-1855-5588\"},{\"name\":\"太阳\",\"phone\":\"130-6912-9919\"},{\"name\":\"郑。水烟\",\"phone\":\"159-0179-7161\"},{\"name\":\"晓飞\",\"phone\":\"158-5800-5875\"},{\"name\":\"S2武孝天\",\"phone\":\"150-2681-4790\"},{\"name\":\"谢勇\",\"phone\":\"137-6484-1811\"},{\"name\":\"下关医美\",\"phone\":\"13708666540\"},{\"name\":\"郑颖\",\"phone\":\"139-9199-9011\"},{\"name\":\"携程\",\"phone\":\"0871-63108105\"},{\"name\":\"淘宝商家\",\"phone\":\"0571-88157858\"},{\"name\":\"杨导\",\"phone\":\"130-3862-3635\"},{\"name\":\"徐网站\",\"phone\":\"155-4972-4024\"},{\"name\":\"医保中心\",\"phone\":\"0872-2170755\"},{\"name\":\"22号朱订房3人\",\"phone\":\"137-7866-9353\"},{\"name\":\"言胖哥K\",\"phone\":\"+65 9791 4751\"},{\"name\":\"8号标1间、王\",\"phone\":\"152-8717-8908\"},{\"name\":\"王永亮\",\"phone\":\"159-1265-8868\"},{\"name\":\"游船短线李娇\",\"phone\":\"150-9692-9381\"},{\"name\":\"吴佩佩BM\",\"phone\":\"187-1777-7826\"},{\"name\":\"张英姿\",\"phone\":\"186-0885-5383\"},{\"name\":\"吴振宏SB\",\"phone\":\"150-5773-4678\"},{\"name\":\"药店\",\"phone\":\"88732999\"},{\"name\":\"许珊\",\"phone\":\"158-0075-0663\"},{\"name\":\"小平\",\"phone\":\"150-0031-3281\"},{\"name\":\"张丽琼\",\"phone\":\"138-8723-2080\"},{\"name\":\"张微\",\"phone\":\"186-8667-0017\"},{\"name\":\"蟹庄\",\"phone\":\"152-5027-2637\"},{\"name\":\"周敏S2\",\"phone\":\"186-5636-6441\"},{\"name\":\"朱光松客人\",\"phone\":\"186-8513-0789\"},{\"name\":\"赵建熊\",\"phone\":\"131-5064-2662\"},{\"name\":\"17子母房一间、徐先生\",\"phone\":\"139-1156-7447\"},{\"name\":\"叶欢BM\",\"phone\":\"150-2128-3007\"},{\"name\":\"魏云玉溪客\",\"phone\":\"159-0877-5827\"},{\"name\":\"S2马富强\",\"phone\":\"152-5476-9005\"},{\"name\":\"温州_起点\",\"phone\":\"0577-88258611\"},{\"name\":\"S2李文磊\",\"phone\":\"137-6129-5624\"},{\"name\":\"租用场地\",\"phone\":\"182-1702-3060\"},{\"name\":\"姚定房6-21-28\",\"phone\":\"138-0223-9410\"},{\"name\":\"丝芙兰总监\",\"phone\":\"18606637002\"},{\"name\":\"\",\"phone\":\"186-1664-7890\"},{\"name\":\"应聘\",\"phone\":\"189-1873-3807\"},{\"name\":\"汪大哥\",\"phone\":\"180-1167-6269\"},{\"name\":\"中亚\",\"phone\":\"63535555\"},{\"name\":\"薛新\",\"phone\":\"186-0698-8585\"},{\"name\":\"张露\",\"phone\":\"151-9833-3427\"},{\"name\":\"张秀明\",\"phone\":\"152-8199-5666\"},{\"name\":\"汤师傅\",\"phone\":\"133-3187-2769\"},{\"name\":\"赵飞\",\"phone\":\"136-0882-0816\"},{\"name\":\"余三姐\",\"phone\":\"135-4195-8061\"},{\"name\":\"向宇 五月花一店\",\"phone\":\"13664417955\"},{\"name\":\"张平\",\"phone\":\"136-9615-0895\"},{\"name\":\"汤微8号\",\"phone\":\"139-1185-6647\"},{\"name\":\"元芳\",\"phone\":\"136-2166-0592\"},{\"name\":\"张艳\",\"phone\":\"137-5777-2588\"},{\"name\":\"展心\",\"phone\":\"135-8762-9119\"},{\"name\":\"赵老师\",\"phone\":\"136-2430-1983\"},{\"name\":\"盈盈\",\"phone\":\"137-7771-1907\"},{\"name\":\"小爱\",\"phone\":\"152-2152-6894\"},{\"name\":\"张淑琼订房标22号\",\"phone\":\"180-4200-9313\"},{\"name\":\"赵雄建\",\"phone\":\"138-8725-4686\"},{\"name\":\"永和\",\"phone\":\"62313172\"},{\"name\":\"杨四新\",\"phone\":\"139-8729-6105\"},{\"name\":\"朱点\",\"phone\":\"136-1172-2219\"},{\"name\":\"杨珊\",\"phone\":\"135-7726-8559\"},{\"name\":\"雪!\",\"phone\":\"137-0886-6931\"},{\"name\":\"杨伟珠\",\"phone\":\"135-7724-0262\"},{\"name\":\"王奇\",\"phone\":\"13801995145\"},{\"name\":\"洗衣机\",\"phone\":\"0872-2183800\"},{\"name\":\"S2老魏\",\"phone\":\"186-1612-0125\"},{\"name\":\"王开元BM\",\"phone\":\"158-2128-2137\"},{\"name\":\"杨剑波\",\"phone\":\"139-0872-5882\"},{\"name\":\"西康路\",\"phone\":\"15000873014\"},{\"name\":\"张帆\",\"phone\":\"153-0440-8352\"},{\"name\":\"赵韩叶\",\"phone\":\"139-8856-3217\"},{\"name\":\"张義丹\",\"phone\":\"186-8737-1115\"},{\"name\":\"S2江瑞霞\",\"phone\":\"150-0044-0625\"},{\"name\":\"24订房\",\"phone\":\"159-4592-8582\"},{\"name\":\"小周\",\"phone\":\"159-8762-3223\"},{\"name\":\"左客栈\",\"phone\":\"186-0872-9980\"},{\"name\":\"艺龙网\",\"phone\":\"400-933-3333\"},{\"name\":\"王红楚\",\"phone\":\"152-8857-2737\"},{\"name\":\"腾老师\",\"phone\":\"150-0213-8856\"},{\"name\":\"杨正旺\",\"phone\":\"138-8720-0898\"},{\"name\":\"袁圆\",\"phone\":\"158-2319-4055\"},{\"name\":\"S2唐家泓\",\"phone\":\"158-2113-3847\"},{\"name\":\"张红梅\",\"phone\":\"130-0864-0482\"},{\"name\":\"周涛毛肚\",\"phone\":\"152-2346-3098\"},{\"name\":\"小叶\",\"phone\":\"186-0161-0713\"},{\"name\":\"唐琼\",\"phone\":\"183-1387-5095\"},{\"name\":\"携程可娴大理公司\",\"phone\":\"158-0879-8454\"},{\"name\":\"张喻芸\",\"phone\":\"187-2191-8767\"},{\"name\":\"小刘\",\"phone\":\"156-1897-1370\"},{\"name\":\"爷爷\",\"phone\":\"130-1344-9893\"},{\"name\":\"艺龙\",\"phone\":\"0871-65395450\"},{\"name\":\"杨丽平\",\"phone\":\"139-8721-5168\"},{\"name\":\"王娟索道\",\"phone\":\"151-8493-7066\"},{\"name\":\"S2郭弛\",\"phone\":\"186-1630-4443\"},{\"name\":\"远方网王晓娟\",\"phone\":\"186-1819-3601\"},{\"name\":\"医生\",\"phone\":\"150-0180-0100\"},{\"name\":\"温州_跑腿_g\",\"phone\":\"150-5878-1846\"},{\"name\":\"温州郑老师\",\"phone\":\"158-6778-9073\"},{\"name\":\"淘宝\",\"phone\":\"400-168-8688\"},{\"name\":\"S2张燕辉\",\"phone\":\"183-4818-2655\"},{\"name\":\"小秋 安华手机\",\"phone\":\"13756584555\"},{\"name\":\"张思凡\",\"phone\":\"139-1669-0271\"},{\"name\":\"小彤\",\"phone\":\"186-2150-0980\"},{\"name\":\"朱晓芳\",\"phone\":\"187-8724-1450\"},{\"name\":\"张文芳\",\"phone\":\"139-8860-6729\"},{\"name\":\"S2张亚杰\",\"phone\":\"138-2510-2761\"},{\"name\":\"张大爹儿子\",\"phone\":\"135-7726-6361\"},{\"name\":\"杨露BM\",\"phone\":\"151-5209-7957\"},{\"name\":\"携程小张\",\"phone\":\"130-1336-3003\"},{\"name\":\"sb\",\"phone\":\"15000339417\"},{\"name\":\"徐涛\",\"phone\":\"137-0888-5518\"},{\"name\":\"S2魏祥\",\"phone\":\"138-1626-5749\"},{\"name\":\"杨静BM\",\"phone\":\"150-2179-3346\"},{\"name\":\"张师\",\"phone\":\"139-8724-6813\"},{\"name\":\"杨艳梅\",\"phone\":\"139-8729-8769\"},{\"name\":\"中亚会所\",\"phone\":\"65619999\"},{\"name\":\"照相战斗机\",\"phone\":\"+86 150-8702-5210\"},{\"name\":\"S2刘晓丽\",\"phone\":\"137-8894-1558\"},{\"name\":\"Sunny Xiao\",\"phone\":\"185-2352-3082\"},{\"name\":\"同程网王经理\",\"phone\":\"0512-80990796\"},{\"name\":\"滕文珍BM\",\"phone\":\"159-2187-3687\"},{\"name\":\"艺龙大理公司\",\"phone\":\"137-0845-8172\"},{\"name\":\"S2前台惠惠\",\"phone\":\"183-1707-8071\"},{\"name\":\"王燕丽江\",\"phone\":\"157-7042-8181\"},{\"name\":\"\",\"phone\":\"\"},{\"name\":\"找住的\",\"phone\":\"400-831-8266\"},{\"name\":\"张永军\",\"phone\":\"139-8855-8922\"},{\"name\":\"途家、小先\",\"phone\":\"159-2802-1625\"},{\"name\":\"陶文军客人\",\"phone\":\"138-8808-7240\"},{\"name\":\"王教练\",\"phone\":\"138-4408-4091\"},{\"name\":\"颜老板\",\"phone\":\"139-8728-8528\"},{\"name\":\"王艳艳\",\"phone\":\"138-8867-8675\"},{\"name\":\"新村路快客\",\"phone\":\"56350618\"},{\"name\":\"赵婷\",\"phone\":\"186-8726-1890\"},{\"name\":\"张兰\",\"phone\":\"152-8725-9188\"},{\"name\":\"夏铃客人\",\"phone\":\"139-8766-7049\"},{\"name\":\"杨子 上海\",\"phone\":\"18516669000\"},{\"name\":\"朱昆朋\",\"phone\":\"159-0040-9264\"},{\"name\":\"洗碗蔡大哥\",\"phone\":\"136-3631-8462\"},{\"name\":\"艺龙杨爱玲\",\"phone\":\"183-8719-4959\"},{\"name\":\"田路曼BM\",\"phone\":\"150-0068-0557\"},{\"name\":\"赵小飞\",\"phone\":\"183-2190-9298\"},{\"name\":\"租这儿\",\"phone\":\"400-050-8506\"},{\"name\":\"张医生\",\"phone\":\"157-5021-1314\"},{\"name\":\"张婷婷\",\"phone\":\"139-4491-0766\"},{\"name\":\"S2訾雪琴\",\"phone\":\"183-0196-8696\"},{\"name\":\"小屁孩\",\"phone\":\"137 5774 4064\"},{\"name\":\"钟点工\",\"phone\":\"135-7541-4068\"},{\"name\":\"于海客人\",\"phone\":\"186-1536-2197\"},{\"name\":\"薛桂英\",\"phone\":\"135-6475-8221\"},{\"name\":\"猪猪\",\"phone\":\"18656609999\"},{\"name\":\"艺龙朱\",\"phone\":\"138-8845-6037\"},{\"name\":\"尹健腾BM\",\"phone\":\"159-2118-1097\"},{\"name\":\"湘粤山庄\",\"phone\":\"60560117\"},{\"name\":\"卫生监督所\",\"phone\":\"0872-2512364\"},{\"name\":\"途家网\",\"phone\":\"400-188-1234\"},{\"name\":\"小宇\",\"phone\":\"138-8804-4205\"},{\"name\":\"途家网,房态\",\"phone\":\"185-8418-1018\"},{\"name\":\"吴怡华\",\"phone\":\"15287185391\"},{\"name\":\"汪雪玲\",\"phone\":\"136-6599-6162\"},{\"name\":\"英英\",\"phone\":\"13636409096\"},{\"name\":\"杨河峨眉\",\"phone\":\"159-8338-8067\"},{\"name\":\"微微 长春\",\"phone\":\"17790066605\"},{\"name\":\"饮料\",\"phone\":\"138-1840-4903\"},{\"name\":\"星期一订房\",\"phone\":\"133-7837-4729\"},{\"name\":\"小方\",\"phone\":\"183-0210-0664\"},{\"name\":\"左建安\",\"phone\":\"139-0872-3049\"},{\"name\":\"王浩客人\",\"phone\":\"135-0947-7977\"},{\"name\":\"杨洪英\",\"phone\":\"139-8850-4628\"},{\"name\":\"温州_飞哥跑腿\",\"phone\":\"0577-88655570\"},{\"name\":\"S2冯亮\",\"phone\":\"136-5175-0210\"},{\"name\":\"niuniu老板娘\",\"phone\":\"15990714857\"},{\"name\":\"唐肥啊丽\",\"phone\":\"189-8724-1890\"},{\"name\":\"祥云小周\",\"phone\":\"135-2972-2026\"},{\"name\":\"夏\",\"phone\":\"130-1375-3588\"},{\"name\":\"子函\",\"phone\":\"151-4171-4077\"},{\"name\":\"微微\",\"phone\":\"186-0872-3562\"},{\"name\":\"张学标\",\"phone\":\"187-8721-4706\"},{\"name\":\"王冰幸运草\",\"phone\":\"139-8713-4906\"},{\"name\":\"徐俊BM\",\"phone\":\"138-1709-2863\"},{\"name\":\"箫簦怀\",\"phone\":\"139-8855-2316\"},{\"name\":\"赵心\",\"phone\":\"138-6832-3609\"},{\"name\":\"小敏\",\"phone\":\"135-0577-2727\"},{\"name\":\"汪平\",\"phone\":\"+8613916358843\"},{\"name\":\"新运大厦烧烤外卖\",\"phone\":\"158-0031-5178\"},{\"name\":\"粥\",\"phone\":\"187-2172-2778\"},{\"name\":\"乐山\",\"phone\":\"151-8338-3462\"},{\"name\":\"小磊\",\"phone\":\"13661411688\"},{\"name\":\"郑老师\",\"phone\":\"139-1748-1325\"},{\"name\":\"张弟林散K\",\"phone\":\"135-2488-7031\"},{\"name\":\"徐忠\",\"phone\":\"139-8138-5259\"},{\"name\":\"网站\",\"phone\":\"0872-2444720\"},{\"name\":\"王中立BM\",\"phone\":\"136-2196-9765\"},{\"name\":\"^_^丹\",\"phone\":\"+8613759533727\"},{\"name\":\"铜川路福林\",\"phone\":\"186-0215-6997\"},{\"name\":\"粥店\",\"phone\":\"62321887\"},{\"name\":\"中亚'吴\",\"phone\":\"139-1805-2530\"},{\"name\":\"杨双华\",\"phone\":\"139-8720-7980\"},{\"name\":\"金家美容\",\"phone\":\"15967799968\"},{\"name\":\"11\",\"phone\":\"13644409950\"},{\"name\":\"王订房\",\"phone\":\"152-1000-6008\"},{\"name\":\"小玉中亚\",\"phone\":\"13818071907\"},{\"name\":\"娃娃\",\"phone\":\"131-8079-1840\"},{\"name\":\"钟兴荣\",\"phone\":\"139-8855-5868\"},{\"name\":\"小学童鞋\",\"phone\":\"189-1001-8331\"},{\"name\":\"S2吴海虎\",\"phone\":\"150-0073-7374\"},{\"name\":\"王锦霞\",\"phone\":\"135-2462-0894\"},{\"name\":\"S2陶彦敏\",\"phone\":\"+8615821158106\"},{\"name\":\"杨新燕\",\"phone\":\"136-5872-1984\"},{\"name\":\"丝芙兰丹华\",\"phone\":\"139-5770-9706\"},{\"name\":\"小学童鞋?林\",\"phone\":\"18669049375\"},{\"name\":\"小黑 潘洋\",\"phone\":\"13944153777\"},{\"name\":\"韦秋群\",\"phone\":\"187-7665-5777\"},{\"name\":\"小红\",\"phone\":\"65162\"},{\"name\":\"S2收银李下妹\",\"phone\":\"139-6091-5988\"},{\"name\":\"王小龙\",\"phone\":\"183-2135-4321\"},{\"name\":\"周昊\",\"phone\":\"185-2057-0285\"},{\"name\":\"赵飞亲家\",\"phone\":\"159-1266-1829\"},{\"name\":\"中华田园犬\",\"phone\":\"180-1758-1133\"},{\"name\":\"友\",\"phone\":\"13817878666\"},{\"name\":\"王雄芳名嚼\",\"phone\":\"151-8722-6359\"},{\"name\":\"张正军\",\"phone\":\"137-0866-1106\"},{\"name\":\"吴仓伍\",\"phone\":\"155-0217-7073\"},{\"name\":\"郑总\",\"phone\":\"139-0880-3182\"},{\"name\":\"鞋\",\"phone\":\"32520027\"},{\"name\":\"夏医生\",\"phone\":\"136-8172-1287\"},{\"name\":\"王叶\",\"phone\":\"15877977029\"},{\"name\":\"牙科\",\"phone\":\"02169524999\"},{\"name\":\"百草芳香 店长\",\"phone\":\"15857707362\"},{\"name\":\"唐娥\",\"phone\":\"189-0872-1005\"},{\"name\":\"痛风刘医生\",\"phone\":\"135-1891-6987\"},{\"name\":\"小的\",\"phone\":\"+8613806892637\"},{\"name\":\"吴保钱\",\"phone\":\"158-2158-1181\"},{\"name\":\"魏山小张\",\"phone\":\"135-7727-5996\"},{\"name\":\"张医生\",\"phone\":\"151-2525-3540\"},{\"name\":\"文静姐\",\"phone\":\"138-5775-4596\"},{\"name\":\"S2管延臣\",\"phone\":\"152-1666-2234\"},{\"name\":\"支票\",\"phone\":\"138-1731-7613\"},{\"name\":\"洋葱\",\"phone\":\"139-1704-6670\"},{\"name\":\"太阳能叶榆路\",\"phone\":\"159-1122-0895\"},{\"name\":\"小小姐姐\",\"phone\":\"+8613858801525\"},{\"name\":\"心内科\",\"phone\":\"0872-2669272\"},{\"name\":\"王义\",\"phone\":\"189-4660-9039\"},{\"name\":\"杨庆润\",\"phone\":\"139-8722-0955\"},{\"name\":\"王晓燕\",\"phone\":\"137-6901-0046\"},{\"name\":\"吴老师中亚\",\"phone\":\"65213\"},{\"name\":\"王蒙\",\"phone\":\"+8613795324783\"},{\"name\":\"杨静BM企划\",\"phone\":\"139-1600-2372\"},{\"name\":\"小雪\",\"phone\":\"18608855249\"},{\"name\":\"唐洪鑫BM\",\"phone\":\"134-7278-6938\"},{\"name\":\"邮局\",\"phone\":\"56618540\"},{\"name\":\"王子\",\"phone\":\"136-3635-9331\"},{\"name\":\"吴洁霞广西\",\"phone\":\"156-0783-8086\"},{\"name\":\"张继龙\",\"phone\":\"182-0501-4567\"},{\"name\":\"赵勇\",\"phone\":\"186-1688-6176\"},{\"name\":\"赵\",\"phone\":\"139-5771-7700\"},{\"name\":\"S2王姗姗\",\"phone\":\"137-6410-6559\"},{\"name\":\"徐苗东东\",\"phone\":\"135-8557-5315\"},{\"name\":\"小曼\",\"phone\":\"139-1890-0331\"},{\"name\":\"游天下\",\"phone\":\"400-630-0088\"},{\"name\":\"武洪\",\"phone\":\"139-8720-4617\"},{\"name\":\"张利娟A\",\"phone\":\"189-8720-9055\"},{\"name\":\"校长\",\"phone\":\"135-9646-7480\"},{\"name\":\"物供BM\",\"phone\":\"139-1668-5647\"},{\"name\":\"小胖子\",\"phone\":\"159-6742-4547\"},{\"name\":\"S2高英杰\",\"phone\":\"159-2134-2345\"},{\"name\":\"左建林\",\"phone\":\"186-8729-9671\"},{\"name\":\"彤彤\",\"phone\":\"15045368886\"},{\"name\":\"谢定房\",\"phone\":\"139-8146-1223\"},{\"name\":\"郑有虎\",\"phone\":\"139-8854-3779\"},{\"name\":\"郑敏\",\"phone\":\"13806686811\"},{\"name\":\"小南BM\",\"phone\":\"135-2408-8891\"},{\"name\":\"昆明微整医生\",\"phone\":\"136-4886-5527\"},{\"name\":\"小小白\",\"phone\":\"13818010555\"},{\"name\":\"杨静\",\"phone\":\"139-1600-2372\"},{\"name\":\"途家、李\",\"phone\":\"138-8078-7486\"},{\"name\":\"租房\",\"phone\":\"130-4660-7528\"},{\"name\":\"阿峰\",\"phone\":\"18857710610\"},{\"name\":\"唐肥\",\"phone\":\"0872-2674776\"},{\"name\":\"徐建华\",\"phone\":\"136-0882-1269\"},{\"name\":\"张菊\",\"phone\":\"138-8874-4860\"},{\"name\":\"消防段超泼\",\"phone\":\"135-7707-7730\"},{\"name\":\"余有刚\",\"phone\":\"138-8722-3533\"},{\"name\":\"徐\",\"phone\":\"130-0317-0013\"},{\"name\":\"张斐\",\"phone\":\"136-5163-3012\"},{\"name\":\"游大清\",\"phone\":\"133-8872-1899\"},{\"name\":\"夏BM\",\"phone\":\"+8613788932400\"},{\"name\":\"王阿姨\",\"phone\":\"137-6485-5133\"},{\"name\":\"小麦\",\"phone\":\"188-1652-8134\"},{\"name\":\"小霞\",\"phone\":\"138-8821-0280\"},{\"name\":\"小钟\",\"phone\":\"135-7839-1924\"},{\"name\":\"王娟\",\"phone\":\"189-8723-1208\"},{\"name\":\"S2韩小悠\",\"phone\":\"138-1678-0620\"},{\"name\":\"姚佳\",\"phone\":\"15821753533\"},{\"name\":\"铜川路海鲜\",\"phone\":\"131-6607-3083\"},{\"name\":\"杨剑彬\",\"phone\":\"136-0882-0190\"},{\"name\":\"S2石泓宇\",\"phone\":\"151-3695-3697\"},{\"name\":\"小明\",\"phone\":\"186-5992-7337\"},{\"name\":\"杨亚奇\",\"phone\":\"181-0390-8559\"},{\"name\":\"薇薇\",\"phone\":\"180-4971-9343\"},{\"name\":\"王艳茁\",\"phone\":\"138-1236-5555\"},{\"name\":\"张孔燕\",\"phone\":\"139-8856-1135\"},{\"name\":\"杨双龙海月弯\",\"phone\":\"182-0699-5052\"},{\"name\":\"小峰\",\"phone\":\"135-8551-4820\"},{\"name\":\"圆圆\",\"phone\":\"137-6193-9771\"},{\"name\":\"张堂平\",\"phone\":\"138-8138-3059\"},{\"name\":\"中亚餐长\",\"phone\":\"13501813592\"},{\"name\":\"途家订房\",\"phone\":\"139-9903-3407\"},{\"name\":\"\",\"phone\":\"13761370093\"},{\"name\":\"甜,广告\",\"phone\":\"13099999956\"},"
+ "{\"name\":\"杨琼\",\"phone\":\"137-6122-9262\"},{\"name\":\"朱琳琳\",\"phone\":\"132-1178-7844\"},{\"name\":\"于\",\"phone\":\"153-0896-9725\"},{\"name\":\"姨\",\"phone\":\"139-8855-7775\"},"
+ "{\"name\":\"小朱\",\"phone\":\"133-6188-7352\"},{\"name\":\"雪\",\"phone\":\"0871-8241107\"},{\"name\":\"温州跑腿\",\"phone\":\"13738746998\"},{\"name\":\"张敏\",\"phone\":\"187-6093-0020\"},{\"name\":\"赵磊\",\"phone\":\"159-0053-4444\"},{\"name\":\"S2王亚萍\",\"phone\":\"187-2161-2481\"},{\"name\":\"翁昌永\",\"phone\":\"137-6900-0552\"},{\"name\":\"文豪\",\"phone\":\"139-8854-3111\"},{\"name\":\"张澍\",\"phone\":\"62002\"},{\"name\":\"严四平\",\"phone\":\"135-7726-3726\"},{\"name\":\"曾厝按\",\"phone\":\"18959209787\"},{\"name\":\"太极大厦大房间介绍的\",\"phone\":\"152-2171-2259\"},{\"name\":\"王成兵\",\"phone\":\"139-8729-0438\"},{\"name\":\"S2金健亮\",\"phone\":\"150-0197-3512\"},{\"name\":\"雅\",\"phone\":\"138-1827-2100\"},{\"name\":\"于景刚\",\"phone\":\"130-1911-7077\"},{\"name\":\"韵达\",\"phone\":\"95546\"},{\"name\":\"\",\"phone\":\"057725694093\"},{\"name\":\"小欢\",\"phone\":\"138-5770-0797\"},{\"name\":\"S2杨一伟\",\"phone\":\"135-6416-8205\"},{\"name\":\"王槐艳\",\"phone\":\"130-3862-9666\"},{\"name\":\"徐帅杰BM\",\"phone\":\"137-6126-3802\"},{\"name\":\"朱雨莲\",\"phone\":\"13761162762\"},{\"name\":\"王老师\",\"phone\":\"130-0911-2261\"},{\"name\":\"张广磊BM\",\"phone\":\"137-6116-3227\"},{\"name\":\"自秀平\",\"phone\":\"180-8720-1378\"},{\"name\":\"香油\",\"phone\":\"400-023-0258\"},{\"name\":\"悠悠BM\",\"phone\":\"156-4323-4447\"},{\"name\":\"Vito\",\"phone\":\"139-1616-6300\"},{\"name\":\"杨洪\",\"phone\":\"158-9450-3810\"},{\"name\":\"\",\"phone\":\"13587419374\"},{\"name\":\"照片\",\"phone\":\"021-61475612\"},{\"name\":\"S2柯老师\",\"phone\":\"135-6462-3347\"},{\"name\":\"S2史彦杰\",\"phone\":\"137-9525-6185\"},{\"name\":\"杨凯二逼\",\"phone\":\"187-5409-7668\"},{\"name\":\"蟹庄顾老板\",\"phone\":\"150-5021-2392\"},{\"name\":\"王若冰\",\"phone\":\"135-8591-9058\"},{\"name\":\"3S美甲\",\"phone\":\"13676705404\"},{\"name\":\"朱新红\",\"phone\":\"156-0144-8888\"},{\"name\":\"杨老板\",\"phone\":\"139-1759-2055\"},{\"name\":\"瑶瑶\",\"phone\":\"18687900825\"},{\"name\":\"小彤!\",\"phone\":\"186-2150-0980\"},{\"name\":\"袁祥BM\",\"phone\":\"138-1651-6247\"},{\"name\":\"小青\",\"phone\":\"13524255352\"},{\"name\":\"谭馨惠\",\"phone\":\"182-8811-8333\"},{\"name\":\"张波\",\"phone\":\"182-1334-9171\"},{\"name\":\"小雨朋友,箫\",\"phone\":\"152-8885-3390\"},{\"name\":\"蟹客-潘??\",\"phone\":\"137-5602-1052\"},{\"name\":\"腾越老总\",\"phone\":\"133-0872-8803\"},{\"name\":\"张红\",\"phone\":\"189-8398-6504\"},{\"name\":\"小路\",\"phone\":\"159-0090-1637\"},{\"name\":\"显真美甲\",\"phone\":\"13806548787\"},{\"name\":\"徐苗\",\"phone\":\"150-0046-8916\"},{\"name\":\"新南华\",\"phone\":\"021-62278777\"},{\"name\":\"杨槐敏\",\"phone\":\"186-0872-2199\"},{\"name\":\"云南菜\",\"phone\":\"62100768\"},{\"name\":\"\",\"phone\":\"0571-82573952\"},{\"name\":\"张拉土\",\"phone\":\"133-2055-5222\"},{\"name\":\"张晨瑶客人\",\"phone\":\"130-1174-5555\"},{\"name\":\"小吕\",\"phone\":\"151-8728-0626\"},{\"name\":\"徐阿姨\",\"phone\":\"183-6860-2737\"},{\"name\":\"微微\",\"phone\":\"150-4307-0339\"},{\"name\":\"闫立国大众点评\",\"phone\":\"189-0872-4571\"},{\"name\":\"S2王晶斌\",\"phone\":\"130-2320-5331\"},{\"name\":\"携程网\",\"phone\":\"021-61136666\"},{\"name\":\"小猪短租\",\"phone\":\"400-018-3100\"},{\"name\":\"谢克颜Sky\",\"phone\":\"150-2141-5808\"},{\"name\":\"周旭\",\"phone\":\"159-0097-5997\"},{\"name\":\"苏梅\",\"phone\":\"13968854876\"},{\"name\":\"S2王岩岩\",\"phone\":\"156-1852-5858\"},{\"name\":\"中介五点半长寿路\",\"phone\":\"152-2139-5935\"},{\"name\":\"熊天宝\",\"phone\":\"158-9450-5589\"},{\"name\":\"杨梅,伴\",\"phone\":\"139-8723-0958\"},{\"name\":\"中甸客人\",\"phone\":\"139-8877-5344\"},{\"name\":\"杨蓉昆明\",\"phone\":\"152-8830-7068\"},{\"name\":\"王开蕾\",\"phone\":\"139-8850-9333\"},{\"name\":\"易礼勇\",\"phone\":\"130-1339-9093\"},{\"name\":\"许老乡\",\"phone\":\"189-8721-5268\"},{\"name\":\"杨咏琦\",\"phone\":\"186-8776-7870\"},{\"name\":\"婷婷K\",\"phone\":\"150-0020-8318\"},{\"name\":\"王海东Sky\",\"phone\":\"183-2114-8188\"},{\"name\":\"许亚浩\",\"phone\":\"182-0185-0570\"},{\"name\":\"\",\"phone\":\"021-54322021\"},{\"name\":\"乐宝堡\",\"phone\":\"56351202\"},{\"name\":\"张义刚\",\"phone\":\"150-2187-9056\"},{\"name\":\"张明月S2\",\"phone\":\"135-8581-2225\"},{\"name\":\"夏天\",\"phone\":\"150-0026-3084\"},{\"name\":\"杨君\",\"phone\":\"189-0872-0819\"},{\"name\":\"S2梅禹\",\"phone\":\"131-9962-3222\"},{\"name\":\"SS\",\"phone\":\"186-2182-1195\"},{\"name\":\"乐透。小宇\",\"phone\":\"13943053321\"},{\"name\":\"汪雨\",\"phone\":\"13608855590\"},{\"name\":\"王文杰\",\"phone\":\"13321549958\"},{\"name\":\"药材\",\"phone\":\"138-8729-3594\"},{\"name\":\"小赫。潘洋\",\"phone\":\"155-9052-0855\"},{\"name\":\"小金\",\"phone\":\"137-6165-1053\"},{\"name\":\"张丹水电\",\"phone\":\"139-8720-2250\"},{\"name\":\"洗衣机修\",\"phone\":\"133-2055-9093\"},{\"name\":\"赵亮\",\"phone\":\"136-2969-2723\"},{\"name\":\"扬扬BM\",\"phone\":\"139-1714-6432\"},{\"name\":\"小阿姨\",\"phone\":\"13918052902\"},{\"name\":\"sxd\",\"phone\":\"3\"},{\"name\":\"汪雨\",\"phone\":\"18687026826\"},{\"name\":\"移动通客户杨静\",\"phone\":\"136-0882-9686\"},{\"name\":\"wi-Fi\",\"phone\":\"189-1780-4755\"},{\"name\":\"尹建\",\"phone\":\"182-2193-6681\"},{\"name\":\"余红光\",\"phone\":\"135-0882-0646\"},{\"name\":\"游天下昆明\",\"phone\":\"186-6904-5733\"},{\"name\":\"谢勇\",\"phone\":\"13764841811\"},{\"name\":\"尹健\",\"phone\":\"182-6034-9511\"},{\"name\":\"S2喻林\",\"phone\":\"159-0040-5900\"},{\"name\":\"杨瑞彪\",\"phone\":\"133-2055-1383\"},{\"name\":\"王小东\",\"phone\":\"150-0000-6419\"},{\"name\":\"小孙啊洪\",\"phone\":\"139-8722-8941\"},{\"name\":\"雅馨纹绣\",\"phone\":\"18967797828\"},{\"name\":\"小周媳妇\",\"phone\":\"153-9868-2567\"},{\"name\":\"忧忧\",\"phone\":\"183-2169-0571\"},{\"name\":\"Sunny Zhu\",\"phone\":\"138-1889-8043\"},{\"name\":\"尹艳\",\"phone\":\"131-6278-9893\"},{\"name\":\"张继龙长春\",\"phone\":\"138-4486-5558\"},{\"name\":\"S2胡小娇\",\"phone\":\"136-4168-8743\"},{\"name\":\"陈 光明\",\"phone\":\"13250883877\"},{\"name\":\"杨光惠\",\"phone\":\"139-8727-5462\"},{\"name\":\"王红晓客人\",\"phone\":\"182-5823-3421\"},{\"name\":\"爷爷\",\"phone\":\"13705777558\"},{\"name\":\"吴蓉蓉BM\",\"phone\":\"182-2114-1439\"},{\"name\":\"王洋\",\"phone\":\"138-1616-4334\"},{\"name\":\"小张\",\"phone\":\"139-8729-8215\"},{\"name\":\"王志东\",\"phone\":\"138-0876-9005\"},{\"name\":\"小叶\",\"phone\":\"159-0872-6254\"},{\"name\":\"S2巡场总监Alla\",\"phone\":\"138-1733-0884\"},{\"name\":\"王总\",\"phone\":\"138-1878-4888\"},{\"name\":\"S2岳邦彩\",\"phone\":\"185-0156-3424\"},{\"name\":\"曾 阳澄湖\",\"phone\":\"13218181881\"},{\"name\":\"张小威\",\"phone\":\"133-3175-9055\"},{\"name\":\"王飞翔BM\",\"phone\":\"187-1785-6283\"},{\"name\":\"S2孔令志\",\"phone\":\"182-5688-2822\"},{\"name\":\"S2刘城\",\"phone\":\"134-8281-9991\"},{\"name\":\"左淑君\",\"phone\":\"159-1219-7662\"},{\"name\":\"我们家客栈\",\"phone\":\"180-0872-2495\"},{\"name\":\"S2小于\",\"phone\":\"187-0170-2770\"},{\"name\":\"游多多\",\"phone\":\"021-33977770\"},{\"name\":\"赵佳齐\",\"phone\":\"13160776000\"},{\"name\":\"王冠\",\"phone\":\"139-8725-7577\"},{\"name\":\"张勇丽\",\"phone\":\"180-8687-9858\"},{\"name\":\"S2总部财会\",\"phone\":\"136-7151-9620\"},{\"name\":\"赵梦那租房\",\"phone\":\"138-0874-4116\"},{\"name\":\"张家花园\",\"phone\":\"0872-2684000\"},{\"name\":\"萧大壮\",\"phone\":\"187-2178-0265\"},{\"name\":\"朱玉梅\",\"phone\":\"186-8728-7866\"},{\"name\":\"S2简勤勤\",\"phone\":\"137-6499-7514\"},{\"name\":\"王建\",\"phone\":\"135-7789-9075\"},{\"name\":\"妍妍\",\"phone\":\"137-7771-1907\"},{\"name\":\"中介\",\"phone\":\"136-3658-0395\"},{\"name\":\"S2李娇\",\"phone\":\"150-0211-0656\"},{\"name\":\"杨艳\",\"phone\":\"139-8854-0550\"},{\"name\":\"张源\",\"phone\":\"13816458785\"},{\"name\":\"魏仁富\",\"phone\":\"139-8853-0599\"},{\"name\":\"\",\"phone\":\"10655059113144\"},{\"name\":\"杨文松\",\"phone\":\"139-8726-1461\"},{\"name\":\"王鹃\",\"phone\":\"62007\"},{\"name\":\"西安\",\"phone\":\"137-8895-1585\"},{\"name\":\"Sammi\",\"phone\":\"138-1610-5907\"},{\"name\":\"印商标黄\",\"phone\":\"136-1179-5393\"},{\"name\":\"张源一\",\"phone\":\"18507026713\"},{\"name\":\"谭哥\",\"phone\":\"150-5428-0016\"},{\"name\":\"S2于怀玉\",\"phone\":\"135-1213-2937\"},{\"name\":\"小张 温州\",\"phone\":\"186-5777-0770\"},{\"name\":\"张敏\",\"phone\":\"136-5888-2774\"},{\"name\":\"王蓓蓓BM\",\"phone\":\"152-2111-6304\"},{\"name\":\"S2肖纯\",\"phone\":\"159-2177-5142\"},{\"name\":\"小姑娘\",\"phone\":\"18601707093\"},{\"name\":\"S2吴一鸣\",\"phone\":\"182-2170-0360\"},{\"name\":\"S2周维龙\",\"phone\":\"159-0181-6884\"},{\"name\":\"游船啊霞\",\"phone\":\"137-9624-9020\"},{\"name\":\"途家网\",\"phone\":\"189-8173-0888\"},{\"name\":\"S2武国锐\",\"phone\":\"135-2430-0485\"},{\"name\":\"王伟\",\"phone\":\"150-0089-3690\"},{\"name\":\"周 散客\",\"phone\":\"180-5262-6600\"},{\"name\":\"唐玲\",\"phone\":\"137-6119-7774\"},{\"name\":\"应聘\",\"phone\":\"130-1282-5758\"},{\"name\":\"徐炳\",\"phone\":\"139-8856-6078\"},{\"name\":\"王有纲\",\"phone\":\"139-1686-4247\"},{\"name\":\"吴丹\",\"phone\":\"182-5668-2500\"},{\"name\":\"张丽平\",\"phone\":\"153-8652-6588\"},{\"name\":\"杨水电\",\"phone\":\"139-8728-5487\"},{\"name\":\"文捷\",\"phone\":\"13099429107\"},{\"name\":\"自己\",\"phone\":\"18351030407\"},{\"name\":\"王小磊\",\"phone\":\"157-1440-3145\"},{\"name\":\"王兰BM\",\"phone\":\"158-0098-7760\"},{\"name\":\"阴新影客人\",\"phone\":\"139-3394-0518\"},{\"name\":\"郑、普陀泉\",\"phone\":\"187-0888-7336\"},{\"name\":\"张佳梅子\",\"phone\":\"147-9012-3237\"},{\"name\":\"小沈法院\",\"phone\":\"135-7788-9990\"},{\"name\":\"张鉴琪跑车的\",\"phone\":\"135-2965-7089\"},{\"name\":\"殷语茗\",\"phone\":\"134-6433-3288\"},{\"name\":\"中通\",\"phone\":\"39777777\"},{\"name\":\"小苹果\",\"phone\":\"189-1669-2350\"},{\"name\":\"新电话\",\"phone\":\"153-6829-4718\"},{\"name\":\"王娟\",\"phone\":\"183-1425-6778\"},{\"name\":\"张燕大庄\",\"phone\":\"139-8720-0124\"},{\"name\":\"王欢欢,六十医院\",\"phone\":\"137-9774-9105\"},{\"name\":\"杨子\",\"phone\":\"139-1704-6670\"},{\"name\":\"S2王士东\",\"phone\":\"137-9523-2792\"},{\"name\":\"yanyan\",\"phone\":\"13424439411\"},{\"name\":\"S2叶欢\",\"phone\":\"+8615021283007\"},{\"name\":\"王乐\",\"phone\":\"136-0181-8800\"},{\"name\":\"小爱\",\"phone\":\"150-0049-6818\"},{\"name\":\"兄弟修车\",\"phone\":\"138-8721-5536\"},{\"name\":\"小警察??\",\"phone\":\"18657770770\"},{\"name\":\"中亚小路司机\",\"phone\":\"13671744493\"},{\"name\":\"余然\",\"phone\":\"+86 138-1621-4825\"},{\"name\":\"S2周敏\",\"phone\":\"186-5259-7186\"},{\"name\":\"闫继强BM\",\"phone\":\"136-8196-9911\"},{\"name\":\"王\",\"phone\":\"138-2099-1385\"},{\"name\":\"徐勇\",\"phone\":\"135-7729-2699\"},{\"name\":\"姚丹娜\",\"phone\":\"139-4304-9422\"},{\"name\":\"张芳\",\"phone\":\"139-2476-8825\"},{\"name\":\"S2小冉\",\"phone\":\"150-0021-7027\"},{\"name\":\"王丽\",\"phone\":\"138-8729-7754\"},{\"name\":\"尊10月31标准间\",\"phone\":\"188-5386-0677\"},{\"name\":\"颜谭江\",\"phone\":\"130-9984-0198\"},{\"name\":\"杨咏琪\",\"phone\":\"157-0695-6533\"},{\"name\":\"携程可娴\",\"phone\":\"180-8729-4852\"},{\"name\":\"小苹果??\",\"phone\":\"189-1669-2350\"},{\"name\":\"向应网\",\"phone\":\"189-7891-5272\"},{\"name\":\"S2殷仔\",\"phone\":\"187-0175-4556\"},{\"name\":\"游天下客户经\",\"phone\":\"137-1869-1664\"},{\"name\":\"周兰芬\",\"phone\":\"130-8740-5477\"},{\"name\":\"S2朱双双\",\"phone\":\"187-0185-4912\"},{\"name\":\"同程王惠子,\",\"phone\":\"0512-80990735\"},{\"name\":\"向阳花,张\",\"phone\":\"139-8721-4966\"},{\"name\":\"朱梅\",\"phone\":\"152-8721-3633\"},{\"name\":\"温总\",\"phone\":\"186-1629-1139\"},{\"name\":\"杨俊\",\"phone\":\"137-0866-8872\"},{\"name\":\"医保卡\",\"phone\":\"0872-2122629\"},{\"name\":\"S2王浩\",\"phone\":\"182-2123-0720\"},{\"name\":\"途家王灿娜\",\"phone\":\"181-1308-8225\"},{\"name\":\"易茗珠\",\"phone\":\"139-8220-8800\"},{\"name\":\"文婧\",\"phone\":\"136-7874-8838\"},{\"name\":\"朱皓\",\"phone\":\"13391226333\"},{\"name\":\"小霞E\",\"phone\":\"136-4757-3005\"},{\"name\":\"王纪林中亚\",\"phone\":\"135-8588-9873\"},{\"name\":\"小梁\",\"phone\":\"186-8723-1208\"},{\"name\":\"张麟BM\",\"phone\":\"186-0391-3857\"},{\"name\":\"退房\",\"phone\":\"139-1725-1980\"},{\"name\":\"仙\",\"phone\":\"187-6090-5233\"},{\"name\":\"温州饭馆\",\"phone\":\"02162661506\"},{\"name\":\"姚恋\",\"phone\":\"139-8725-0338\"},{\"name\":\"13577242788\",\"phone\":\"\"},{\"name\":\"S2小胖\",\"phone\":\"150-2680-1323\"},{\"name\":\"张春竹\",\"phone\":\"135-1872-0271\"},{\"name\":\"修电脑\",\"phone\":\"150-6789-2670\"},{\"name\":\"小雪。纠纠\",\"phone\":\"137-1515-3150\"},{\"name\":\"S2张楠楠\",\"phone\":\"138-1715-4946\"},{\"name\":\"S2方扬航\",\"phone\":\"186-5160-3097\"},{\"name\":\"赵娥\",\"phone\":\"139-8727-6173\"},{\"name\":\"袁园\",\"phone\":\"158-2319-4055\"},{\"name\":\"携程\",\"phone\":\"0871-63109935\"},"
+ "{\"name\":\"温一国\",\"phone\":\"138-0661-5551\"}]}");
hr.run();
}
@Override
public void run() {
System.out.println("开始时间:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
PrintWriter out = null;
BufferedReader in = null;
String result = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ0eXAiOiJKV1QifQ.eyJqdGkiOiI5MTI2ZDQ0NTI3YWY0NWI2ODM2OTM1YWZhOWZmMTVkNSIsInN1YiI6ImJlc3RidXktYWNjZXB0YW5jZSIsImF1dGhvcml0aWVzIjpbImNsaWVudHMucmVhZCIsInVhYS5yZXNvdXJjZSIsImJlc3RidXktYWNjZXB0YW5jZS5hcGkiLCJmYWN0b3Jpbmctc2VydmVyLmFwaSIsInB1aHVpLW5vdGlmaWNhdGlvbi1zZXJ2ZXIuYXBpIiwicHVodWktc2lnbi1zZXJ2ZXItcmVzdGZ1bC5hcGkiLCJwdWh1aS1zZXR0bGVtZW50LWNsb3VkLXNlcnZlci5hcGkiLCJjcmVkaXQtcXVlcnkuYXBpIl0sInNjb3BlIjpbImNsaWVudHMucmVhZCIsInVhYS5yZXNvdXJjZSIsImJlc3RidXktYWNjZXB0YW5jZS5hcGkiLCJmYWN0b3Jpbmctc2VydmVyLmFwaSIsInB1aHVpLW5vdGlmaWNhdGlvbi1zZXJ2ZXIuYXBpIiwicHVodWktc2lnbi1zZXJ2ZXItcmVzdGZ1bC5hcGkiLCJwdWh1aS1zZXR0bGVtZW50LWNsb3VkLXNlcnZlci5hcGkiLCJjcmVkaXQtcXVlcnkuYXBpIl0sImNsaWVudF9pZCI6ImJlc3RidXktYWNjZXB0YW5jZSIsImNpZCI6ImJlc3RidXktYWNjZXB0YW5jZSIsImF6cCI6ImJlc3RidXktYWNjZXB0YW5jZSIsImdyYW50X3R5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJyZXZfc2lnIjoiODU0MGNmNWQiLCJpYXQiOjE0ODc1ODI5ODMsImV4cCI6MTQ4NzYyNjE4MywiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MDgwL3VhYS9vYXV0aC90b2tlbiIsInppZCI6InVhYSIsImF1ZCI6WyJiZXN0YnV5LWFjY2VwdGFuY2UiLCJjbGllbnRzIiwidWFhIiwiZmFjdG9yaW5nLXNlcnZlciIsInB1aHVpLW5vdGlmaWNhdGlvbi1zZXJ2ZXIiLCJwdWh1aS1zaWduLXNlcnZlci1yZXN0ZnVsIiwicHVodWktc2V0dGxlbWVudC1jbG91ZC1zZXJ2ZXIiLCJjcmVkaXQtcXVlcnkiXX0.pmCKp9XMq72z1yqKdcCHSPWilQ4FVzKqprDdNTkAX3M");
conn.setRequestProperty("Content-Type", "application/json");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
out.print(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result += line;
result += "\r\n";
}
} catch (Exception e) {
System.out.println("发送 POST 请求出现异常!"+e);
e.printStackTrace();
}
//使用finally块来关闭输出流、输入流
finally{
try{
if(out!=null){
out.close();
}
if(in!=null){
in.close();
}
}
catch(IOException ex){
ex.printStackTrace();
}
}
try {
result = new String(result.getBytes(),"utf-8");
System.out.println(result+"结束时间:"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package test;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
public class HttpUtils {
/**
* get
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doGet(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpGet request = new HttpGet(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
/**
* post form
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param bodys
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
Map<String, String> bodys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (bodys != null) {
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
for (String key : bodys.keySet()) {
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
}
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
request.setEntity(formEntity);
}
return httpClient.execute(request);
}
/**
* Post String
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Post stream
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Put String
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Put stream
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
StringBuilder sbUrl = new StringBuilder();
sbUrl.append(host);
if (!StringUtils.isBlank(path)) {
sbUrl.append(path);
}
if (null != querys) {
StringBuilder sbQuery = new StringBuilder();
for (Map.Entry<String, String> query : querys.entrySet()) {
if (0 < sbQuery.length()) {
sbQuery.append("&");
}
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
sbQuery.append(query.getValue());
}
if (!StringUtils.isBlank(query.getKey())) {
sbQuery.append(query.getKey());
if (!StringUtils.isBlank(query.getValue())) {
sbQuery.append("=");
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
}
}
}
if (0 < sbQuery.length()) {
sbUrl.append("?").append(sbQuery);
}
}
return sbUrl.toString();
}
private static HttpClient wrapClient(String host) {
HttpClient httpClient = new DefaultHttpClient();
if (host.startsWith("https://")) {
sslClient(httpClient);
}
return httpClient;
}
private static void sslClient(HttpClient httpClient) {
try {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] xcs, String str) {
}
public void checkServerTrusted(X509Certificate[] xcs, String str) {
}
};
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = httpClient.getConnectionManager();
SchemeRegistry registry = ccm.getSchemeRegistry();
registry.register(new Scheme("https", 443, ssf));
} catch (KeyManagementException ex) {
throw new RuntimeException(ex);
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
}
}
}
\ No newline at end of file
package test;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class HttpsUtil_Post_Json {
private static class TrustAnyTrustManager implements X509TrustManager {
public void checkClientTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
}
public void checkServerTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
}
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[] {};
}
}
private static class TrustAnyHostnameVerifier implements HostnameVerifier {
public boolean verify(String hostname, SSLSession session) {
return true;
}
}
/**
* post��ʽ���������(httpsЭ��) ����json����
*
* @param url
* �����ַ
* @param content
* ����
* @param charset
* ����
* @return
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws IOException
*/
public static void main(String[] args) {
try {
post("https://api.puhuifinance.com/datapi-blacklist-server/api/v1/batchQueryBlacklist/query",
"[{\"queryField\":\"id_no\",\"queryValue\":\"13910960649\"}]",
"utf-8");
} catch (KeyManagementException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static byte[] post(String url, String content, String charset)
throws NoSuchAlgorithmException, KeyManagementException,
IOException {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, new TrustManager[] { new TrustAnyTrustManager() },
new java.security.SecureRandom());
URL console = new URL(url);
HttpsURLConnection conn = (HttpsURLConnection) console.openConnection();
conn.setRequestProperty("Content-Type","application/json");
conn.setSSLSocketFactory(sc.getSocketFactory());
conn.setHostnameVerifier(new TrustAnyHostnameVerifier());
conn.setDoOutput(true);
conn.connect();
DataOutputStream out = new DataOutputStream(conn.getOutputStream());
out.write(content.getBytes(charset));
// ˢ�¡��ر�
out.flush();
out.close();
InputStream is = conn.getInputStream();
if (is != null) {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = is.read(buffer)) != -1) {
outStream.write(buffer, 0, len);
}
is.close();
return outStream.toByteArray();
}
return null;
}
}
\ No newline at end of file
package test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.offcn.TestUnti.ReadProperties;
public class MySqlUtil {
public static String sql;
public static Connection conn =null;
public static Statement stmt=null;
public static ResultSet result = null;
public static void main(String[] args) {
//update xyu.xyu_room set status=4 where room_num=201808310045;
// int a=updateOrderStatus("xyu.xyu_room","status=4", "room_num=201808310045");
// System.out.println(a);
select( " xyu_room " , " room_name = '中国特长房间名' ");
}
public static void closed(){
try {
result.close();
stmt.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void select(String tableName, String condition){
//数据库连接
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://192.168.10.222:3306/xyu?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull","root"
,"offcn.com");
// Connection conn = DriverManager.getConnection("jdbc:mysql://192.168.10.222:3306/xyu?user=root&amp;password=offcn.com&amp;useUnicode=true&amp;characterEncoding=UTF8");
stmt = conn.createStatement();
// sql = "select * from " + " xyu_users;" ;
sql = "select * from " + tableName + " where " + condition;
System.out.println(sql);
// System.out.println("select_sql="+sql);
result = stmt.executeQuery(sql);
result.last();
System.out.println(result.getRow());
if (result.getRow() != 1) {
System.out.println(result.getRow());
} else{
// String act_idNo = String.valueOf(result.getString(result.findColumn("mobile")));
// System.out.println("name:"+act_idNo);
// String act_idNo = String.valueOf(rs_cust_info.getString(rs_cust_info.findColumn("id_no")));
}
} catch (Exception e) {
e.printStackTrace();
}finally{
closed();
}
}
//更改表
public static Integer updateOrderStatus(String fromName,String setCondition, String whereCondition) {
Integer result1=null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://192.168.10.222:3306/xyu","root"
,"offcn.com");
// Connection conn = DriverManager.getConnection("jdbc:mysql://192.168.10.222:3306/xyu?user=root&amp;password=offcn.com&amp;useUnicode=true&amp;characterEncoding=UTF8");
stmt = conn.createStatement();
String sql = "update "+ fromName +" set "+ setCondition +" where "+ whereCondition;
System.out.println(sql);
result1 = stmt.executeUpdate(sql);//
if (result1 == -1) {
System.out.println("update order states failed!");
}
} catch (SQLException e) {
e.printStackTrace();
System.out.println("update order states failed!");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}try {
stmt.close();
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result1;
}
}
package test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.apache.commons.codec.binary.Base64;
import sun.misc.BASE64Encoder;
public class OCRTest {
public static String request(String httpUrl, String httpArg) {
BufferedReader reader = null;
String result = null;
StringBuffer sbf = new StringBuffer();
try {
URL url = new URL(httpUrl);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
// 填入apikey到HTTP header
connection.setRequestProperty("apikey", "42d199bc0a50cd8e109ff880ecc444fe");
connection.setDoOutput(true);
connection.getOutputStream().write(httpArg.getBytes("UTF-8"));
connection.connect();
InputStream is = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String strRead = null;
while ((strRead = reader.readLine()) != null) {
sbf.append(strRead);
sbf.append("\r\n");
}
reader.close();
result = sbf.toString();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
// <pre name="code" class="java">
/**
* @param args
*/
public static void main(String[] args) {
File file = new File("d:\\abc.jpg");
String imageBase = OCRTest.encodeImgageToBase64(file);
imageBase = imageBase.replaceAll("\r\n","");
imageBase = imageBase.replaceAll("\\+","%2B");
String httpUrl = "http://apis.baidu.com/apistore/idlocr/ocr";
String httpArg = "fromdevice=pc&clientip=10.10.10.0&detecttype=LocateRecognize&languagetype=CHN_ENG&imagetype=1&image="+imageBase;
String jsonResult = request(httpUrl, httpArg);
System.out.println("返回的结果--------->"+jsonResult);
}
// //Base64编解码
// private static String encodeTest(String str){
// Base64 base64 = new Base64();
// try {
// str = base64.encodeToString(str.getBytes("UTF-8"));
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// System.out.println("Base64 编码后:"+str);
// return str;
// }
//
// private static void decodeTest(String str){
// Base64 base64 = new Base64();
// //str = Arrays.toString(Base64.decodeBase64(str));
// str = new String(Base64.decodeBase64(str));
// System.out.println("Base64 解码后:"+str);
// }
public static String encodeImgageToBase64(File imageFile) {// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
// 其进行Base64编码处理
byte[] data = null;
// 读取图片字节数组
try {
InputStream in = new FileInputStream(imageFile);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
// 对字节数组Base64编码
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);// 返回Base64编码过的字节数组字符串
}
}
\ No newline at end of file
package test;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import net.sf.json.JSONObject;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import com.offcn.TestUnti.Log;
public class ReadExcels {
private String fileName;
private String SheetName;
public ReadExcels() {
}
public ReadExcels(String fileName, String sheetName) {
this.fileName = fileName;
SheetName = sheetName;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getSheetName() {
return SheetName;
}
public void setSheetName(String sheetName) {
SheetName = sheetName;
}
@SuppressWarnings({ "unused", "resource" })
public Object[][] readExcels_return() throws Exception{
String targetFile = "TestData/"+fileName;
FileInputStream fis = new FileInputStream(new File(targetFile));
Workbook wb = WorkbookFactory.create(new File(targetFile));
Sheet sheet = wb.getSheet(SheetName);
int rows=sheet.getPhysicalNumberOfRows();
//有多少行数据就创建多少个map,首行是标题第二行开始才是数据,所以rows-1
@SuppressWarnings("unchecked")
HashMap<String, Object>[][] arrmap = new HashMap[rows-1][1];
List<String> list = new ArrayList<String>();
//每个子map分别为arrmap[0][0]、arrmap[1][0]、arrmap[2][0]。。。
for(int i = 1 ; i < sheet.getPhysicalNumberOfRows() ; i++){
arrmap[i-1][0] = new HashMap<>();
}
//获取标题行数据存放在list里面
for(int i = 0 ; i < 1 ; i++){
Row r = sheet.getRow(i);
for (int j = 0; j < r.getPhysicalNumberOfCells(); j++) {
Cell cell = r.getCell(j);
list.add(getCellValue(cell));
}
}
for(int i = 1 ; i < sheet.getPhysicalNumberOfRows() ; i++){
Row r = sheet.getRow(i);
for (int j = 0; j < r.getPhysicalNumberOfCells(); j++) {
Cell cell = r.getCell(j);
String brandName=getCellValue(cell);
//如果列名是parameter的时候,按逗号分隔字符串
if("parameter".equals(list.get(j))){
System.out.println("看看="+brandName);
arrmap[i - 1][0].put(list.get(j), brandName);//分别往每个子map中存放数据,每行是一个map
// String[] strcomma=brandName.split(",");
// int comma=strcomma.length;
// for(int k=0;k<comma;k++){
// String[] str=strcomma[k].split(":");
// System.out.println("str="+Arrays.toString(str));
// if(str.length>1){
// arrmap[i - 1][0].put((String)filterString(str[0].trim(),i,j),filter(str[1],i,j));//分别往每个子map中存放数据,每行是一个map
//// arrmap[i - 1][0].put((String)(str[0].trim()),(str[1]));//分别往每个子map中存放数据,每行是一个map
// }
// }
}else{
arrmap[i - 1][0].put(list.get(j), brandName);//分别往每个子map中存放数据,每行是一个map
}
}
}
/**
* 查看数据提取结果
for(int i=0;i<arrmap.length;i++){
for(int j=0;j<arrmap[i].length;j++){
System.out.print(" "+arrmap[i][j]);
}
System.out.println();
}
for(int i=0;i<arrmap.length;i++){
HashMap<String, Object> arr=arrmap[i][0];
System.out.println("处理后数据="+JSONObject.fromObject(arr).toString());
}
*/
System.out.println(arrmap);
return arrmap;
}
//去掉字符串的双引号,row行,j列
private String filterString(String str,int rows,int j){
if(str==null){
Log.logError("readExcels filterString error"+str+"发生在"+rows+"行"+j+"列");
return "null";
}
StringBuffer sb=new StringBuffer();
for(int i=0;i<str.length();i++){
char c=str.charAt(i);
if(str.charAt(i)=='"'){
}else{
sb.append(c);
}
}
return sb+"";
}
//输入类型转换成数字型,row行,j列
private Long filterInt(String str){
return Long.valueOf(str);
}
//选择何种转换方式
private Object filter(String str,int i,int j){
System.out.println(111);
System.out.println(str);
if(str.equals("null")){
System.out.println(1234);
return "null";
}
if(str.equals("\"null\"")){
System.out.println(5678);
return "\"null\"";
}
if(!Character.isDigit(str.charAt(0))){//如果首位不是数字就按字符串处理
return filterString(str, i, j);
}else{
// return filterInt(str);
return "";
}
}
private String getCellValue(Cell cell){
int cellType=0;
try {
cellType = cell.getCellType();
} catch (Exception e) {
return "无法解析";
}
String value = "";
if(cellType == Cell.CELL_TYPE_STRING){
value = cell.getStringCellValue();
}else if(cellType == Cell.CELL_TYPE_NUMERIC){
value = String.valueOf(cell.getNumericCellValue());
}else if(cellType == Cell.CELL_TYPE_BOOLEAN){
value = String.valueOf(cell.getBooleanCellValue());
}else if(cellType == Cell.CELL_TYPE_BLANK){
value = "";
}else if(cellType == Cell.CELL_TYPE_FORMULA){
value = String.valueOf(cell.getCellFormula());
}else{
value = "";
}
return value;
}
}
package test;
import freemarker.template.utility.StringUtil;
import io.restassured.RestAssured;
import io.restassured.config.EncoderConfig;
import io.restassured.config.RestAssuredConfig;
import io.restassured.config.SSLConfig;
import io.restassured.http.ContentType;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.MapUtil;
import com.offcn.TestUnti.StringUtils;
import com.offcn.process.BasicsGM;
import com.offcn.process.XYZB;
import static io.restassured.http.ContentType.JSON;
public class RequestDataUtils {
public static void main(String[] args) {
String token="eyJpdiI6IjhNYlJuUW1lWG1abFVsY1dlZFV3bGc9PSIsInZhbHVlIjoiMXJSVjR5U2pYQVwvV0tpK2FrdDZiT29yNTBqMEJpeHhmVk1NVkg0bmJva2Q4eklDZlZ3RllNTTlGMk4yb1wva1BTbTRURDZIWFFSQUJWSk5MaW1YaEQyQ2I3WlVaNXR3NGRUN3F5NmdtNnBFbldHdXV0b2hiMGVPaVJIOVpheFFteCIsIm1hYyI6IjkyNzkwNDc3MjNkMTRkYjA0MmJiZWEyZTc0ZGIwYmUzZTZlZjA2NjE0MGQwODg2YzQ3OWNjMmU2MjM3YzllNjcifQ==";
String Parameter="{\"name\":111}";
for(int i=0;i<1000;i++){
Response re = Post_Token(token,Parameter);
System.out.println(StringUtils.decodeUnicode(re.asString()));
}
}
//发送请求前的准备
private RestAssured getRMEnv() {
RestAssured ra = new RestAssured();
ra.config = RestAssuredConfig.newConfig().sslConfig(
SSLConfig.sslConfig().allowAllHostnames());
// System.out.println(tem.getRM_URI());http://student.eoffcn.com/ajax/jsonp/customer_service?phone=13366993819
// ra.baseURI = "http://e.eoffcn.com";
// ra.baseURI = "http://student.eoffcn.com";s
// ra.urlEncodingEnabled=true;
// System.out.println(Integer.valueOf(tem.getRM_port()));
// if (!ReadProperties.GetPropertyByKey("isProduct").contains("Y")){
// ra.port = 8765;
// }
// System.out.println(tem.getRM_basePath());
// ra.basePath = "/api/course_query.php";
// ra.basePath = "/ajax/jsonp/customer_service";
// ra.urlEncodingEnabled =true;
// RestAssured.config = RestAssured.config().encoderConfig(EncoderConfig.encoderConfig().encodeContentTypeAs("x-www-form-urlencoded", ContentType.ANY).defaultContentCharset("utf-8"));
return ra;
}
//发送get请求返回整个响应结果
@SuppressWarnings("static-access")
public static Response Get_Noparameter(String token) {
int state=0;
Response re=null;
RequestDataUtils rdu=new RequestDataUtils();
Long sum=0L;
// while(state<10){
try {
state++;
Long startTime=System.currentTimeMillis();
re = rdu.getRMEnv().given().header("Authorization","Bearer "+ token).get("http://live.offcncloud.com/api/v1/room_files").andReturn();
Long endTime=System.currentTimeMillis();
String time=(endTime-startTime)+"毫秒";
sum=sum+(endTime-startTime);
// System.out.println(time+","+sum);
} catch (Exception e) {
Log.logError("请求超时,"+state+"次。");
}
// }
// System.out.println(sum/10);
// System.out.println(re.asString());
JsonPath jp = re.body().jsonPath();
ArrayList<Object> list=(ArrayList<Object>) re.body().jsonPath().getList("data");
System.out.println(list.size());
return re;
}
public static Response Post_NOToken1(String Parameter,String token) {
// 设置参数格式
// String Parameter = (String) data.get("parameter");
//
// String system = MapUtil.getValue("system", data);
// com.offcn.system.system tem = (com.offcn.system.system) (BasicsGM.map.get(system));
// Log.logInfo(data.get("Description").toString() + "," + data.get("TCNO").toString() + ",Parameter=" + Parameter);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
// Cookie cookie1 = Cookie.Builder("username", "John").setComment("comment 1").build();
// Cookie cookie2 = Cookie.Builder("token", 1234).setComment("comment 2").build();
// Cookies cookies = new Cookies(cookie1, cookie2);
System.out.println(XYZB.laravel_session);
System.out.println(Parameter);
re = rdu.getRMEnv().given().cookie("laravel_session", token).contentType(JSON).body("{"+Parameter+"}").when()
.post("/web/member").thenReturn();
System.out.println(re.getStatusCode()+"............................");
System.out.println(re.asString());
// JsonPath jp = re.body().jsonPath();
if (!"200".equals(re.getStatusCode())) {
Log.logError("请求返回:" +re.getStatusCode()+",第"+ state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
e.printStackTrace();
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
public static Response Post_NOToken2(String Parameter,String token) {
// 设置参数格式
// String Parameter = (String) data.get("parameter");
//
// String system = MapUtil.getValue("system", data);
// com.offcn.system.system tem = (com.offcn.system.system) (BasicsGM.map.get(system));
// Log.logInfo(data.get("Description").toString() + "," + data.get("TCNO").toString() + ",Parameter=" + Parameter);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
// Cookie cookie1 = Cookie.Builder("username", "John").setComment("comment 1").build();
// Cookie cookie2 = Cookie.Builder("token", 1234).setComment("comment 2").build();
// Cookies cookies = new Cookies(cookie1, cookie2);
System.out.println(XYZB.laravel_session);
System.out.println(Parameter);
re = rdu.getRMEnv().given().contentType(JSON).body("{"+Parameter+"}").when()
.post("/web/login").thenReturn();
System.out.println(re.getStatusCode()+"............................");
System.out.println(re.asString());
// JsonPath jp = re.body().jsonPath();
if (!"200".equals(re.getStatusCode())) {
Log.logError("请求返回:" +re.getStatusCode()+",第"+ state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
e.printStackTrace();
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
//不带token的post请求
public static Response Post_Token(String token, String Parameter) {
// 设置参数格式
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
re = rdu.getRMEnv().given()
.header("Authorization","Bearer "+ token)
.contentType(JSON)
.body(Parameter).when()
.post("http://live.offcncloud.com/api/v1/questions").thenReturn();
JsonPath jp = re.body().jsonPath();
if ("500".equals(jp.getString("status"))) {
Log.logError("请求返回500," + state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
//带token的pout请求
public static Response Put_Token(String token, String serviceURL) {
// Map<String, Object> jsonAsMap = new HashMap<>();
// jsonAsMap.put("start_time", "2018-08-29 14:16:42");
// jsonAsMap.put("end_time", "2018-08-29 23:00:00");
// jsonAsMap.put("room_name", "201808290008");
// jsonAsMap.put("office_type", "国家公务员");
// jsonAsMap.put("province", "北京");
// jsonAsMap.put("city", "市辖区");
// jsonAsMap.put("area", "东城区");
// 设置参数格式
Log.logInfo("serviceURL=" + serviceURL + ",Parameter=" + token);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
//.given().contentType("x-www-form-urlencoded; ContentType.TEXT)")
while (state < 5) {
try {
state++;
re = rdu.getRMEnv()
.given().config(RestAssured.config()
.encoderConfig(EncoderConfig.encoderConfig()
.encodeContentTypeAs("x-www-form-urlencoded", ContentType.ANY)
.defaultContentCharset("utf-8")))
.header("Authorization","Bearer "+ token)
.formParam("start_time", "2018-08-31 22:19:42")
.formParam("end_time", "2018-08-31 23:00:00")
.formParam("room_name", "呜呜呜呜22s11")
.formParam("office_type", "国家公务员")
.formParam("province", "北京")
.formParam("city", "市辖区")
.formParam("area", "东城区").
when().put(serviceURL).thenReturn();
JsonPath jp = re.body().jsonPath();
if ("500".equals(jp.getString("status"))) {
Log.logError("请求返回500," + state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
e.printStackTrace();
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
//带token的del请求
public static Response Del_Token(String token, String serviceURL) {
// 设置参数格式
Log.logInfo("serviceURL=" + serviceURL + ",Parameter=" + token);
int state = 0;
Response re = null;
RequestDataUtils rdu = new RequestDataUtils();
while (state < 5) {
try {
state++;
re = rdu.getRMEnv().given().header("Authorization","Bearer "+ token).
when().delete(serviceURL).thenReturn();
JsonPath jp = re.body().jsonPath();
if ("500".equals(jp.getString("status"))) {
Log.logError("请求返回500," + state + "次。");
Thread.sleep(1000);
} else {
return re;
}
} catch (Exception e) {
Log.logError("请求超时," + state + "次。");
}
}
return re;
}
}
package test;
import static io.restassured.http.ContentType.JSON;
import java.io.File;
import java.util.HashMap;
import org.json.simple.JSONObject;
import io.restassured.RestAssured;
import io.restassured.config.RestAssuredConfig;
import io.restassured.config.SSLConfig;
import io.restassured.http.Header;
import io.restassured.http.Headers;
import io.restassured.response.Response;
import io.restassured.path.json.JsonPath;
public class RequestDataUtils2 {
//发送post请求前的准备
private static RestAssured getRMEnv() {
RestAssured ra = new RestAssured();
ra.config = RestAssuredConfig.newConfig().sslConfig(
SSLConfig.sslConfig().allowAllHostnames());
ra.baseURI = "http://ut1.zuul.pub.puhuifinance.com";
ra.port = 8765;
ra.basePath = "/bestbuy-app-server-cloud-server/api";
return ra;
}
//发送post请求返回整个响应结果
public static Response getPostResponse() {
RequestDataUtils2 rdu=new RequestDataUtils2();
Response re=null;
String url="/v1/customer/photo/upload";
try{
File filen=new File("out/3.jpg");
re=rdu.getRMEnv().given()
.header("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtYWMiOiIxNDk5NDMwNzQwNzQzIiwidXNlcklkIjoyMjQxMCwic3ViIjoiMTU4MTEwMDM0MzEiLCJpc3MiOiJybS1hcHAtc2VydmVyIiwiaWF0IjoxNTAwMzY5MDE4fQ.nixejoF9AJCnBnj7JUkP9kcROWW3qnpP_yKUydJ0i-U")
.multiPart("file", filen)
// .queryParam("orderId",map.get("orderId")+"&photoType="+map.get("photoType")+"&photoLocation="+map.get("photoLocation"))
// .pathParam("photoType",map.get("photoType"))
// .pathParam("photoLocation",map.get("photoLocation"))
.when()
.post(url+"?photoType=1&photoLocation=2&orderId=38858")
.thenReturn();
// File filen=new File("out/"+filename);
// re=rdu.getRMEnv(tem).given().header("Authorization", ZY.ZY_Token.get("token")==null? "":ZY.ZY_Token.get("token"))
// .when().multiPart("file", filen)
// .params(map)
// .post(serviceURL).andReturn();
}catch(Exception e){
System.out.println(e.getMessage());
// re=rdu.getRMEnv(tem).given().header("Authorization", ZY.ZY_Token.get("token")==null? "":ZY.ZY_Token.get("token"))
// .when()
// .params(map)
// .post(serviceURL).andReturn();
}
System.out.println(re.asString());
return null;
}
public static void main(String[] args) throws Exception {
getPostResponse();
}
}
package test;
import static io.restassured.http.ContentType.JSON;
import java.util.List;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.http.Header;
import io.restassured.http.Headers;
import io.restassured.response.Response;
/**
* 人工信审工具类
* @author puhui
*
*/
public class Rgxs{
// public String JSESSIONID;
// public String StatusCode;
// public String time;
public static void main(String[] args) {
Rgxs r=new Rgxs();
String JSESSIONID=r.getJSESSIONID();
r.login(JSESSIONID);
}
public String getJSESSIONID(){
String JSESSIONID;
String StatusCode;
String time;
RestAssured ra_VerifyCode = new RestAssured();
ra_VerifyCode.baseURI = "http://10.10.227.155";
ra_VerifyCode.port = 8092;
ra_VerifyCode.basePath = "/puhui-cas/login?service=http://10.10.180.37:9092/cas-login";
String s="username=guanxin&password=123456&captcha=&lt=LT-91693-umbYEtmZoAIwfMz6DgJ4TYyMEdJuon-inside.puhuifinance.com%2Fpuhui-cas&execution=e1s1&_eventId=submit";
Long start=System.currentTimeMillis();
Response re2 = ra_VerifyCode.given().given().get();
Long end=System.currentTimeMillis();
JSESSIONID=re2.getHeader("Set-Cookie").split(";")[0];
System.out.println(JSESSIONID);
return JSESSIONID;
}
public String login(String JSESSIONID){
//登陆http://10.10.227.155:8092/puhui-cas/login;jsessionid=CB6D5A088E0131A8D3DBB4C09CF537EB?service=http://10.10.180.37:9092/cas-login&locale=zh_CN
String StatusCode;
String time;
RestAssured ra_VerifyCode = new RestAssured();
ra_VerifyCode.baseURI = "http://10.10.227.155";
ra_VerifyCode.port = 8092;
ra_VerifyCode.basePath = "/puhui-cas/login;"+JSESSIONID+"?service=http://10.10.180.37:9092/cas-login&locale=zh_CN";
String Parameter="username=guanxin&password=123456&captcha=&lt=LT-95983-ZMh4JH2vw71sRMqERKcTOHGuiPDUtb-inside.puhuifinance.com%2Fpuhui-cas&execution=e1s1&_eventId=submit";
Long start=System.currentTimeMillis();
Response re2 = ra_VerifyCode.given().given().contentType(ContentType.URLENC).
headers("Cookie", JSESSIONID,
"Referer","http://10.10.227.155:8092/puhui-cas/login?service=http://10.10.180.37:9092/cas-login",
"Origin","http://10.10.227.155:8092"
).body(Parameter).when().post();
Long end=System.currentTimeMillis();
System.out.println("第二步完成");
System.out.println(re2.getHeaders().toString());
System.out.println(re2.getBody().asString());
System.out.print("名称:"+Thread.currentThread().getName()+"状态:"+re2.getStatusCode()+"耗时:毫秒");
return JSESSIONID;
}
}
package test;
public class Test_maxiao {
public static void main(String[] args) {
System.out.println(removeFourChar("えもじ,e-moji,moj"));
}
/**
* 替换四个字节的字符 '\xF0\x9F\x98\x84\xF0\x9F)的解决方案
*
* @param content
* @return
* @author 张栋
* @data 2015年8月11日 上午10:31:50
*/
public static String removeFourChar(String content) {
byte[] conbyte = content.getBytes();
System.out.println(conbyte[0]);
for (int i = 0; i < conbyte.length; i++) {
if ((conbyte[i] & 0xF8) == 0xF0) {
for (int j = 0; j < 4; j++) {
System.out.println("j="+j);
conbyte[i + j] = 0x30;
}
i += 3;
}
}
String contentnew = new String(conbyte);
return contentnew.replaceAll("0000", "");
}
}
//package test;
//
//
//
//import com.puhui.bestbuy.common.domain.wx.Token;
//import com.puhui.bestbuy.common.domain.wx.WeixinOauth2Token;
//import com.puhui.bestbuy.common.domain.wx.WeixinUserInfo;
//import com.puhui.bestbuy.common.domain.wx.WeixinUserList;
//import net.sf.json.JSONArray;
//import net.sf.json.JSONException;
//import net.sf.json.JSONObject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.security.MessageDigest;
//import java.security.NoSuchAlgorithmException;
//import java.util.Arrays;
//import java.util.List;
//
//
///**
// * @ClassName: UserUtil.java
// * @Title: 权限控制工具类
// * @Description: 权限控制工具类
// */
//public class UserUtil {
//
// private static final String errcode = "errcode";
//
// private static final String errmsg = "errmsg";
//
// private static Logger log = LoggerFactory.getLogger(UserUtil.class);
//
// public static Token getToken(String appid, String appsecret) {
// Token token = null;
// String requestUrl = WeixinParameter.token_url.replace("APPID", appid)
// .replace("APPSECRET", appsecret);
// // 发起GET请求获取凭证
// JSONObject jsonObject = CommonUtil
// .httpsRequest(requestUrl, "GET", null);
//
// if (null != jsonObject) {
// try {
// token = new Token();
// token.setAccessToken(jsonObject.getString("access_token"));
// token.setExpiresIn(jsonObject.getInt("expires_in"));
// log.info("[UserUtil][getToken]获取token成功{}", jsonObject.getString("access_token"));
// } catch (JSONException e) {
// token = null;
// // 获取token失败
// log.error("[UserUtil][getToken]获取token失败 errcode:{} errmsg:{}",
// jsonObject.getInt(errcode),
// jsonObject.getString(errmsg));
// log.error("获取token失败", e);
// }
// }
// return token;
// }
//
// /**
// * 获取用户信息
// *
// * @param accessToken 接口访问凭证
// * @param openId 用户标识
// * @return WeixinUserInfo
// */
// public static WeixinUserInfo getUserInfo(String accessToken, String openId) {
// WeixinUserInfo weixinUserInfo = new WeixinUserInfo();
// // 拼接请求地址
// String requestUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID";
// requestUrl = requestUrl.replace("ACCESS_TOKEN", accessToken).replace(
// "OPENID", openId);
// // 获取用户信息
// JSONObject jsonObject = CommonUtil.httpsRequest(requestUrl, "GET", null);
//
// if (null != jsonObject) {
// log.info("[UserUtil][getUserInfo][jsonObject]="
// + jsonObject.toString());
// // 用户的标识
// weixinUserInfo.setOpenId(openId);
// // 关注状态(1是关注,0是未关注),未关注时获取不到其余信息
// weixinUserInfo.setSubscribe(jsonObject.getInt("subscribe"));
// if (jsonObject.getInt("subscribe") == 1) {
// // 用户关注时间
// weixinUserInfo.setSubscribeTime(jsonObject
// .getString("subscribe_time"));
// // 昵称
// weixinUserInfo.setNickname(jsonObject.getString("nickname"));
// // 用户的性别(1是男性,2是女性,0是未知)
// weixinUserInfo.setSex(jsonObject.getInt("sex"));
// // 用户所在国家
// weixinUserInfo.setCountry(jsonObject.getString("country"));
// // 用户所在省份
// weixinUserInfo.setProvince(jsonObject.getString("province"));
// // 用户所在城市
// weixinUserInfo.setCity(jsonObject.getString("city"));
// // 用户的语言,简体中文为zh_CN
// weixinUserInfo.setLanguage(jsonObject.getString("language"));
// // 用户头像
// weixinUserInfo.setHeadImgUrl(jsonObject.getString("headimgurl"));
// }
// }
// return weixinUserInfo;
// }
//
// /**
// * 校验签名
// *
// * @param token 绑定TOKEN
// * @param signature 微信加密签名
// * @param timestamp 时间戳
// * @param nonce 随机数
// * @return
// */
// public static boolean checkSignature(String token, String signature,
// String timestamp, String nonce) {
//
// // 对token、timestamp和nonce按字典排序
// String[] paramArr = new String[]{token, timestamp, nonce};
// Arrays.sort(paramArr);
//
// // 将排序后的结果拼接成一个字符串
// String content = paramArr[0].concat(paramArr[1]).concat(paramArr[2]);
//
// String ciphertext = null;
// try {
// MessageDigest md = MessageDigest.getInstance("SHA-1");
// // 对接后的字符串进行sha1加密
// byte[] digest = md.digest(content.getBytes());
// ciphertext = CommonUtil.byteToStr(digest);
// } catch (NoSuchAlgorithmException e) {
// log.error("验签失败", e);
// }
//
// // 将sha1加密后的字符串与signature进行对比
// log.info("ciphertext:" + ciphertext);
// return ciphertext != null ? ciphertext.equalsIgnoreCase(signature)
// : false;
// }
//
// /**
// * 获取网页授权凭证
// *
// * @param appId 公众账号的唯一标识
// * @param appSecret 公众账号的密钥
// * @param code
// * @return WeixinAouth2Token
// */
// public static WeixinOauth2Token getOauth2AccessToken(String appId,
// String appSecret, String code) {
// WeixinOauth2Token wat = null;
// // 拼接请求地址
// String requestUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
// requestUrl = requestUrl.replace("APPID", appId);
// requestUrl = requestUrl.replace("SECRET", appSecret);
// requestUrl = requestUrl.replace("CODE", code);
// // 获取网页授权凭证
// JSONObject jsonObject = CommonUtil
// .httpsRequest(requestUrl, "GET", null);
// if (null != jsonObject) {
// try {
// wat = new WeixinOauth2Token();
// wat.setAccessToken(jsonObject.getString("access_token"));
// wat.setExpiresIn(jsonObject.getInt("expires_in"));
// wat.setRefreshToken(jsonObject.getString("refresh_token"));
// wat.setOpenId(jsonObject.getString("openid"));
// wat.setScope(jsonObject.getString("scope"));
// } catch (Exception e) {
// wat = null;
// int errorCode = jsonObject.getInt(errcode);
// String errorMsg = jsonObject.getString(errmsg);
// log.error(
// "[UserUtil][getOauth2AccessToken]获取网页授权凭证失败 errcode:{} errmsg:{}",
// errorCode, errorMsg);
// log.error("获取网页授权凭证失败", e);
// }
// }
// return wat;
// }
//
// /**
// * 获取关注者列表
// *
// * @param accessToken 调用接口凭证
// * @param nextOpenId 第一个拉取的openId,不填默认从头开始拉取
// * @return WeixinUserList
// */
// @SuppressWarnings({"unchecked", "deprecation"})
// public static WeixinUserList getUserList(String accessToken,
// String nextOpenId) {
// WeixinUserList weixinUserList = new WeixinUserList();
//
// if (null == nextOpenId)
// nextOpenId = "";
//
// // 拼接请求地址
// String requestUrl = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID";
// requestUrl = requestUrl.replace("ACCESS_TOKEN", accessToken).replace(
// "NEXT_OPENID", nextOpenId);
// // 获取关注者列表
// JSONObject jsonObject = CommonUtil
// .httpsRequest(requestUrl, "GET", null);
// // 如果请求成功
// if (null != jsonObject) {
// weixinUserList.setTotal(jsonObject.getInt("total"));
// weixinUserList.setCount(jsonObject.getInt("count"));
// weixinUserList.setNextOpenId(jsonObject
// .getString("next_openid"));
// JSONObject dataObject = (JSONObject) jsonObject.get("data");
// weixinUserList.setOpenIdList(JSONArray.toList(
// dataObject.getJSONArray("openid"), List.class));
//
// }
// return weixinUserList;
// }
//
//}
package test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import net.sf.json.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import sun.misc.BASE64Decoder;
/**
* 验证码识别类
* 第一个参数:几位的中英数
* 第二个参数:图片地址
* 返回解析好的字符串
* @author puhui
*/
public class aliOCR {
public static void main(String[] args) {
// String YanZhengMa=getYZM(4,"d:\\t111.jpg");
//// getYZM(4,"d:\\abc.jpg");
// System.out.println("验证码="+YanZhengMa);
//将字符串转换成图片
boolean b=GenerateImage("/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAA0AIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD3+ikZlRSzEBQMkk8AVB9sjb/VLJMe3lrlT9G+7+tK6FcsU2RC8TosjRsykB1xlT6jIIz9QahzdycgRQjsGBcn64Ix+Zo+xo3+ueSf2kPy/iowD+Iov2AoC9vLG4W3nC36FgvmQACZAe8kfQgDkspHJACVYtNS/tGIvZqu1W2OZHGUb0KjJDDPKnaRV1I0iQJGioo6KowBWZcaIl9cy3F3Nl2QxIYYwhVM5AYnJfqcqTsPdKrffQm0lsy9b3UNw0kccySvCdspjHyhu4z0zxyM5GRnqKnrKja+0qNYpIFu7OMBVktkCyRqOm6Po2AOSnJJACVetL22vojJbTLIqttYDqjd1YdVYZ5BwR3puLWo1JPQnoooqSgopjyrGyBgQGOA3YHsD9f89RT6AuFFFFABRRRQA140k270Vtp3DIzg+tOoooAKKKKACiiigDAfxKYfGSeH57FkE0XmQXAlBDjaScrjgfK469hxg5rak8iDzbqTy48J+8lbAwi5PJ9Bkn2ya5T4h2E8uj2+q2S/6ZpkwnVwCSqdyBgg4IVjnoFP4y2E3/Cb7byWKSLQ4n/d20q4a6kGDufsUU8BQSCQc9MV0unFwU1otn6/8E5lUkpuD1e69P8AgGvomrvq+mNqE1m9lAzMYfOYZeLs5/u5549s5IINT6bqSalFI6Ls2Pt2lsnHYn0/+tUV9/p9yunL/q12yXDdtueE9ievbgd6q6but/EWoW+QyuPNJxznIOP/AB41yTneeish88lKKvdbfMvw3i3l5c2ohDRRDazk8E9MYx9fyqTe1r8sm54B0lJyUH+13x7/AJ9MmhoP737Zd9POl+76d+v/AAL9Km8QagdL0C9vFLCRI8IVAOHPyqcHjgkUoXkrmq1VypqPiaG2uxY6fbyalfnrDARtj+YKd7fw/wBO+M5qGTxFqdlG0+p+HbmG3UEl7eZJyO/IGMDAPP8AjSeDdNbTtEt5SqPJeqJpZAfmyeVyT1GCOOxz1zkdJVjV2FFFFBQUUUUAFFFFABRRRQBzPxAufs3gu/xN5TybI1w+0tlxlR65Xdkemat6S8ejeENP82IQNHax5iK7CZCoJBGOpbOfxJq7qujWGt2q22owedCriQLvZcMARnKkdiatS28UzxvIu4xtuTJOAfXHTP8AKtJT/dKC3vcxdOXtHNdrIyrbTNRQNL/aPlyzYaQGBWOcdM56D8qz9VS50+9t7ma6NxK6OikIEK8Yzx/vZrqax7q2vtUt0hnt47fY4YuZN2eCDgD69zXLOFlZEzorltG9/mWNEj8vSYcptLZY8YzycH8sVS8ZQSXHhLUEiXcwRXIyB8qsGJ/IGtuNFijWNBhVAUD0Ap1axVkkbpaWMLwlqlrqPh+1S3kzJbRJDKh4ZWC46ehxwf6gisvUf9L+JumQ/wCuitrcu6feWJsOQSP4T9zn/d9q2L3wpoeoXJuLjT4zK33mRmTcck5O0jJ569as6boWmaRuNjZxxM2cvyzY443HJxwOOlUKzNCiiikUFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQB//9k=");
System.out.println(b);
}
public static String getYZM(int count,String imagePath){
String host = "http://ali-checkcode.showapi.com";
String path = "/checkcode";
String method = "POST";
Map<String, String> headers = new HashMap<String, String>();
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
headers.put("Authorization", "APPCODE 4afc3a5a191a4bbd80b837c3374ac872");
Map<String, String> querys = new HashMap<String, String>();
Map<String, String> bodys = new HashMap<String, String>();
bodys.put("convert_to_jpg", "0");
bodys.put("img_base64", encodeImgageToBase64(new File(imagePath)));
bodys.put("typeId", "30"+count+"0");
String result=null;
try {
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
result=EntityUtils.toString(response.getEntity());
JSONObject obj = JSONObject.fromObject(result);
result=obj.getString("showapi_res_body");
JSONObject obj1 = JSONObject.fromObject(result);
result=obj1.get("Result").toString();
System.out.println("获取的验证码是:"+obj1.get("Result"));
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
public static String encodeImgageToBase64(File imageFile) {// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
// 其进行Base64编码处理
byte[] data = null;
// 读取图片字节数组
try {
InputStream in = new FileInputStream(imageFile);
data = new byte[in.available()];
in.read(data);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
return new String(Base64.encodeBase64(data));
}
//base64字符串转化成图片
public static boolean GenerateImage(String imgStr)
{ //对字节数组字符串进行Base64解码并生成图片
if (imgStr == null) //图像数据为空
return false;
BASE64Decoder decoder = new BASE64Decoder();
try
{
//Base64解码
byte[] b = decoder.decodeBuffer(imgStr);
for(int i=0;i<b.length;++i)
{
if(b[i]<0)
{//调整异常数据
b[i]+=256;
}
}
//生成jpeg图片
String imgFilePath = "d://222.jpg";//新生成的图片
OutputStream out = new FileOutputStream(imgFilePath);
out.write(b);
out.flush();
out.close();
return true;
}
catch (Exception e)
{
return false;
}
}
}
package test;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import com.offcn.TestUnti.MapUtil;
public class map_show {
public static void main(String[] args) throws Exception {
Map<String,String> map=new HashMap<String,String>();
map.put("a","1");
map.put("b","2");
map.put("c","3");
System.out.println(showMap(map,"d"));
// String ss=show();//把map中parameter对应的内容拿出来
// String sss=getPhone(ss,"phone");//在parameter中查看,是否有关键字
// System.out.println("sss="+sss+"==");
// if(sss==null){
// System.out.println("等于空");
// }
// if(sss.equals("")){
// System.out.println("等于空字符串");
// }
}
//查找map中是否有这个建
public static boolean showMap(Map<String, String> data,String key){
Set<Map.Entry<String,String>> set=data.entrySet();
Iterator<Entry<String, String>> it=set.iterator();
while(it.hasNext()){
Map.Entry<String,String> me=it.next();
if(me.getKey().equals(key)){
return true;
}
}
return false;
}
public static String getPhone(String parameter,String phone){
String[] strcomma=parameter.split(",");
int comma=strcomma.length;
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
//此时是多个,,,
String[] str=strcomma[k].split(":");
String str_strcomma=Arrays.toString(str);
System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
//在找到后的位置开始查找数字,最后把数字的字符串返回
if(str_strcomma.contains(phone)){
for (int i =0;i< str_strcomma.length(); i++) {
if (Character.isDigit(str_strcomma.charAt(i))) {
sb.append(str_strcomma.charAt(i));
}
}
}
}
return sb.toString();
}
//查看二维数组
public static String show() throws Exception{
//查看二维数组
ReadExcels readExcels = new ReadExcels("DataAll.xls","TestCase");
Object[][] arrmap= readExcels.readExcels_return();
for(int i=0;i<arrmap.length;i++){
for(int j=0;j<arrmap[i].length;j++){
System.out.print(","+arrmap[i][j]);
}
System.out.println();
}
// HashMap<String, Object> hm=new HashMap<String, Object>();
// hm=(HashMap<String, Object>) arrmap[0][0];
String s=MapUtil.getValue("parameter",(HashMap<String, Object>) arrmap[38][0]);
System.out.println("s="+s);
return s;
}
}
package test;
import static io.restassured.http.ContentType.JSON;
import java.util.List;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.http.Header;
import io.restassured.http.Headers;
import io.restassured.response.Response;
public class maxiao implements Runnable{
public String JSESSIONID;
public String StatusCode;
public String time;
public maxiao(String jSESSIONID) {
JSESSIONID = jSESSIONID;
}
@Override
public void run() {
// RestAssured ra_VerifyCode = new RestAssured();
// ra_VerifyCode.baseURI = "http://10.10.197.245";
// ra_VerifyCode.port = 8888;
// ra_VerifyCode.basePath = "/puhui-lend-pre/page/lendRepay/repayList.jsp";
//
// Long start=System.currentTimeMillis();
// Response re2 = ra_VerifyCode.given().given().
// headers("Cookie", JSESSIONID,
// "Referer","http://10.10.197.245:8888/puhui-lend-pre/main",
// "Upgrade-Insecure-Requests","1"
// ).get();
// Long end=System.currentTimeMillis();
//
// time=(end-start)+"";
// System.out.println();
// StatusCode=re2.getStatusCode()+"";
// System.out.println(re2.getBody().asString());
// System.out.print("名称:"+Thread.currentThread().getName()+"状态:"+re2.getStatusCode()+"耗时:"+time+"毫秒");
RestAssured ra_VerifyCode = new RestAssured();
ra_VerifyCode.baseURI = "http://10.10.197.245";
ra_VerifyCode.port = 8888;
ra_VerifyCode.basePath = "/puhui-lend-pre/lendRepay/list ";
String Parameter="{\"billDate\":\"2016-12-25\",\"page\":1,\"rows\":20}";
System.out.println(Parameter);
Long start=System.currentTimeMillis();
Response re2 = ra_VerifyCode.given().given().contentType(JSON).
headers("Cookie", "JSESSIONID=17E32712D50602F82C30A29E827343E6",
"Referer"," http://10.10.197.245:8888/puhui-lend-pre/page/lendRepay/repayList.jsp",
"Origin","http://10.10.197.245:8888"
).body(Parameter).when().post();
Long end=System.currentTimeMillis();
time=(end-start)+"";
System.out.println(re2.getBody().asString());
System.out.print("名称:"+Thread.currentThread().getName()+"状态:"+re2.getStatusCode()+"耗时:"+time+"毫秒");
}
public static void main(String[] args) {
RestAssured ra_VerifyCode = new RestAssured();
ra_VerifyCode.baseURI = "http://10.10.197.245";
ra_VerifyCode.port = 8888;
ra_VerifyCode.basePath = "/puhui-lend-pre/lendRepay/list";
String Parameter="{\"billDate\":\"2016-12-25\",\"page\":1,\"rows\":20}";
System.out.println(Parameter);
Long start=System.currentTimeMillis();
Response re2 = ra_VerifyCode.given().given().contentType(ContentType.URLENC).
headers("Cookie", "JSESSIONID=17E32712D50602F82C30A29E827343E6",
"Referer"," http://10.10.197.245:8888/puhui-lend-pre/page/lendRepay/repayList.jsp",
"Origin","http://10.10.197.245:8888"
).body("billDate=2016-12-25&page=1&rows=20").when().post();
Long end=System.currentTimeMillis();
System.out.println(re2.getBody().asString());
System.out.print("名称:"+Thread.currentThread().getName()+"状态:"+re2.getStatusCode()+"耗时:毫秒");
}
}
package test;
import java.util.Arrays;
public class panduanshifushishuzi {
public static void main(String[] args) {
String p="\"phone\":\"13910960649\",\"thirdSource\":\"GM\",\"thirdSourceId\":\"ys\",\"verifyCode\":codeown";
System.out.println(getChar(p,"verifyCode"));
}
//判断数字
public static void shuzipanduan(){
String str="12345uu7";
for (int i =0;i< str.length(); i++) {
if (Character.isDigit(str.charAt(i))) {
System.out.println(str.charAt(i));
}
}
}
//判断字母
public static String getChar(String parameter,String Letter){
String[] strcomma=parameter.split(",");
int comma=strcomma.length;
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
//此时是多个,,,
String[] str=strcomma[k].split(":");
String str_strcomma=Arrays.toString(str);
System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
//在找到后的位置开始查找数字,最后把数字的字符串返回
if(str_strcomma.contains(Letter)){
int start=str_strcomma.indexOf(',');
sb.append(str_strcomma.substring(start+1,str_strcomma.length()-1));
}
}
return sb.toString();
}
}
package test;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class properties_test {
public static void main(String[] args) throws Exception{
test3();
// ClearProperty();
}
public static void ClearProperty() {
File directory = new File(".");
try {
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"information.properties";
File file =new File(sourceFile);
if(!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter =new FileWriter(file);
fileWriter.write("");
fileWriter.flush();
fileWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void test3() throws Exception{
Properties prop = new Properties();// 属性集合对象
FileInputStream fis = new FileInputStream("src/resources/information.properties");// 属性文件输入流
prop.load(fis);// 将属性文件流装载到Properties对象中
System.out.println(prop.isEmpty());
fis.close();// 关闭流
}
public static void test2() throws Exception {
Properties prop = new Properties();// 属性集合对象
FileInputStream fis = new FileInputStream("src/resources/information.properties");// 属性文件输入流
prop.load(fis);// 将属性文件流装载到Properties对象中
fis.close();// 关闭流
// 获取属性值,sitename已在文件中定义
System.out.println("获取属性值:password=" + prop.getProperty("password"));
// 获取属性值,country未在文件中定义,将在此程序中返回一个默认值,但并不修改属性文件
// System.out.println("获取属性值:country=" + prop.getProperty("country", "中国"));
// 修改sitename的属性值
prop.setProperty("password", "heihei");
// 文件输出流
FileOutputStream fos = new FileOutputStream("src/resources/information.properties");
// 将Properties集合保存到流中
prop.store(fos, "Copyright (c) Boxcode Studio");
fos.close();// 关闭流
System.out.println("获取修改后的属性值:password=" + prop.getProperty("password"));
}
public static String test1(){
Properties prop = new Properties();
try {
File directory = new File(".");
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"xyzb.properties";
FileOutputStream oFile = new FileOutputStream(sourceFile, true);//true表示追加打开
prop.setProperty("phone", "10086");
prop.store(oFile, "The New properties file");
oFile.close();
return "";
}catch (IOException e) {
return null;
}
}
}
package test;
import java.util.Iterator;
import java.util.Set;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public class t1 {
public static void main(String[] args) {
String str="{\"houseBasicInfo\": {\"address\": \"***&*&*&87\",\"area\": \"北京市\",\"cardPic\": \"cardpiccardpiccardpic\",\"city\": \"北京市\",\"contract\": \"contract\",\"contractNo\": \"100000004\",\"idNo\": \"11022119811222061X\",\"name\": \"姚帅\",\"payAmount\": 10000,\"phone\": \"13910960649\",\"rentBegin\": \"2017-07-21\",\"rentEnd\": \"2018-07-21\",\"rental\": 5000,\"rentalType\": 1,\"roomId\": \"11\",\"roomNum\": \"1101室\",\"suiteId\": \"111\",\"termNum\": 12,\"thirdUserId\": \"1\",\"timeStamp\": \"123123123\"},\"merchantName\": \"蛋壳第一商户\",\"receiveContractInfo\": {\"area\": \"北京\",\"attachment\": \"attachment\",\"city\": \"北京\",\"contractNo\": \"0000001231231231\",\"endTime\": \"2017-07-21\",\"personIdNo\": \"110102198907132328\",\"personName\": \"小五\",\"rentalAddress\": \"北京市朝阳区银河SOHO1101室\",\"startTime\": \"2018-07-21\",\"subCompany\": \"蛋壳租房\"},\"source\": 0}";
JSONObject jo = JSONObject.fromObject(str);
System.out.println(jo.getString("houseBasicInfo"));
JSONObject j1 = JSONObject.fromObject(jo.getString("houseBasicInfo"));
System.out.println(j1.getString("address"));
System.out.println(j1.getString("area"));
System.out.println(j1.getString("cardPic"));
System.out.println("====================================");
System.out.println(jo.getString("merchantName"));
System.out.println(jo.getString("receiveContractInfo"));
System.out.println(jo.getString("source"));
// Iterator it=jo.keys();
// String key=null;
// String value=null;
// while(it.hasNext()){
// key=(String)it.next();
// value=jo.getString(key);
// System.out.println(value);
// }
// JSONObject obj = JSONObject.fromObject(str);
// String showapi=obj.getString("showapi_res_body");
// JSONObject obj1 = JSONObject.fromObject(showapi);
// System.out.println(obj1.get("Result"));
// JSONArray transitListArray = obj.getJSONArray("showapi_res_body");
// System.out.println(transitListArray.getString("Result"));
// for (int i = 0; i < transitListArray.size(); i++) {
// System.out.print("Array:" + transitListArray.getString(i) + " ");
// }
// System.out.println(jo.getString("Result"));
// System.out.println(jo.get("list"));
// JSONObject jo1 = (JSONObject)jo.get("list");
// System.out.println(jo1.get("phone"));
}
}
package test;
import java.text.SimpleDateFormat;
import java.util.Random;
import sun.net.www.http.HttpClient;
public class test1 {
public static void main(String[] args) {
SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmmss");
String dateStr = dateformat.format(System.currentTimeMillis());
System.out.println(dateStr);
System.out.println(new Random().nextInt(90000000)+ 10000000);
}
}
package test;
import java.lang.reflect.Method;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class testng1 {
@DataProvider(name = "user")
public Object[][] createUser(Method m) {
System.out.println(m.getName());
return new Object[][] { { "root", "root" }, { "test", "root" }, };
}
@Test(groups = "login", dependsOnGroups = "launch", dataProvider = "user")
public void verifyUser(String username, String password) {
System.out.println("Verify User : " + username + ":" + password);
assert username.equals(password);
}
}
package test;
import com.offcn.TestUnti.MyDateUtil;
public class time_test {
public static void main(String[] args) {
System.out.println(MyDateUtil.getTime(0, -10, 0));
}
}
package test;
import net.sf.json.JSONObject;
import com.offcn.TestUnti.SheetUtils;
import com.offcn.TestUnti.StringUtils;
public class w_excel {
public static void main(String[] args) {
SheetUtils sheet = new SheetUtils("a1.xls", "Output");
sheet.writeExcel(
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10"
);
}
}
@Override
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.get${SendRequest}Response(data, Url);
return re;
}
\ No newline at end of file
package ${package_name!};
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import org.json.simple.JSONArray;
import net.sf.json.JSONObject;
import com.puhui.process.GM;
import com.puhui.TestUnti.Log;
import com.puhui.TestUnti.MapUtil;
import com.puhui.TestUnti.RequestDataUtils;
import com.puhui.interfaces.RenMaiAPI;
/**
* ${implements_name!}
*
* @author puhui
*
*/
<#macro ergodic date s1 s2 s3>
<#list date! as map>
<#list map?keys as itemKey>
${s1!} ${itemKey!} ${s2!} ${map[itemKey]!} ${s3!}
</#list>
</#list>
</#macro>
<#macro ergodicKey date s1 s2 s3>
<#list date! as map>
<#list map?keys as itemKey>
${s1!} ${itemKey!} ${s2!}${itemKey!}${s3!}
</#list>
</#list>
</#macro>
public class ${class_name!} extends ${father_class_name} implements RenMaiAPI {
public String parameter;
<@ergodic date=parameters s1="public String" s2=";//" s3="" />
<#include "initialize.ftl"/>
<#include "handleInput.ftl"/>
<#include "SendRequest.ftl"/>
<#include "handleOutput.ftl"/>
}
<#import "code.ftl" as code />
@Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
<#if handleInput_Disable!false == true >
//获取parameter对应的内容
parameter = MapUtil.getValue("parameter", data);
<@ergodicKey date=parameters s1="" s2="= MapUtil.getParameter(parameter, \"" s3="\").trim();" />
Log.logInfo("替换前的parameter=" + parameter);
<#list handleInput_replaces! as item>
if ((!${item[0]}.equals("")) && ${item[0]}.equals("${item[1]}")) {
parameter = parameter.replace("\"${item[0]}\":${item[1]}", "\"${item[0]}\":\""+ ${item[2]} + "\"");
}
</#list>
Log.logInfo(data.get("Description").toString()+","+data.get("TCNO").toString()+"替换后的parameter=" + parameter);
//为后面sql查询做准备
<#list handleInputs_Verifications! as item>
${item[0]} = MapUtil.getParameter(parameter, "${item[0]}");
${item[0]} = MapUtil.killQuotes(${item[0]}, "\"").trim();
</#list>
// 替换原来的data
data.put("parameter", parameter);
</#if>
return data;
}
\ No newline at end of file
@Override
public String handleOutput(Response re, HashMap<String, Object> data) {
JsonPath jp = re.body().jsonPath();
boolean result = true;
String failReason = "";
String json = re.asString();
if ((data.get("statusCode") != null)
&& (!data.get("statusCode").toString()
.equals(String.valueOf(re.getStatusCode())))) {
result = result && false;
failReason = failReason + "statusCode is expected "
+ data.get("statusCode").toString() + " but actually "
+ String.valueOf(re.getStatusCode()) + ". ";
}
if (json.length() != 0) {
if ((data.get("errcode") != null)
&& ((jp.getString("errcode") == null) || (!jp.getString(
"errcode").equals(data.get("errcode").toString())))) {
result = result && false;
failReason = failReason + "errcode is expected "
+ data.get("errcode").toString() + " but actually "
+ jp.getString("errcode") + ".";
}
if ((data.get("errmsg") != null)
&& ((jp.getString("errmsg") == null) || (!jp.getString(
"errmsg").equals(data.get("errmsg").toString())))) {
result = result && false;
failReason = failReason + "errmsg is expected "
+ data.get("errmsg").toString() + " but actually "
+ jp.getString("errmsg") + ".";
}
if ((data.get("custom") != null)
&& ((jp.getString("custom") == null) || (jp.getString("custom").indexOf(data.get("custom").toString())==-1))) {
result = result && false;
failReason = failReason + "custom is expected "
+ data.get("custom").toString() + " but actually "
+ jp.getString("custom") + ".";
}
//如果商品信息表id不等于空,商品信息录入
if ("0".equals(jp.getString("errcode"))) {
<#list handleOutput_saves?keys as map>
String ${map!} = jp.getString("${map!}");
<#list handleOutput_saves[map]! as lst>
${lst!}
</#list>
</#list>
try {
//查看huimai.bestbuy_goods是否插入成功
ResultSet rs_good = this.selectFromDB("${handleOutput_Table!}", ${handleOutput_TableKey!});
rs_good.last();
if (rs_good.getRow() < 1) {
result = result && false;
failReason = failReason + "It is not added to DB;";
} else {
<#list handleInputs_Verifications! as item>
if (!rs_good.getString(rs_good.findColumn("${item[0]}"))
.equals(${item[0]})) {
result = result && false;
failReason = failReason + "${item[0]} in DB is wrong;";
} else {
Log.logInfo("${item[0]} in DB is correct;");
}
</#list>
}
} catch (Exception e) {
System.out.println("DB record cannot be verified");
e.printStackTrace();
result = result && false;
}
}
}
if (result)
return "Pass";
else
return "Fail:" + failReason;
}
\ No newline at end of file
@Override
public void initialize(HashMap<String, Object> data) {
<#if initialize_Disable!false == true >
Statement ps = null;
<#list initializes! as map>
<#list map?keys as itemKey>
<#if map[itemKey] !="">
<#if itemKey! != "insert" && itemKey! != "delelt" && itemKey! != "update">
try {
ps = conn.createStatement();
ResultSet rs = ps.executeQuery(${map[itemKey]!});
while(rs.next()){
${itemKey!}=rs.getString(1);
}
} catch (SQLException e) {
System.out.println("Insert failed!");
}finally{
try {
if(ps!=null){
ps.close();
}
}catch (SQLException e) {
}
}
<#else>
try {
ps = conn.createStatement();
int result = ps.executeUpdate(${map[itemKey]!});
if (result == -1) {
System.out.println("Insert failed!");
}
} catch (SQLException e) {
System.out.println("Insert failed!");
}finally{
try {
if(ps!=null){
ps.close();
}
}catch (SQLException e) {
}
}
</#if>
</#if>
</#list>
</#list>
</#if>
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<classes>
<class name="com.puhui.test.BestbuyGMAPITest">
<methods>
<include name="test"/>
</methods>
</class>
</classes>
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
</test> <!-- Test -->
</suite> <!-- Suite -->
<?xml version="1.0" encoding="UTF-8"?>
<package_name name="com.puhui.api.zy">
<class_name name="support"></class_name>
<father_class_name name="ZY"></father_class_name>
<implements_name name="获取所支持银行列表"></implements_name>
<!-- 参数:name是参数名,标签内容是备注-->
<parameters>
<!--
<parameter name="openId">openId</parameter>
<parameter name="openId111">openId111</parameter>
<parameter name="productName">商品名称</parameter>
<parameter name="busiId">商户Id(更美)</parameter>
<parameter name="busiName">商户名称 </parameter>
<parameter name="productPrice">商户价格</parameter>
<parameter name="sqlRs">查询结果</parameter>
-->
</parameters>
<initialize_Disable>false</initialize_Disable>
<initializes>
<initialize name="insert">"insert into huimai.bestbuy_sub_busi (busi_id,sub_busi_name,busi_id_third,create_time) "+ "values('999','" + thirdBusi.get("busiName") + "','" + thirdBusi.get("busiId") + "', NOW())"</initialize>
<initialize name="delelt"></initialize>
<initialize name="update"></initialize>
<initialize name="select" value="sqlRs">"selecrt * from word"</initialize>
</initializes>
<handleInput_Disable>false</handleInput_Disable>
<handleInput_replaces>
<handleInput_replace name="openId" type="code" >data_ext.get("openId").toString()</handleInput_replace>
<handleInput_replace name="busiId" type="code" >thirdBusi.get("busiId")</handleInput_replace>
<handleInput_replace name="busiName" type="code" >thirdBusi.get("busiName")</handleInput_replace>
</handleInput_replaces>
<handleInputs_Verifications>
<handleInputs_Verification name="productName"></handleInputs_Verification>
<handleInputs_Verification name="productPrice"></handleInputs_Verification>
</handleInputs_Verifications>
<SendRequest_Disable>true</SendRequest_Disable>
<SendRequest name="Get"></SendRequest>
<handleOutput_Disable>false</handleOutput_Disable>
<handleOutput_saves>
<handleOutput_save name="productId">
<handleOutput>prod_ids.add(productId);</handleOutput>
<handleOutput>data_ext.put("productId", productId);</handleOutput>
</handleOutput_save>
</handleOutput_saves>
<handleOutput_Table name="huimai.bestbuy_goods">"id=" + productId</handleOutput_Table>
</package_name>
<?xml version="1.0" encoding="UTF-8"?>
<package_name name="com.puhui.api.rgxs">
<class_name name="commitOrderApprove"></class_name>
<father_class_name name="GM"></father_class_name>
<implements_name name="订单模式,人工信审-结论"></implements_name>
<!-- 参数:name是参数名,标签内容是备注-->
<parameters>
<parameter name="Description">用例名称</parameter>
<parameter name="auditRecordId">人工信审工单处理记录表ID</parameter>
<parameter name="audit_result">人工信审结论</parameter>
<parameter name="engine_result">决策引擎结论</parameter>
</parameters>
<initialize_Disable>false</initialize_Disable>
<initializes>
<initialize name="insert">"insert into huimai.bestbuy_sub_busi (busi_id,sub_busi_name,busi_id_third,create_time) "+ "values('999','" + thirdBusi.get("busiName") + "','" + thirdBusi.get("busiId") + "', NOW())"</initialize>
<initialize name="delelt"></initialize>
<initialize name="update"></initialize>
<initialize name="select" value="sqlRs">"selecrt * from word"</initialize>
</initializes>
<handleInput_Disable>true</handleInput_Disable>
<handleInput_replaces>
<handleInput_replace name="auditRecordId" type="code" >thirdBusi.get("busiId")</handleInput_replace>
</handleInput_replaces>
<handleInputs_Verifications>
<handleInputs_Verification name="audit_result"></handleInputs_Verification>
<handleInputs_Verification name="engine_result"></handleInputs_Verification>
</handleInputs_Verifications>
<SendRequest_Disable>true</SendRequest_Disable>
<SendRequest name="Post"></SendRequest>
<handleOutput_Disable>true</handleOutput_Disable>
<handleOutput_saves>
<handleOutput_save name="productId">
<handleOutput>prod_ids.add(productId);</handleOutput>
<handleOutput>data_ext.put("productId", productId);</handleOutput>
</handleOutput_save>
</handleOutput_saves>
<handleOutput_Table name="huimai.bestbuy_goods">"id=" + productId</handleOutput_Table>
</package_name>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment