Ailton Mizuki Sato 9 years ago
parent
commit
66c9ab6c8d

+ 17 - 17
.classpath

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<classpath>
3
-	<classpathentry kind="src" path="src"/>
4
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5
-	<classpathentry kind="lib" path="lib/commons-codec-1.9.jar"/>
6
-	<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
7
-	<classpathentry kind="lib" path="lib/fluent-hc-4.5.jar"/>
8
-	<classpathentry kind="lib" path="lib/httpclient-4.5.jar"/>
9
-	<classpathentry kind="lib" path="lib/httpclient-cache-4.5.jar"/>
10
-	<classpathentry kind="lib" path="lib/httpclient-win-4.5.jar"/>
11
-	<classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/>
12
-	<classpathentry kind="lib" path="lib/httpmime-4.5.jar"/>
13
-	<classpathentry kind="lib" path="lib/jna-4.1.0.jar"/>
14
-	<classpathentry kind="lib" path="lib/jna-platform-4.1.0.jar"/>
15
-	<classpathentry kind="lib" path="lib/json-20090211.jar"/>
16
-	<classpathentry kind="output" path="bin"/>
17
-</classpath>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<classpath>
3
+	<classpathentry kind="src" path="src"/>
4
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-8-oracle"/>
5
+	<classpathentry kind="lib" path="lib/commons-codec-1.9.jar"/>
6
+	<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
7
+	<classpathentry kind="lib" path="lib/fluent-hc-4.5.jar"/>
8
+	<classpathentry kind="lib" path="lib/httpclient-4.5.jar"/>
9
+	<classpathentry kind="lib" path="lib/httpclient-cache-4.5.jar"/>
10
+	<classpathentry kind="lib" path="lib/httpclient-win-4.5.jar"/>
11
+	<classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/>
12
+	<classpathentry kind="lib" path="lib/httpmime-4.5.jar"/>
13
+	<classpathentry kind="lib" path="lib/jna-4.1.0.jar"/>
14
+	<classpathentry kind="lib" path="lib/jna-platform-4.1.0.jar"/>
15
+	<classpathentry kind="lib" path="lib/json-20090211.jar"/>
16
+	<classpathentry kind="output" path="bin"/>
17
+</classpath>

+ 1 - 1
config.properties

1
 
1
 
2
-domain = http://50.30.37.180:38080/snail/
2
+domain = http://localhost:7000/servlet/
3
 
3
 
4
 #domain= http://localhost:8080/Servlet/
4
 #domain= http://localhost:8080/Servlet/
5
 
5
 

+ 14 - 8
src/test/Start.java

16
 import test.servlet.event.post.TestUpdateCategory;
16
 import test.servlet.event.post.TestUpdateCategory;
17
 import test.servlet.event.post.TestUpdateItem;
17
 import test.servlet.event.post.TestUpdateItem;
18
 import test.servlet.user.get.TestExistsUser;
18
 import test.servlet.user.get.TestExistsUser;
19
+import test.servlet.user.get.TestUserGetInfo;
19
 import test.servlet.user.post.TestCreateUser;
20
 import test.servlet.user.post.TestCreateUser;
20
 import test.servlet.user.post.TestLogin;
21
 import test.servlet.user.post.TestLogin;
21
 import test.servlet.user.post.TestUpdateUser;
22
 import test.servlet.user.post.TestUpdateUser;
28
 	{
29
 	{
29
 		List<ServletTest> tests = new ArrayList<ServletTest>();
30
 		List<ServletTest> tests = new ArrayList<ServletTest>();
30
 
31
 
31
-		tests.add(new TestServletConnection() );
32
-
33
-		tests.add(new TestImportDataFacebook() );
32
+		//tests.add(new TestServletConnection() );
33
+		
34
+		tests.add(new TestLogin());
35
+		tests.add(new TestUserGetInfo());
36
+		
37
+		
38
+		
39
+		//tests.add(new TestCreateUser());
40
+		
41
+
42
+		/*tests.add(new TestImportDataFacebook() );
34
 		tests.add(new TestGetCategories());
43
 		tests.add(new TestGetCategories());
35
 		tests.add(new TestSearch());
44
 		tests.add(new TestSearch());
36
 
45
 
44
 
53
 
45
 		tests.add(new TestExistsUser());
54
 		tests.add(new TestExistsUser());
46
 		tests.add(new TestCreateUser());
55
 		tests.add(new TestCreateUser());
47
-		tests.add(new TestLogin());
48
-		tests.add(new TestUpdateUser());
56
+		
57
+		tests.add(new TestUpdateUser());*/
49
 	
58
 	
50
 
59
 
51
-
52
 		return tests;
60
 		return tests;
53
 	}
61
 	}
