Skip to content

Commit 10fcf13

Browse files
author
Brendan W. McAdams
committed
Revert "Changed testng.xml to run tests in all packages under com.mongodb and org.bson, instead of explicitly naming test classes. This is less error prone, since committers have not always added new test classes to testng.xml. Now unit tests run a lot more tests. Two tests that weren't running before are failing, so I commented them out. For one there is a known bug which is referenced, the other I'm still debugging with the committer."
This reverts commit d846b7a.
1 parent cc9b4f3 commit 10fcf13

File tree

3 files changed

+45
-22
lines changed

3 files changed

+45
-22
lines changed

src/test/com/mongodb/DBPortPoolTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
import java.util.concurrent.TimeUnit;
2424

2525
import org.testng.Assert;
26-
import org.testng.annotations.Test;
26+
2727

2828
public class DBPortPoolTest extends com.mongodb.util.TestCase {
2929

30-
@Test
30+
@org.testng.annotations.Test
3131
public void testReuse() throws Exception {
3232
final DBPortPool pool = new DBPortPool( new ServerAddress( "localhost" ), new MongoOptions() );
3333
DBPort[] ports = new DBPort[10];
@@ -43,11 +43,10 @@ public void testReuse() throws Exception {
4343
@Override
4444
public void run(){
4545
try {
46-
Thread.sleep( 100 );
47-
} catch ( InterruptedException e ) {
48-
}
46+
Thread.sleep( 100 ); } catch ( InterruptedException e ) { e.printStackTrace( System.out );}
4947
DBPort p = pool.get();
5048
pool.done( p );
49+
//System.out.println( "threadId:" + p._lastThread + " , code:" + p.hashCode() );
5150
}
5251
});
5352
}
@@ -58,7 +57,7 @@ public void run(){
5857
Assert.assertTrue(es.awaitTermination( 1, TimeUnit.SECONDS ));
5958

6059
for(int x = 2; x<8; x++) {
61-
// Assert.assertNotSame( 0 , ports[x]._lastThread, x + ":" + ports[x].hashCode());
60+
Assert.assertNotSame( 0 , ports[x]._lastThread, x + ":" + ports[x].hashCode());
6261
}
6362

6463
assertEquals( 10 , pool.everCreated() );

src/test/com/mongodb/DBTCPConnectorTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,14 @@ public void testConnectionReservationForWriteThenRead() {
8787
/**
8888
* Tests that same connections is used for sequential reads
8989
*/
90-
// TODO: re-enable this test for JAVA-498
91-
// @Test
92-
// public void testConnectionReservationForReads() {
93-
// _connector.requestStart();
94-
// _connector.call(_db, _collection,
95-
// OutMessage.query(cleanupMongo, 0, _collection.getFullName(), 0, -1, new BasicDBObject(), new BasicDBObject(), ReadPreference.PRIMARY),
96-
// null, 0);
97-
// assertNotNull(_connector.getMyPort()._requestPort);
98-
// }
90+
@Test
91+
public void testConnectionReservationForReads() {
92+
_connector.requestStart();
93+
_connector.call(_db, _collection,
94+
OutMessage.query(cleanupMongo, 0, _collection.getFullName(), 0, -1, new BasicDBObject(), new BasicDBObject(), ReadPreference.PRIMARY),
95+
null, 0);
96+
assertNotNull(_connector.getMyPort()._requestPort);
97+
}
9998

10099

101100
private OutMessage createOutMessageForInsert() {

testng.xml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
1+
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd">
22

33
<!--
44
Copyright 2011, 10gen
@@ -16,13 +16,38 @@ See the License for the specific language governing permissions and
1616
limitations under the License.
1717
-->
1818

19-
<suite name="driver">
19+
<suite name="appserver" >
2020

21-
<test name="main">
22-
<packages>
23-
<package name="com.mongodb.*"/>
24-
<package name="org.bson.*"/>
25-
</packages>
21+
<test name="main tests">
22+
<classes>
23+
<class name="com.mongodb.util.SimplePoolTest"/>
24+
<class name="com.mongodb.util.JSONTest"/>
25+
<class name="com.mongodb.io.ByteBufferStreamTest"/>
26+
<class name="org.bson.PoolOutputBufferTest"/>
27+
<class name="org.bson.BSONTest"/>
28+
<class name="org.bson.util.ClassMapTest"/>
29+
<class name="org.bson.util.StringRangeSetTest"/>
30+
<class name="com.mongodb.ByteTest"/>
31+
<class name="com.mongodb.BasicDBObjectTest"/>
32+
<class name="com.mongodb.JavaClientTest"/>
33+
<class name="com.mongodb.ReflectionTest"/>
34+
<class name="com.mongodb.DBAddressTest"/>
35+
<class name="com.mongodb.DBTest"/>
36+
<class name="com.mongodb.DBTests"/>
37+
<class name="com.mongodb.DBObjectTest"/>
38+
<class name="com.mongodb.DBCollectionTest"/>
39+
<class name="com.mongodb.ReplicaSetStatusTest"/>
40+
<class name="com.mongodb.DBCursorTest"/>
41+
<class name="com.mongodb.ObjectIdTest"/>
42+
<class name="com.mongodb.DBRefTest"/>
43+
<class name="com.mongodb.QueryBuilderTest"/>
44+
<class name="com.mongodb.ErrorTest"/>
45+
<class name="com.mongodb.ThreadingTest"/>
46+
<class name="com.mongodb.MongoURITest"/>
47+
<class name="com.mongodb.MongoOptionsTest"/>
48+
<class name="com.mongodb.SecondaryReadTest"/>
49+
<class name="com.mongodb.SecondaryLoadBalanceTest"/>
50+
</classes>
2651
</test>
2752

2853
</suite>

0 commit comments

Comments
 (0)