Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
test-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马博
test-platform
Commits
896ac173
Commit
896ac173
authored
Oct 18, 2018
by
马博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add serviceDoctor
parent
92399ded
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
258 deletions
+62
-258
ServiceDoctor.java
src/test/java/base/ServiceDoctor.java
+1
-1
TestListener.java
src/test/java/base/TestListener.java
+0
-4
Testhttp_Test.java
src/test/java/http/Testhttp_Test.java
+0
-14
http1_Test.java
src/test/java/http/cases/http1_Test.java
+0
-113
http2_Test.java
src/test/java/http/cases/http2_Test.java
+0
-38
http_Test.java
src/test/java/http/cases/http_Test.java
+0
-60
test.java
src/test/java/http/cases/test.java
+35
-0
test.java
src/test/java/test.java
+26
-28
No files found.
src/test/java/
utils
/ServiceDoctor.java
→
src/test/java/
base
/ServiceDoctor.java
View file @
896ac173
package
utils
;
package
base
;
import
io.restassured.response.Response
;
import
org.apache.logging.log4j.LogManager
;
...
...
src/test/java/base/TestListener.java
View file @
896ac173
...
...
@@ -2,11 +2,7 @@ package base;
import
java.util.Iterator
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.AnnotationConfigApplicationContext
;
import
org.springframework.core.env.Environment
;
import
org.testng.*
;
import
utils.ServiceDoctor
;
/**
* Created by mabo on 2018/9/29
...
...
src/test/java/http/Testhttp_Test.java
deleted
100644 → 0
View file @
92399ded
package
http
;
import
org.springframework.stereotype.Service
;
/**
* Created by mabo on 2018/9/20
*/
@Service
public
class
Testhttp_Test
{
public
void
test
(){
// throw new Exception("hello");
System
.
out
.
println
(
"hello"
);
}
}
src/test/java/http/cases/http1_Test.java
deleted
100644 → 0
View file @
92399ded
package
http
.
cases
;
import
base.DuibaBase
;
import
base.DuibaLog
;
import
base.DuibaTestBase
;
import
base.MysqlUtils
;
import
org.apache.commons.dbcp2.BasicDataSource
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.testng.annotations.Test
;
import
java.sql.Connection
;
import
java.sql.Driver
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ThreadPoolExecutor
;
/**
* Created by mabo on 2018/9/30
*/
public
class
http1_Test
extends
DuibaBase
{
@Value
(
"${pluginTest.project}"
)
String
ManagerHost
;
@Value
(
"${db.driver}"
)
String
DRIVER
;
public
DuibaLog
log
=
DuibaLog
.
getLogger
();
@Test
public
void
test1
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
5
);
System
.
out
.
println
(
ManagerHost
);
System
.
out
.
println
(
DRIVER
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
System
.
out
.
print
(
""
);
}
@Test
public
void
test2
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
6
);
log
.
info
(
" log test "
);
log
.
info
(
" log test1 "
);
log
.
info
(
" log test2 "
);
log
.
info
(
" log test3 "
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
}
@Test
public
void
test3
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
System
.
out
.
println
(
7
);
}
@Test
public
void
test4
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
8
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
}
public
static
void
main
(
String
[]
args
)
throws
SQLException
{
// BasicDataSource bds = new BasicDataSource();
// bds.setDriverClassName("com.mysql.jdbc.Driver");
// bds.setUrl("jdbc:mysql://rdswy2b9wy53044250u1o.mysql.rds.aliyuncs.com:3306/");
// bds.setUsername("duiba_test");
// bds.setPassword("svbP3KUw2PurAnBb2rbs3vohF");
// bds.setMaxTotal(3);
//
// Connection conn = bds.getConnection();
// System.out.println(conn);
// conn = bds.getConnection();
// System.out.println(conn);
// conn = bds.getConnection();
// System.out.println(conn);
// conn.close();
// conn = bds.getConnection();
// System.out.println(conn);
// MysqlUtils sql = new MysqlUtils();
// Map<String,Object> map = sql.findSimpleResultBybds("select * from dafuweng.user where id=2709");
// System.out.println("hello");
ExecutorService
tp
=
Executors
.
newFixedThreadPool
(
100
);
int
i
=
0
;
while
(
i
<
100
){
tp
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
Thread
.
sleep
(
1000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
System
.
out
.
println
(
Thread
.
currentThread
().
getName
());
}
});
i
--;
}
}
}
src/test/java/http/cases/http2_Test.java
deleted
100644 → 0
View file @
92399ded
package
http
.
cases
;
import
base.DuibaBase
;
import
base.DuibaTestBase
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
import
java.util.Map
;
/**
* Created by mabo on 2018/9/30
*/
public
class
http2_Test
extends
DuibaBase
{
@Test
public
void
test1
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
System
.
out
.
println
(
9
);
}
@Test
public
void
test2
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
System
.
out
.
println
(
10
);
}
@Test
public
void
test3
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
11
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
}
@Test
public
void
test4
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
12
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
}
}
src/test/java/http/cases/http_Test.java
deleted
100644 → 0
View file @
92399ded
package
http
.
cases
;
import
base.DuibaBase
;
import
base.DuibaTestBase
;
import
base.MysqlConnPool
;
import
http.service.testservice
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.SkipException
;
import
org.testng.annotations.BeforeSuite
;
import
org.testng.annotations.Test
;
import
java.sql.SQLException
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Random
;
/**
* Created by mabo on 2018/9/30
*/
public
class
http_Test
extends
DuibaBase
{
@Autowired
testservice
test
;
@Test
public
void
test1
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
1
);
System
.
out
.
println
(
"run"
);
test
.
test
();
// Map<String,Object> map = jdbc1.findSimpleResult("select * from dafuweng.user where id=2709");
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
System
.
out
.
println
(
"run111"
);
}
@Test
public
void
test2
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
2
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
Random
rand
=
new
Random
();
Assert
.
assertEquals
(
1
,
rand
.
nextInt
(
2
));
}
@Test
public
void
test3
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
System
.
out
.
println
(
3
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
Assert
.
assertEquals
(
1
,
2
);
}
@Test
public
void
test4
()
throws
InterruptedException
,
SQLException
{
Thread
.
sleep
(
1000
);
Properties
prop
=
System
.
getProperties
();
String
OS
=
prop
.
getProperty
(
"os.name"
);
System
.
out
.
println
(
OS
);
Map
<
String
,
Object
>
map
=
jdbc
.
findSimpleResult
(
"select * from dafuweng.user where id=2709"
);
}
}
src/test/java/http/cases/test.java
0 → 100644
View file @
896ac173
package
http
.
cases
;
/**
* Created by mabo on 2018/10/17
*/
import
java.util.ArrayList
;
import
java.util.List
;
/*
* 堆oom
* 类的实例放到heap中,所以不断创建类就可以测试出heap的oom了
* jconsole可以监控资源
*
* Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
*/
public
class
test
{
static
class
TestHeepObject
{
}
public
static
void
main
(
String
[]
args
)
{
List
<
TestHeepObject
>
heapList
=
new
ArrayList
<
TestHeepObject
>();
while
(
true
)
{
// try {
// Thread.sleep(100);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
heapList
.
add
(
new
TestHeepObject
());
}
}
}
src/test/java/test.java
View file @
896ac173
import
base.DuibaBase
;
import
base.DuibaLog
;
import
http.Testhttp_Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
import
ui.Testui
;
...
...
@@ -13,31 +11,31 @@ import java.util.Random;
* Created by mabo on 2018/9/20
*/
public
class
test
extends
DuibaBase
{
@Autowired
Testhttp_Test
test
;
@Autowired
Testui
testui
;
public
static
int
i
=
2
;
public
DuibaLog
log
=
DuibaLog
.
getLogger
();
@Test
public
void
test
(){
test
.
test
();
testui
.
test
();
Random
rand
=
new
Random
();
log
.
info
(
"test log"
);
// Assert.assertEquals(1,rand.nextInt(2));
}
@Test
public
void
test1
(){
i
=
i
-
1
;
}
//
@Autowired
//
Testhttp_Test test;
//
@Autowired
//
Testui testui;
//
//
public static int i=2;
//
public DuibaLog log = DuibaLog.getLogger();
//
@Test
//
public void test(){
//
test.test();
//
testui.test();
//
//
Random rand = new Random();
//
//
log.info("test log");
//
//
Assert.assertEquals(1,rand.nextInt(2));
//
//
//
//
//
//
}
//
@Test
//
public void test1(){
//
i=i-1;
//
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment