From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3086 invoked by alias); 16 Jun 2006 18:30:18 -0000 Received: (qmail 3072 invoked by uid 22791); 16 Jun 2006 18:30:16 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 16 Jun 2006 18:30:06 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k5GIU5xX007182 for ; Fri, 16 Jun 2006 14:30:05 -0400 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k5GITxU6030559 for ; Fri, 16 Jun 2006 14:29:59 -0400 Received: from [172.16.14.37] (toadstool.toronto.redhat.com [172.16.14.37]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id k5GITwve001368 for ; Fri, 16 Jun 2006 14:29:59 -0400 Message-ID: <4492F8A6.2010406@redhat.com> Date: Fri, 16 Jun 2006 18:30:00 -0000 From: Kyle Galloway User-Agent: Thunderbird 1.5.0.2 (X11/20060501) MIME-Version: 1.0 To: mauve-patches@sources.redhat.com Subject: RFA JDWP Event Filter Tests References: <44917466.5090406@redhat.com> <20060615153429.GO30916@mail.konqueror.de> <4491952A.1040508@redhat.com> <20060615173634.GQ30916@mail.konqueror.de> <4492D1C4.2070600@redhat.com> <20060616175251.GW30916@mail.konqueror.de> <4492F110.4000805@redhat.com> <20060616180321.GY30916@mail.konqueror.de> In-Reply-To: <20060616180321.GY30916@mail.konqueror.de> Content-Type: multipart/mixed; boundary="------------060307060901090506090200" X-IsSubscribed: yes Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2006/txt/msg00428.txt.bz2 This is a multi-part message in MIME format. --------------060307060901090506090200 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1806 Alright I have changed the tags on these tests. Same tests as before, but all tagged as GNU-JDWP. I submitted these as one patch since the comprise a full set of tests for the JDWP event filters. Requesting approval and commit(I don't have access). Thanks, Kyle 2006-06-16 Kyle Galloway * gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassMatchFilter.java: New Test. * gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassExcludeFilter.java: New Test. * gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassOnlyFilter.java: New Test. * gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfCountFilter.java: New Test. * gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfExceptionOnlyFilter.java: New Test. * gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfInstanceOnlyFilter.java: New Test. * gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfThreadOnlyFilter.java: New Test. Michael Koch wrote: > On Fri, Jun 16, 2006 at 01:57:36PM -0400, Kyle Galloway wrote: > >> Michael Koch wrote: >> >>> On Fri, Jun 16, 2006 at 11:44:04AM -0400, Kyle Galloway wrote: >>> >>> >>>> Looking at the GNU-Crypto tests, I think that the JDWP test should be >>>> tagged GNU-JDWP JDK 1.4. Any comments about this idea? >>>> >>>> >>> As AFAIK a new tag begins after a whitespace this would be three tags >>> with two of them wrong. >>> >>> >> Ok, so would just GNU-JDWP be the best option, I don't know much about >> how these tags work, but this seems like it would allow for these tests >> to be excluded from the normal Classpath vs Sun tests while still being >> able to call the whole set of them to test all the JDWP filters. >> > > Ok. > > > Michael > --------------060307060901090506090200 Content-Type: text/x-patch; name="patch.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.diff" Content-length: 31376 Index: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassExcludeFilter.java =================================================================== RCS file: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassExcludeFilter.java diff -N gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassExcludeFilter.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassExcludeFilter.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,150 @@ +/* TestOfClassExcludeFilter.java -- test of ClassExcludeFilter + + Written by Kyle Galloway (kgallowa@redhat.com) + + This file is part of Mauve. + + Mauve is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Mauve is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Mauve; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + */ + +// Tags: GNU-JDWP + + +package gnu.testlet.gnu.classpath.jdwp.event.filters; + +import gnu.classpath.jdwp.event.ClassPrepareEvent; +import gnu.classpath.jdwp.event.filters.ClassExcludeFilter; +import gnu.classpath.jdwp.event.filters.ClassMatchFilter; +import gnu.classpath.jdwp.exception.InvalidStringException; +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +/** + * @author Kyle Galloway (kgallowa@redhat.com) This class performs a test of the + * ClassExcludeFilter from JDWP. + */ +public class TestOfClassExcludeFilter + implements Testlet +{ + + /** + * Tests the ClassMatchFilter constructor + * + * @param harness the TestHarness to use + */ + public void testConstructor(TestHarness harness) + { + harness.checkPoint("Constructor"); + + ClassMatchFilter testCMF = null; + + String[] validStrings = { "SomeString", "", "*omeString", "SomeStr*" }; + String[] invalidStrings = { "Som*String", "SomeStri*g" }; + + // check to see if the valid strings don't throw exceptions + for (int i = 0; i < validStrings.length; i++) + { + try + { + testCMF = new ClassMatchFilter(validStrings[i]); + harness.check(true); + } + catch (InvalidStringException ex) + { + harness.check(false, "constructor threw exception for valid " + + "string: " + validStrings[i]); + } + } + + // check that invalid strings throw exceptions + for (int i = 0; i < invalidStrings.length; i++) + { + try + { + testCMF = new ClassMatchFilter(invalidStrings[i]); + harness.check(false, "constructor didn't throw exception for " + + "invalid string: " + invalidStrings[i]); + } + catch (InvalidStringException ex) + { + harness.check(true); + } + } + } + + /** + * Tests the ClassExcludeFilter from + * + * @param harness the TestHarness to use + */ + public void testMatches(TestHarness harness) + { + harness.checkPoint("matches method"); + String[] validStrings = { "java.lang.Integer", "*nteger", "java.lang.*", + "*" }; + String[] invalidStrings = { "Float", "Double", "AWT" }; + + ClassExcludeFilter testCEF = null; + + // create an event to use as a test + ClassPrepareEvent testEvent = new ClassPrepareEvent(Thread.currentThread(), + Integer.class, 0); + + // check to see that the matching strings match the class name + for (int i = 0; i < validStrings.length; i++) + { + try + { + testCEF = new ClassExcludeFilter(validStrings[i]); + harness.check(testCEF.matches(testEvent), false, "for string: " + + validStrings[i]); + } + catch (InvalidStringException ex) + { + harness.check(false, "valid String: " + validStrings[i] + " threw " + + ex); + } + } + + // check to see that the nonmatching strings don't match the class name + for (int i = 0; i < invalidStrings.length; i++) + { + try + { + testCEF = new ClassExcludeFilter(invalidStrings[i]); + harness.check(testCEF.matches(testEvent), true, "for string: " + + invalidStrings[i]); + } + catch (InvalidStringException ex) + { + harness.check(false, "valid String: " + invalidStrings[i] + + " threw " + ex); + } + } + } + + /** + * Test the ClassExcludeFilter class + * + * @param harness the TestHarness to use + */ + public void test(TestHarness harness) + { + testConstructor(harness); + testMatches(harness); + } +} Index: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassMatchFilter.java =================================================================== RCS file: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassMatchFilter.java diff -N gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassMatchFilter.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassMatchFilter.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,150 @@ +/* TestOfClassMatchFilter.java -- test of ClassMatchFilter + + Written by Kyle Galloway (kgallowa@redhat.com) + + This file is part of Mauve. + + Mauve is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Mauve is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Mauve; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + */ + +// Tags: GNU-JDWP + + +package gnu.testlet.gnu.classpath.jdwp.event.filters; + +import gnu.classpath.jdwp.event.ClassPrepareEvent; +import gnu.classpath.jdwp.event.filters.ClassMatchFilter; +import gnu.classpath.jdwp.exception.InvalidStringException; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +/** + * @author Kyle Galloway (kgallowa@redhat.com) This class performs a test of the + * ClassMatchFilter from JDWP. + */ +public class TestOfClassMatchFilter + implements Testlet +{ + + /** + * Tests the ClassMatchFilter constructor + * + * @param harness the TestHarness to use + */ + public void testConstructor(TestHarness harness) + { + harness.checkPoint("Constructor"); + + ClassMatchFilter testCMF = null; + + String[] validStrings = { "SomeString", "", "*omeString", "SomeStr*" }; + String[] invalidStrings = { "Som*String", "SomeStri*g" }; + + // check to see if the valid strings don't throw exceptions + for (int i = 0; i < validStrings.length; i++) + { + try + { + testCMF = new ClassMatchFilter(validStrings[i]); + harness.check(true); + } + catch (InvalidStringException ex) + { + harness.check(false, "constructor threw exception for valid " + + "string: " + validStrings[i]); + } + } + + // check that invalid strings throw exceptions + for (int i = 0; i < invalidStrings.length; i++) + { + try + { + testCMF = new ClassMatchFilter(invalidStrings[i]); + harness.check(false, "constructor didn't throw exception for " + + "invalid string: " + invalidStrings[i]); + } + catch (InvalidStringException ex) + { + harness.check(true); + } + } + } + + /** + * Tests the ClassMatchFilter method matches + * + * @param harness the TestHarness to use + */ + public void testMatches(TestHarness harness) + { + harness.checkPoint("matches method"); + String[] validStrings = { "java.lang.Integer", "*nteger", "java.lang.*", + "*" }; + String[] invalidStrings = { "Float", "Double", "AWT" }; + + ClassMatchFilter testCMF = null; + + // create an event to use as a test + ClassPrepareEvent testEvent = new ClassPrepareEvent(Thread.currentThread(), + Integer.class, 0); + // check to see that the matching strings match the class name + for (int i = 0; i < validStrings.length; i++) + { + try + { + testCMF = new ClassMatchFilter(validStrings[i]); + harness.check(testCMF.matches(testEvent), true, "for string: " + + validStrings[i]); + } + catch (InvalidStringException ex) + { + harness.check(false, "valid String: " + validStrings[i] + " threw " + + ex); + } + } + + // check to see that the nonmatching strings don't match the class name + for (int i = 0; i < invalidStrings.length; i++) + { + try + { + testCMF = new ClassMatchFilter(invalidStrings[i]); + harness.check(testCMF.matches(testEvent), false, + "for string: " + invalidStrings[i]); + } + catch (InvalidStringException ex) + { + harness.check(false, "valid String: " + invalidStrings[i] + + " threw " + ex); + } + } + } + + /** + * Test the ClassMatchFilter class + * + * @param harness the TestHarness to use + */ + public void test(TestHarness harness) + { + testConstructor(harness); + testMatches(harness); + } + +} Index: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassOnlyFilter.java =================================================================== RCS file: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassOnlyFilter.java diff -N gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassOnlyFilter.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfClassOnlyFilter.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,117 @@ +/* TestOfClassOnlyFilter.java -- test of ClassOnlyFilter + + Written by Kyle Galloway (kgallowa@redhat.com) + + This file is part of Mauve. + + Mauve is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Mauve is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Mauve; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + */ + +// Tags: GNU-JDWP + + +package gnu.testlet.gnu.classpath.jdwp.event.filters; + +import gnu.classpath.jdwp.VMIdManager; +import gnu.classpath.jdwp.event.ClassPrepareEvent; +import gnu.classpath.jdwp.event.filters.ClassOnlyFilter; +import gnu.classpath.jdwp.exception.InvalidClassException; +import gnu.classpath.jdwp.id.ReferenceTypeId; +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +public class TestOfClassOnlyFilter + implements Testlet +{ + /** + * Tests the ClassOnlyFilter constructor + * + * @param harness the TestHarness to use + */ + public void testConstructor(TestHarness harness) + { + harness.checkPoint("Constructor"); + + VMIdManager idm = VMIdManager.getDefault(); + ReferenceTypeId validTestId = idm.getReferenceTypeId(Integer.class); + + try + { + ClassOnlyFilter testCOF = new ClassOnlyFilter(validTestId); + harness.check(true, "Constructor successful"); + } + catch (InvalidClassException ex) + { + harness.check(false, "Constructor failed with exception" + ex); + } + + } + + /** + * Tests the ClassOnlyFilter matches method + * + * @param harness the TestHarness to use + */ + public void testMatches(TestHarness harness) + { + harness.checkPoint("matches method"); + + VMIdManager idm = VMIdManager.getDefault(); + ReferenceTypeId testId = idm.getReferenceTypeId(Integer.class); + + try + { + ClassOnlyFilter testCOF = new ClassOnlyFilter(testId); + ClassPrepareEvent testEvent = new ClassPrepareEvent( + Thread.currentThread(), + Integer.class, 0); + + harness.check(testCOF.matches(testEvent), "test correct refid"); + } + catch (InvalidClassException ex) + { + harness.check(false, "Constructor(in methods test) failed with" + + "exception" + ex); + } + + try + { + ClassOnlyFilter testCOF = new ClassOnlyFilter(testId); + ClassPrepareEvent testEvent = new ClassPrepareEvent( + Thread.currentThread(), + String.class, 0); + + harness.check(! testCOF.matches(testEvent), "test wrong refid"); + } + catch (InvalidClassException ex) + { + harness.check(false, "Constructor(in methods test) failed with" + + "exception" + ex); + } + } + + /** + * Test the ClassOnlyFilter class + * + * @param harness the TestHarness to use + */ + public void test(TestHarness harness) + { + testConstructor(harness); + testMatches(harness); + } +} Index: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfCountFilter.java =================================================================== RCS file: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfCountFilter.java diff -N gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfCountFilter.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfCountFilter.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,122 @@ +/*/* TestOfClassMatchFilter.java -- test of CountFilter + + Written by Kyle Galloway (kgallowa@redhat.com) + + This file is part of Mauve. + + Mauve is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Mauve is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Mauve; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + */ + +// Tags: GNU-JDWP + + +package gnu.testlet.gnu.classpath.jdwp.event.filters; + +import gnu.classpath.jdwp.event.ClassPrepareEvent; +import gnu.classpath.jdwp.event.filters.CountFilter; +import gnu.classpath.jdwp.exception.InvalidCountException; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +/** + * Tests the CountFilter from JDWP + * + * @author Kyle Galloway (kgallowa@redhat.com) + */ +public class TestOfCountFilter + implements Testlet +{ + + public final int COUNT = 5; + + public final int INVALID_COUNT = - 1; + + /** + * Tests the ClountFilter constructor + * + * @param harness the TestHarness to use + */ + public void testConstructor(TestHarness harness) + { + + harness.checkPoint("Constructor"); + + try + { + CountFilter testCF = new CountFilter(COUNT); + harness.check(true, "Constructor passed test"); + } + catch (InvalidCountException ex) + { + harness.check(false, "Constructor failed for valid count"); + } + + try + { + CountFilter testCF = new CountFilter(INVALID_COUNT); + harness.check(false, "Constructor threw no exception for invalid count"); + } + catch (InvalidCountException ex) + { + harness.check(true, "Constructor failed correctly for invalid count"); + } + } + + /** + * Tests the CountFilter method matches + * + * @param harness the TestHarness to use + */ + public void testMatches(TestHarness harness) + { + harness.checkPoint("matches method"); + + try + { + CountFilter testCF = new CountFilter(COUNT); + ClassPrepareEvent testCPE = new ClassPrepareEvent( + Thread.currentThread(), + Integer.class, 0); + + for (int i = 1; i <= COUNT + 1; i++) + { + if (i != COUNT) + harness.check(! testCF.matches(testCPE), + "Matches where # != COUNT"); + else + harness.check(testCF.matches(testCPE), "Matches after correct #"); + } + } + catch (InvalidCountException ex) + { + harness.check(false, "Constructor failed for valid count"); + } + } + + /** + * Test the CountFilter class + * + * @param harness the TestHarness to use + */ + public void test(TestHarness harness) + { + testConstructor(harness); + testMatches(harness); + } + +} Index: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfExceptionOnlyFilter.java =================================================================== RCS file: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfExceptionOnlyFilter.java diff -N gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfExceptionOnlyFilter.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfExceptionOnlyFilter.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,134 @@ +/* TestOfExceptionOnlyFilter.java -- test for Exception filter + + Written by Kyle Galloway (kgallowa@redhat.com) + + This file is part of Mauve. + + Mauve is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Mauve is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Mauve; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + */ + +// Tags: GNU-JDWP + + +package gnu.testlet.gnu.classpath.jdwp.event.filters; + +import gnu.classpath.jdwp.VMIdManager; +import gnu.classpath.jdwp.event.ExceptionEvent; +import gnu.classpath.jdwp.event.filters.ExceptionOnlyFilter; +import gnu.classpath.jdwp.exception.InvalidClassException; +import gnu.classpath.jdwp.id.ReferenceTypeId; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +import java.io.IOException; + +/** + * Tests the ExceptionOnlyFilter class + * + * @author Kyle Galloway (kgallowa@redhat.com) + */ +public class TestOfExceptionOnlyFilter + implements Testlet +{ + /** + * Tests the constructor of the ExceptionOnlyFilter class + * + * @param harness the TestHarness to use + */ + public void testConstructor(TestHarness harness) + { + harness.checkPoint("Constructor"); + + VMIdManager idm = VMIdManager.getDefault(); + ReferenceTypeId validrid = idm.getReferenceTypeId(NullPointerException.class); + + try + { + ExceptionOnlyFilter testEOF = new ExceptionOnlyFilter(validrid, true, + true); + harness.check(true, "Constructor successful"); + } + catch (InvalidClassException ex) + { + harness.check(false, "constructor failed for valid class"); + } + + try + { + ExceptionOnlyFilter testEOF = new ExceptionOnlyFilter(null, true, true); + harness.check(true, "Constructor successful correctly for null"); + } + catch (InvalidClassException ex) + { + harness.check(false, "constructor failed unexpectedly for null"); + } + + } + + /** + * Tests the matches method of ExceptionOnlyFilter + * + * @param harness the TestHarness to use + */ + public void testMatches(TestHarness harness) + { + harness.checkPoint("matches method"); + + NullPointerException testException = new NullPointerException(); + + VMIdManager idm = VMIdManager.getDefault(); + ReferenceTypeId rid = idm.getReferenceTypeId(NullPointerException.class); + + Integer testInt = new Integer(6); + try + { + ExceptionOnlyFilter testEOF = new ExceptionOnlyFilter(rid, true, true); + ExceptionEvent testEvent = new ExceptionEvent(testException, + Thread.currentThread(), + null, null, testInt); + + harness.check(testEOF.matches(testEvent), "matching valid exception"); + + testEOF = new ExceptionOnlyFilter(null, true, true); + testEvent = new ExceptionEvent(testException, Thread.currentThread(), + null, null, testInt); + + harness.check(testEOF.matches(testEvent), "matching any exception"); + + rid = idm.getReferenceTypeId(IOException.class); + + testEOF = new ExceptionOnlyFilter(rid, true, true); + testEvent = new ExceptionEvent(testException, Thread.currentThread(), + null, null, testInt); + + harness.check(! testEOF.matches(testEvent), + "not matching incorrect exception"); + } + catch (InvalidClassException ex) + { + harness.check(false, "constructor failed for valid class"); + } + + } + + public void test(TestHarness harness) + { + testConstructor(harness); + testMatches(harness); + } +} Index: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfInstanceOnlyFilter.java =================================================================== RCS file: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfInstanceOnlyFilter.java diff -N gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfInstanceOnlyFilter.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfInstanceOnlyFilter.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,122 @@ +/* TestOfInstanceOnlyFilter.java -- tests the InstanceOnly Filter + + Written By Kyle Galloway (kgallowa@redhat.com) + + This file is part of Mauve. + + Mauve is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Mauve is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Mauve; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + */ + +// Tags: GNU-JDWP + + +package gnu.testlet.gnu.classpath.jdwp.event.filters; + +import gnu.classpath.jdwp.VMIdManager; +import gnu.classpath.jdwp.event.BreakpointEvent; +import gnu.classpath.jdwp.event.filters.InstanceOnlyFilter; +import gnu.classpath.jdwp.exception.InvalidObjectException; +import gnu.classpath.jdwp.id.ObjectId; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +/** + * Tests the functionality of the InstanceOnlyFilter of JDWP + * + * @author Kyle Galloway (kgallowa@redhat.com) + */ +public class TestOfInstanceOnlyFilter + implements Testlet +{ + /** + * Tests the InstanceOnlyFilter constructor + * + * @param harness the TestHarness to use + */ + public void testConstructor(TestHarness harness) + { + harness.checkPoint("Constructor"); + VMIdManager idm = VMIdManager.getDefault(); + + Integer testInt = new Integer(6); + + ObjectId testOID = idm.getObjectId(testInt); + + try + { + InstanceOnlyFilter testIOF = new InstanceOnlyFilter(testOID); + harness.check(true, "Constructor successful"); + } + catch (InvalidObjectException ex) + { + harness.check(false, "constructor failed for valid ObjectId"); + } + + //test null since it is valid + try + { + InstanceOnlyFilter testIOF = new InstanceOnlyFilter(null); + harness.check(true, "Constructor successful"); + } + catch (InvalidObjectException ex) + { + harness.check(false, "constructor failed incorrectly for null"); + } + + } + + /** + * Tests the InstanceOnlyFilter matches method + * + * @param harness the TestHarness to use + */ + public void testMatches(TestHarness harness) + { + harness.checkPoint("matches method"); + + VMIdManager idm = VMIdManager.getDefault(); + + Integer testInt = new Integer(6); + + ObjectId testOID = idm.getObjectId(testInt); + + try + { + InstanceOnlyFilter testIOF = new InstanceOnlyFilter(testOID); + BreakpointEvent testEvent = new BreakpointEvent(Thread.currentThread(), + null, testInt); + harness.check(testIOF.matches(testEvent), "testing matching Instance " + + "match"); + + testEvent = new BreakpointEvent(Thread.currentThread(), null, null); + + harness.check(! testIOF.matches(testEvent), + "testing non-matching Instance"); + } + catch (InvalidObjectException ex) + { + harness.check(false, "constructor failed for valid ObjectId"); + } + } + + public void test(TestHarness harness) + { + testConstructor(harness); + testMatches(harness); + } +} Index: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfThreadOnlyFilter.java =================================================================== RCS file: gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfThreadOnlyFilter.java diff -N gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfThreadOnlyFilter.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/gnu/classpath/jdwp/event/filters/TestOfThreadOnlyFilter.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,118 @@ +/* TestOfThreadOnlyFilter.java -- test of the ThreadOnlyFilter + Copyright (C) 2006 + + Written by Kyle Galloway (kgallowa@redhat.com) + + This file is part of Mauve. + + Mauve is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Mauve is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Mauve; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301 USA. + + */ + +// Tags: GNU-JDWP + + +package gnu.testlet.gnu.classpath.jdwp.event.filters; + +import gnu.classpath.jdwp.VMIdManager; +import gnu.classpath.jdwp.event.ThreadStartEvent; +import gnu.classpath.jdwp.event.filters.ThreadOnlyFilter; +import gnu.classpath.jdwp.exception.InvalidThreadException; +import gnu.classpath.jdwp.id.ThreadId; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +public class TestOfThreadOnlyFilter + implements Testlet +{ + /** + * Tests the ThreadOnlyFilter constructor + * + * @param harness the TestHarness to use + */ + public void testConstructor(TestHarness harness) + { + harness.checkPoint("Constructor"); + VMIdManager idm = VMIdManager.getDefault(); + + Thread thread = new Thread(); + + ThreadId tid = (ThreadId) idm.getObjectId(thread); + + try + { + ThreadOnlyFilter testTOF = new ThreadOnlyFilter(tid); + harness.check(true, "Constructor successful"); + } + catch (InvalidThreadException ex) + { + harness.check(false, "constructor failed for valid ObjectId"); + } + + // test null since it is invalid + try + { + ThreadOnlyFilter testTOF = new ThreadOnlyFilter(null); + harness.check(false, "Constructor successful for null"); + } + catch (InvalidThreadException ex) + { + harness.check(true, "constructor failed correctly for null"); + } + + } + + /** + * Tests the InstanceOnlyFilter matches method + * + * @param harness the TestHarness to use + */ + public void testMatches(TestHarness harness) + { + harness.checkPoint("matches method"); + + VMIdManager idm = VMIdManager.getDefault(); + + Thread thread = new Thread(); + + ThreadId tid = (ThreadId) idm.getObjectId(Thread.currentThread()); + + ThreadStartEvent testTSE = new ThreadStartEvent(Thread.currentThread()); + + try + { + ThreadOnlyFilter testTOF = new ThreadOnlyFilter(tid); + + harness.check(testTOF.matches(testTSE), "Matches correct thread"); + + testTSE = new ThreadStartEvent(thread); + + harness.check(! testTOF.matches(testTSE), + "Doesn't match incorrect thread"); + } + catch (InvalidThreadException ex) + { + harness.check(false, "constructor failed for valid ObjectId"); + } + } + + public void test(TestHarness harness) + { + testConstructor(harness); + testMatches(harness); + } +} --------------060307060901090506090200--