54
 
62
 
55
 
63
 
56
-
57
 	public static void main (String [] args){
64
 	public static void main (String [] args){
58
 
65
 
59
 		List<ServletTest> tests = generateList();
66
 		List<ServletTest> tests = generateList();
60
-
61
 		for(ServletTest test : tests)
67
 		for(ServletTest test : tests)
62
 		{
68
 		{
63
 			test.runTest();
69
 			test.runTest();

+ 1 - 1
src/test/resource/ServletTest.java

74
 	protected boolean analyse(String result) throws Exception{
74
 	protected boolean analyse(String result) throws Exception{
75
 		this.result = result;
75
 		this.result = result;
76
 		JSONArray json = new JSONArray(result);
76
 		JSONArray json = new JSONArray(result);
77
-		return json.getJSONObject(1).getBoolean("request");
77
+		return json.getJSONObject(0).getInt("code") == 1;
78
 	}
78
 	}
79
 
79
 
80
 	public String toString() {
80
 	public String toString() {

+ 1 - 1
src/test/resource/ServletTestPost.java

36
 		boolean firstResult = super.analyse(result);
36
 		boolean firstResult = super.analyse(result);
37
 		Pair<String, String > check = this.buildCheckSum();
37
 		Pair<String, String > check = this.buildCheckSum();
38
 		
38
 		
39
-		String value = json.getJSONObject(0).getString(check.getKey());
39
+		String value = json.getJSONObject(0).getJSONArray("result").getJSONObject(0).getString(check.getKey());
40
 	
40
 	
41
 		
41
 		
42
 		boolean secondResult = value.equals(check.getValue());
42
 		boolean secondResult = value.equals(check.getValue());

+ 4 - 5
src/test/servlet/user/post/TestCreateUser.java

14
 		
14
 		
15
 		StringGenerator stringGen = new StringGenerator();
15
 		StringGenerator stringGen = new StringGenerator();
16
 		Map <String , String> parameters = new HashMap<String , String>();
16
 		Map <String , String> parameters = new HashMap<String , String>();
17
-		parameters.put("name", "Fernanda");
18
-		parameters.put("born_date", "1991-04-22");
19
-		parameters.put("sex", "m");
17
+		parameters.put("name", "Ailton");
20
 		parameters.put("password", "99719797");
18
 		parameters.put("password", "99719797");
21
 		parameters.put("email", stringGen.generateEmail());
19
 		parameters.put("email", stringGen.generateEmail());
22
 		
20
 		
21
+		
23
 		return parameters;
22
 		return parameters;
24
 		
23
 		
25
 	}
24
 	}
27
 	@Override
26
 	@Override
28
 	public String buildUrl() {
27
 	public String buildUrl() {
29
 		// TODO Auto-generated method stub
28
 		// TODO Auto-generated method stub
30
-		return "user?method=create_user";
29
+		return "user?method=register";
31
 	}
30
 	}
32
 
31
 
33
 	@Override
32
 	@Override
34
 	public Pair<String, String> buildCheckSum() {
33
 	public Pair<String, String> buildCheckSum() {
35
 		// TODO Auto-generated method stub
34
 		// TODO Auto-generated method stub
36
-		return new Pair<String, String>("name", "Fernanda");
35
+		return new Pair<String, String>("name", "Ailton");
37
 	}
36
 	}
38
 	
37
 	
39
 }
38
 }

+ 3 - 2
src/test/servlet/user/post/TestLogin.java

13
 		// TODO Auto-generated method stub
13
 		// TODO Auto-generated method stub
14
 		Map <String , String> parameters = new HashMap<String , String>();
14
 		Map <String , String> parameters = new HashMap<String , String>();
15
 		
15
 		
16
+		//parameters.put("password", "77e5ffa08c103c4982f2a24be0c9cbd6");
17
+		parameters.put("email", "9xqd1bax@hotmail.com");
16
 		parameters.put("password", "99719797");
18
 		parameters.put("password", "99719797");
17
-		parameters.put("email", "ailton@gmail.com");
18
 		
19
 		
19
 		
20
 		
20
 		return parameters;
21
 		return parameters;
30
 	@Override
31
 	@Override
31
 	public Pair<String, String> buildCheckSum() {
32
 	public Pair<String, String> buildCheckSum() {
32
 		// TODO Auto-generated method stub
33
 		// TODO Auto-generated method stub
33
-		return new Pair<String, String>("name","ailton" );
34
+		return new Pair<String, String>("name","Ailton" );
34
 	}
35
 	}
35
 	
36
 	
36
 	
37