You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(30) |
Sep
(19) |
Oct
(3) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(11) |
Feb
(13) |
Mar
(10) |
Apr
(11) |
May
(7) |
Jun
(8) |
Jul
(5) |
Aug
(16) |
Sep
(14) |
Oct
(3) |
Nov
(9) |
Dec
|
2003 |
Jan
(5) |
Feb
(6) |
Mar
(9) |
Apr
(31) |
May
(25) |
Jun
(22) |
Jul
(28) |
Aug
(27) |
Sep
(19) |
Oct
(4) |
Nov
(7) |
Dec
(26) |
2004 |
Jan
(8) |
Feb
(13) |
Mar
(5) |
Apr
(8) |
May
(8) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2005 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(3) |
May
|
Jun
|
Jul
(6) |
Aug
|
Sep
(10) |
Oct
(6) |
Nov
|
Dec
(36) |
2009 |
Jan
(3) |
Feb
(14) |
Mar
(13) |
Apr
(18) |
May
(35) |
Jun
(18) |
Jul
(27) |
Aug
(6) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(6) |
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
From: Verma, N. (G. B. L529706) <Nit...@ge...> - 2002-03-07 21:14:47
|
Hi Brian, MockObject: are not just to emulating behavior of an object but also to make us de-couple tests form the real systems! " My intent is to assert my logic not assert *is there is a network connection* or *is the database up*" When I need to assert some logic on the data I receive from the database I don't use mockobjects, as I need the real system! Any comments... Reagrds, Nitin Verma -----Original Message----- From: Brian Denny [mailto:br...@dl...] Sent: Friday, March 08, 2002 2:29 AM To: moc...@li... Subject: [Mockobjects-java-users] simulating vs. reproducing behavior hi, i'm fairly new to Mock Objects, and trying to wrap my head around where to draw the line between simulating and reproducing behavior. I came across some code in our system recently which, under certain conditions, calls deleteRow() on a ResultSet and then immediately calls updateRow() on the same ResultSet. I wasn't sure off the top of my head whether that was "legal", whether it should throw an exception, or what the expected behavior was according to the JDBC spec. I was in the middle of trying to hack up a mock implementation for updatable result sets, so it seemed particularly relevant. My first instinct is that, whatever correct behavior is, the MockResultSet should mimic it. So if, for example, "rs.deleteRow(); rs.updateRow();" should throw an exception, then my MockResultSet should throw an exception. But the more details of that nature you try to simulate, the closer you get to really reproducing the functionality instead of just emulating it. To *really* simulate correct behavior, then after you update a ResultSet you should be able to iterate back over it and see the updates you just made reflected in your get() calls. But by that point, you have practically created a real implementation of a ResultSet! Where do you draw the line? In a related vein, it seems to me that limiting yourself to emulating the functionality in as minimal a way as possible, does tend to make your test code rely on implementation details. For example, we have some code which provides an abstraction over the process of inserting/updating/deleting several rows of a table based on the states of objects which "know" how to read and write themselves to/from the table. Now, this code might work by using an updatable result set, or it might work by calling executeUpdate methods on a statement. Using mock objects, I have to test things like the particular query string used, or the number of execute calls, or (if it uses an updatable result set) the number of updateRow(), insertRow(), or deleteRow() calls. All of these tests will break if I change the internal implementation details of the code I am trying to test. It seems that to test the abstraction instead of the implementation, you have to do a more thorough job of emulating the behavior than the Mock Objects pattern really advocates. Does anyone have comments or advice about this? To make things concrete: let's say I'm implementing a mock updatable result set. Would you code it so that the update methods actually alter the table rows? Or would you just provide for expectations of how many times updateRow(), etc. get called? -brian _______________________________________________ Mockobjects-java-users mailing list Moc...@li... https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." |
From: Brian D. <br...@dl...> - 2002-03-07 20:58:35
|
hi, i'm fairly new to Mock Objects, and trying to wrap my head around where to draw the line between simulating and reproducing behavior. I came across some code in our system recently which, under certain conditions, calls deleteRow() on a ResultSet and then immediately calls updateRow() on the same ResultSet. I wasn't sure off the top of my head whether that was "legal", whether it should throw an exception, or what the expected behavior was according to the JDBC spec. I was in the middle of trying to hack up a mock implementation for updatable result sets, so it seemed particularly relevant. My first instinct is that, whatever correct behavior is, the MockResultSet should mimic it. So if, for example, "rs.deleteRow(); rs.updateRow();" should throw an exception, then my MockResultSet should throw an exception. But the more details of that nature you try to simulate, the closer you get to really reproducing the functionality instead of just emulating it. To *really* simulate correct behavior, then after you update a ResultSet you should be able to iterate back over it and see the updates you just made reflected in your get() calls. But by that point, you have practically created a real implementation of a ResultSet! Where do you draw the line? In a related vein, it seems to me that limiting yourself to emulating the functionality in as minimal a way as possible, does tend to make your test code rely on implementation details. For example, we have some code which provides an abstraction over the process of inserting/updating/deleting several rows of a table based on the states of objects which "know" how to read and write themselves to/from the table. Now, this code might work by using an updatable result set, or it might work by calling executeUpdate methods on a statement. Using mock objects, I have to test things like the particular query string used, or the number of execute calls, or (if it uses an updatable result set) the number of updateRow(), insertRow(), or deleteRow() calls. All of these tests will break if I change the internal implementation details of the code I am trying to test. It seems that to test the abstraction instead of the implementation, you have to do a more thorough job of emulating the behavior than the Mock Objects pattern really advocates. Does anyone have comments or advice about this? To make things concrete: let's say I'm implementing a mock updatable result set. Would you code it so that the update methods actually alter the table rows? Or would you just provide for expectations of how many times updateRow(), etc. get called? -brian |
From: Steve F. <st...@m3...> - 2002-02-27 23:40:54
|
Well then, we need to move those tests that apply only to j2ee classes. Similarly for the examples, which I haven't got around to yet. Given that you chaps are about the only people I know still using Java 1.1, would you like to put in any fixes for that version? We could finally sort out that compatibility jar. S. From: "Tim Mackinnon" <tim...@po...> > Except that it doesn't work in that the tests don't pass because the class > is mising and it won't compile out of the box. We need a default lineup > where you can compile the default lineup. Is jdk 1.3 and j2ee bollocks this > lineup? (probably - if thats where servlets are located, and this is what > most people want to do from postings I see). Its quite easy for people to > ignore tests if they choose not to download other components. |
From: Tim M. <tim...@po...> - 2002-02-26 01:02:35
|
Except that it doesn't work in that the tests don't pass because the class is mising and it won't compile out of the box. We need a default lineup where you can compile the default lineup. Is jdk 1.3 and j2ee bollocks this lineup? (probably - if thats where servlets are located, and this is what most people want to do from postings I see). Its quite easy for people to ignore tests if they choose not to download other components. Tim -----Original Message----- From: Steve Freeman [mailto:st...@m3...] Sent: 25 February 2002 10:26 To: Tim Mackinnon; moc...@li...; MockObjects Subject: Re: [Mockobjects-java-users] RE: [MO-java-dev] build revision in progress From: "Tim Mackinnon" <tim...@po...> > I just did an anonymous checkout (into a clean directory) to see where you > guys are up to and MockServletOutputStream is missing? nice to see you got it working ;-) it's under j2ee/common. > There also seems to be a number of empty directories for j2ee 1.2 as well as > an extra com.mockobjects bit in j2ee? the j2ee files are split between - 1.2 - versions specific to version 1.2 of j2ee - 1.3 - much the same for 1.3 - common - versions common to both We need to do the same for the jdk libraries so we can add in the new SQL stuff S. --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.325 / Virus Database: 182 - Release Date: 19/02/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.325 / Virus Database: 182 - Release Date: 19/02/2002 |
From: Steve F. <st...@m3...> - 2002-02-25 14:38:00
|
Thanks for contributing. It's a bit hard to comment in the abstract -- could you post an example of the sort of test you're worrying about? I have one suspicion which is that you may be specifying too much detail in the test, which would make maintenance difficult. Mocks tend to push you towards testing the relationship between objects so, yes, that could be regarded as exposing more of the internals. On the other hand, if those internal interfaces are written at the appropriate level, then you may not be giving away _too_ many secrets in the test. The alternative is sometimes that you end up testing several objects together, which makes refactoring harder because you have to pull out the underlying object you want access to. Maybe this is till an open topic. Again, having a cross-referencing IDE helps a lot. Steve ----- Original Message ----- From: "Martin Bayly" <mar...@ho...> I've been using mock objects on a new project for the last few weeks and I really like the level of isolation I can achieve between the class being tested and other domain code on which the class depends. They make tests simpler to setup and easier/faster to run. I'm developing in a servlet/ejb environment and I've got useful implementations of mock session and entity beans going which allow me to test a lot of container dependent code without the container. However, one thing that concerns me is that my tests seem to expose the implementations of the classes being tested. I really like the XP practice of test first by intention (code what you want not how to do it). However, when writing my mock object based tests I'm generally thinking about the implementation as I write the test, as the expectations that I want to set and verify depend on what I'm expecting the code to do internally. Without mock objects I tend to be more focused on externally verifiable consequences of calling a method (which seem to be more intention based). I'm concerned this might make future refactoring more difficult because refactoring may require me to change the expectations and verifications. Hopefully, this won't be the case because generally I'm using mock objects for other higher level objects such as other ejbs or framework classes which should have well defined interfaces that won't change much. Also maybe I'm not exposing implementation. I'm just making it easy to verify things that I would otherwise have to verify externally, but which might be difficult to setup in a unit test environment. e.g. if a method being tested creates a new entity bean as part of its implementation, without mock objects, I would have to make some call as part of the test to verify the entity was actually created. With mock objects I just verify that my method called my mock entity bean's create() method with the right parameters. Much simpler, faster and no database dependencies. |
From: Clemmons, S. <sco...@fn...> - 2002-02-25 14:24:47
|
> painful. In this case, do you find that the internal dependencies in your mocks suggest > possible refactorings in your production code? Does the maintenance I think you might be right about this. Either that, or it's just that the code that I've been writing tests for so far have been the entry-points (the primary interfaces) to various subsystems. That is, the calls are typically at a higher level and so have several cross-subsystem dependencies. It's something I need to take a look at. > Next question, do you find that the generated mocks are OK? > Would you be better doing it by hand? Yes & no. I was able to generate ~ a hundered mock classes with mockmaker within a very short time. It would've taken me much much longer without the tool. However, I've found that I often have to customize the generated mock classes slightly in order to be more useful with my tests. Therefore, if the interface changes, and I have to regenerate a mock class, it may be painful. I suspect, though, that most changes would be minor (adding or changing a method or 2), and I can simply make modifications by hand. I'm trying to minimize the effects of changes by this mock framework I've created (somewhat as a facade). Thanks for you comments, Scott |
From: Steve F. <st...@m3...> - 2002-02-25 14:04:28
|
> From: "Martin Bayly" <mar...@ho...> > I've been using mock objects on a new project for the last few weeks and I really like > the level of isolation I can achieve between the class being tested and other domain > code on which the class depends. They make tests simpler to setup and easier/faster > to run. I'm developing in a servlet/ejb environment and I've got useful implementations > of mock session and entity beans going which allow me to test a lot of container > dependent code without the container. > However, one thing that concerns me is that my tests seem to expose the implementations > of the classes being tested. I really like the XP practice of test first by intention (code > what you want not how to do it). However, when writing my mock object based tests > I'm generally thinking about the implementation as I write the test, as the expectations that > I want to set and verify depend on what I'm expecting the code to do internally. > Without mock objects I tend to be more focused on externally verifiable consequences > of calling a method (which seem to be more intention based). > I'm concerned this might make future refactoring more difficult because refactoring may > require me to change the expectations and verifications. Hopefully, this won't be the > case because generally I'm using mock objects for other higher level objects such as > other ejbs or framework classes which should have well defined interfaces that won't change much. > Also maybe I'm not exposing implementation. I'm just making it easy to verify things that > I would otherwise have to verify externally, but which might be difficult to setup in a unit > test environment. e.g. if a method being tested creates a new entity bean as part of its > implementation, without mock objects, I would have to make some call as part of the test > to verify the entity was actually created. With mock objects I just verify that my method called my mock entity bean's create() method with the right parameters. Much simpler, faster and no database dependencies. I was wondering if anyone else had any comments on the impact of mock objects on the test first by intention practice. Sorry for rambling! Regards, Martin Bayly mar...@ho... |
From: Steve F. <st...@m3...> - 2002-02-25 13:53:02
|
thanks for contributing to the group. From: "Clemmons, Scott" <sco...@fn...> > I have similar concerns. Although I am a big proponent of mock objects, for > the reasons Martin suggests, I am concerned that the more mock objects I > create, and tests that rely on them, the more dependencies I'm creating. > > In my group, I've been advocating JUnit and the use of mock objects for > months. In order to ease developer involvement, I've taken on the task of > creating unit tests for multiple subsystems. In doing so, I have found that > there are common internal dependencies, and therefore common mock > possibilities.So, in short, I've begun building a mock framework, if you > will, around mock objects that were created by mockmaker. The test code is > becoming very sophisticated. But I worry that I'm creating a huge > maintenance monster. I'm spending an inordinate amount of time creating this > framework, and beginning to wonder if it's worth it. Retrofitting unit tests, whatever technique you use, is painful. In this case, do you find that the internal dependencies in your mocks suggest possible refactorings in your production code? Does the maintenance problem arise because the code is not yet well factored? Sophisticated test code is certainly a warning sign of something. For example, it can be really tricky to set up a mock JDBC environment if your client code goes through the whole query cycle in one go, starting from getting a connection. On the other hand, if you have smaller objects that wrap access to the various stages of a persistence layer (and which can be mocked themselves), then your mock implementation doesn't need to be so complex. Next question, do you find that the generated mocks are OK? Would you be better doing it by hand? > I guess I'm asking if the investment of creating and maintaining large > number of tests (and in particualr mock objects) in order to the protect > the integrity of future refactoring efforts worth it? I mean, is the return > value simply writing the initial tests and discovering bugs from that > effort, and then the return diminishes rapidly afterwards? It's your call. Do you expect never to change that code again or rely on its side-effects? Then dump the tests ;-) It seems wasteful to go to the trouble of understanding and implementing tests only to have to do the same again a while later. That said, I suspect that there is room for much better IDE support for this kind of activity (b.t.w. are you using one of the IDE's that has help for refactoring? It does make a difference). Another way of looking at it is that mocks are a way of refactoring your assertions from multiple tests into a common place. Steve |
From: Clemmons, S. <sco...@fn...> - 2002-02-25 12:39:56
|
I have similar concerns. Although I am a big proponent of mock objects, for the reasons Martin suggests, I am concerned that the more mock objects I create, and tests that rely on them, the more dependencies I'm creating. In my group, I've been advocating JUnit and the use of mock objects for months. In order to ease developer involvement, I've taken on the task of creating unit tests for multiple subsystems. In doing so, I have found that there are common internal dependencies, and therefore common mock possibilities.So, in short, I've begun building a mock framework, if you will, around mock objects that were created by mockmaker. The test code is becoming very sophisticated. But I worry that I'm creating a huge maintenance monster. I'm spending an inordinate amount of time creating this framework, and beginning to wonder if it's worth it. I guess I'm asking if the investment of creating and maintaining large number of tests (and in particualr mock objects) in order to the protect the integrity of future refactoring efforts worth it? I mean, is the return value simply writing the initial tests and discovering bugs from that effort, and then the return diminishes rapidly afterwards? What is your experience with large projects and the utilization of mock objects with them? Thanks, Scott -----Original Message----- From: Martin Bayly [mailto:mar...@ho...] Sent: Monday, February 25, 2002 2:10 AM To: moc...@li... Subject: [Mockobjects-java-users] Mock object tests expose class implementation details I've been using mock objects on a new project for the last few weeks and I really like the level of isolation I can achieve between the class being tested and other domain code on which the class depends. They make tests simpler to setup and easier/faster to run. I'm developing in a servlet/ejb environment and I've got useful implementations of mock session and entity beans going which allow me to test a lot of container dependent code without the container. However, one thing that concerns me is that my tests seem to expose the implementations of the classes being tested. I really like the XP practice of test first by intention (code what you want not how to do it). However, when writing my mock object based tests I'm generally thinking about the implementation as I write the test, as the expectations that I want to set and verify depend on what I'm expecting the code to do internally. Without mock objects I tend to be more focused on externally verifiable consequences of calling a method (which seem to be more intention based). I'm concerned this might make future refactoring more difficult because refactoring may require me to change the expectations and verifications. Hopefully, this won't be the case because generally I'm using mock objects for other higher level objects such as other ejbs or framework classes which should have well defined interfaces that won't change much. Also maybe I'm not exposing implementation. I'm just making it easy to verify things that I would otherwise have to verify externally, but which might be difficult to setup in a unit test environment. e.g. if a method being tested creates a new entity bean as part of its implementation, without mock objects, I would have to make some call as part of the test to verify the entity was actually created. With mock objects I just verify that my method called my mock entity bean's create() method with the right parameters. Much simpler, faster and no database dependencies. I was wondering if anyone else had any comments on the impact of mock objects on the test first by intention practice. Sorry for rambling! Regards, Martin Bayly mar...@ho... <mailto:mar...@ho...> |
From: Steve F. <st...@m3...> - 2002-02-25 10:34:39
|
From: "Tim Mackinnon" <tim...@po...> > I just did an anonymous checkout (into a clean directory) to see where you > guys are up to and MockServletOutputStream is missing? nice to see you got it working ;-) it's under j2ee/common. > There also seems to be a number of empty directories for j2ee 1.2 as well as > an extra com.mockobjects bit in j2ee? the j2ee files are split between - 1.2 - versions specific to version 1.2 of j2ee - 1.3 - much the same for 1.3 - common - versions common to both We need to do the same for the jdk libraries so we can add in the new SQL stuff S. |
From: Steve F. <st...@m3...> - 2002-02-25 10:34:39
|
From: "Tim Mackinnon" <tim...@po...> > I just did an anonymous checkout (into a clean directory) to see where you > guys are up to and MockServletOutputStream is missing? nice to see you got it working ;-) it's under j2ee/common. > There also seems to be a number of empty directories for j2ee 1.2 as well as > an extra com.mockobjects bit in j2ee? the j2ee files are split between - 1.2 - versions specific to version 1.2 of j2ee - 1.3 - much the same for 1.3 - common - versions common to both We need to do the same for the jdk libraries so we can add in the new SQL stuff S. |
From: Martin B. <mar...@ho...> - 2002-02-25 08:10:20
|
I've been using mock objects on a new project for the last few weeks and = I really like the level of isolation I can achieve between the class = being tested and other domain code on which the class depends. They = make tests simpler to setup and easier/faster to run. I'm developing in = a servlet/ejb environment and I've got useful implementations of mock = session and entity beans going which allow me to test a lot of container = dependent code without the container. However, one thing that concerns me is that my tests seem to expose the = implementations of the classes being tested. I really like the XP = practice of test first by intention (code what you want not how to do = it). However, when writing my mock object based tests I'm generally = thinking about the implementation as I write the test, as the = expectations that I want to set and verify depend on what I'm expecting = the code to do internally. Without mock objects I tend to be more = focused on externally verifiable consequences of calling a method (which = seem to be more intention based). =20 I'm concerned this might make future refactoring more difficult because = refactoring may require me to change the expectations and verifications. = Hopefully, this won't be the case because generally I'm using mock = objects for other higher level objects such as other ejbs or framework = classes which should have well defined interfaces that won't change = much. =20 Also maybe I'm not exposing implementation. I'm just making it easy to = verify things that I would otherwise have to verify externally, but = which might be difficult to setup in a unit test environment. e.g. if a = method being tested creates a new entity bean as part of its = implementation, without mock objects, I would have to make some call as = part of the test to verify the entity was actually created. With mock = objects I just verify that my method called my mock entity bean's = create() method with the right parameters. Much simpler, faster and no = database dependencies. I was wondering if anyone else had any comments on the impact of mock = objects on the test first by intention practice. Sorry for rambling! Regards, Martin Bayly mar...@ho... |
From: Tim M. <tim...@po...> - 2002-02-25 00:19:35
|
I just did an anonymous checkout (into a clean directory) to see where you guys are up to and MockServletOutputStream is missing? There also seems to be a number of empty directories for j2ee 1.2 as well as an extra com.mockobjects bit in j2ee? Is this all part of the rework? Tim -----Original Message----- From: moc...@li... [mailto:moc...@li...]On Behalf Of Steve Freeman Sent: 23 February 2002 19:44 To: MockObjects; moc...@li... Subject: [MO-java-dev] build revision in progress I've finally got around to doing something about the build process. I've started with support for versions 1.2 and 1.3 of j2ee -- the new script will build appropriately for whichever version of j2ee.jar you add to the lib directory. The next thing to fix will be versioning in the jdk libraries so we can finally incorporate all those jdbc fixes you've been posting (thanks). One thing I haven't figured out is what to do about the javadoc and how we might (or might not) include multiple versions of that. So far I've checked it into CVS. Please have a go at checking out and building at your end. I tried to upload a built zip, but I can't get through to the sourceforge ftp server. I'll try again tomorrow. Hang in there... Steve _______________________________________________ Mockobjects-java-dev mailing list Moc...@li... https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.325 / Virus Database: 182 - Release Date: 19/02/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.325 / Virus Database: 182 - Release Date: 19/02/2002 |
From: Steve F. <st...@m3...> - 2002-02-23 19:46:41
|
I've finally got around to doing something about the build process. I've started with support for versions 1.2 and 1.3 of j2ee -- the new script will build appropriately for whichever version of j2ee.jar you add to the lib directory. The next thing to fix will be versioning in the jdk libraries so we can finally incorporate all those jdbc fixes you've been posting (thanks). One thing I haven't figured out is what to do about the javadoc and how we might (or might not) include multiple versions of that. So far I've checked it into CVS. Please have a go at checking out and building at your end. I tried to upload a built zip, but I can't get through to the sourceforge ftp server. I'll try again tomorrow. Hang in there... Steve |
From: Huy D. <hd...@eu...> - 2002-02-18 17:24:14
|
Hi, We encapsulate all database access calls in DAO classes. We use the MockObjects framework to test each DAO method. Certain methods make multiple different SQL queries (like an INSERT followed by a SELECT) inside the method. Currently, the MockObjects only supports one MockPreparedStatement per MockConnection. Is there an implementation where you can get two different MockPreparedStatement from the same MockConnection in a particular order? If it is not available, is there an implementation planned? Thank you, Huy |
From: Steve F. <st...@m3...> - 2002-01-30 22:40:09
|
Interesting problem. Personally, I'd suggest getting the content handler after the fact and just checking its identity in an assert (not an assertEquals). You might even do this with a real XMLReader if it's easy to construct. MockXMLReader reader = new MockXMLReader(); BaseContentHandler handler = new BaseContentHandler( reader ) ; assert("Should be same content handler", handler == reader.getContentHandler()); The reason we normally set expectations first is to make the tests consistent and so that the test can explode in the right place. Given that in this case the getter already exists, we lose nothing by using it. An alternative, depending on what you want to test, would be just to count the number of times setContentHandler() gets called, if you're confident enough that the right value will be set -- but I suspect not. Steve > I have a situation where when I construct an object I pass an object to the > constructor that the constructor will call a method on with itself as a > parameter. This is part of a SAX parser and the object being constructed is > a ContentHandler. The object being passed to the constructor is the > XMLReader that the object being constructed is to register itself with. > > The constructor looks like this: > > public BaseContentHandler( XMLReader reader ) > { > this.parentHandler = reader.getContentHandler(); > this.reader = reader; > reader.setContentHandler( this ); > } > > You can see this pattern in the XML parsing code in the Ant project (which > is where I got the idea). Whether this is a good pattern is debatable, but > either way it should be testable. > > I created a MockXMLReader object to verify that the constructed object is > setting itself as the content handler. The setContentHandler method calls > setActual on an ExpectationValue. The problem is that I cannot set the > expected value until the constructor returns because I don't have an object > reference until the constructor returns. But the setExpected call does a > clearActual which clears the actual value just set within the constructor. > > So I have a problem of which comes first the chicken or the egg or in this > case the expected or the actual. The question is how to solve it and should > Mock Objects be changed to make this easier? > [...] > The question boils down to is there any reason why the expected must be set > before the actual? Any thoughts? |
From: King D. <Ki...@tc...> - 2002-01-30 21:37:39
|
I have a situation where when I construct an object I pass an object to the constructor that the constructor will call a method on with itself as a parameter. This is part of a SAX parser and the object being constructed is a ContentHandler. The object being passed to the constructor is the XMLReader that the object being constructed is to register itself with. The constructor looks like this: public BaseContentHandler( XMLReader reader ) { this.parentHandler = reader.getContentHandler(); this.reader = reader; reader.setContentHandler( this ); } You can see this pattern in the XML parsing code in the Ant project (which is where I got the idea). Whether this is a good pattern is debatable, but either way it should be testable. I created a MockXMLReader object to verify that the constructed object is setting itself as the content handler. The setContentHandler method calls setActual on an ExpectationValue. The problem is that I cannot set the expected value until the constructor returns because I don't have an object reference until the constructor returns. But the setExpected call does a clearActual which clears the actual value just set within the constructor. So I have a problem of which comes first the chicken or the egg or in this case the expected or the actual. The question is how to solve it and should Mock Objects be changed to make this easier? I could subclass ExpectationValue and override clearActual so that clearActual does nothing, but that is not robust and makes the object not reusable. I cannot realistically override setHasExpectations which is the one that is actually calling clearActual because that is the only way to set the myHasExpectations variable which is private to AbstractExpectation. One way is to create a wrapper for the expected value to provide an additional level of indirection. It would look like this (I haven't even tried to compile this) public class ExpectationWrapper { private Object expected; public void setExpected( Object expected ) { this.expected = expected; } boolean equals( Object actual ) { // Should use equals method with check for null // but you get the idea. return expected == actual; } } Then my test case would look like: MockXMLReader reader = new MockXMLReader(); ExpectationWrapper wrap = new ExpectationWrapper(); reader.setExpectedContentHandler( wrap ); wrap.setExpected( new BaseContentHandler( reader ) ); reader.verify(); This strikes me as very kludgey and it seems I should not have to go to such lengths just because I want to set the actual before the expected. I understand that usually you want to clear the actual when you set the expected, but sometimes you don't. The question boils down to is there any reason why the expected must be set before the actual? Any thoughts? -- Dale King |
From: Verma, N. (C. G. L529706) <Nit...@ge...> - 2002-01-19 20:27:32
|
Hi Buddies, My RFE has been accepted, if you like this RFE then you can vote for this or even write what more you need -- "Your Comments & Work arounds"... RFE ID: 4619696 http://developer.java.sun.com/developer/bugParade/bugs/4619696.html Regards, Nitin Verma "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." |
From: Steve F. <st...@m3...> - 2002-01-09 00:03:23
|
Nitin, sorry for the delay. here's my problem. we also have to support people using the previous version of JDBC and the other j2ee libraries, so we need to restructure the build to include multiple versions. I'd also like to break the library down into multiple jars. As you can imagine, this is a bigger change than I'd like but we have to make it to progress. Plus the London XP Day, xmas and a whole bunch of other things got in the way. If you like, as a short term measure, I chould check in your stuff on a branch until we can restructure the build. Would that satisfy your management? Steve ----- Original Message ----- From: "Verma, Nitin (CORP, GTS, L529706)" <Nit...@ge...> To: <moc...@li...> Sent: Tuesday, January 08, 2002 6:16 PM Subject: [Mockobjects-java-users] JDBC 3.0 Complaint MockObjects > Hi All, > > I need MockCallableStatement(JDBC 3.0 complaint) and it wasn't there > in mock objects. So I mailed Steve. > He told me to make myself and send it to MockObjects project > personal. > Now my problem is I have to use it and I can't use as per my > management till the changes are not acceptable to > the project managers/developers of mockobjects.... and these changes > come into mockobjects distribution. > > Please tell me how to get these changes in the MockObjects....? > > Regards, > > Nitin Verma |
From: Verma, N. (C. G. L529706) <Nit...@ge...> - 2002-01-08 22:01:02
|
package com.mockobjects.sql; import java.math.BigDecimal; import java.util.Calendar; import java.sql.*; import java.io.InputStream; import java.io.Reader; import java.util.Map; import com.mockobjects.MockObject; import com.mockobjects.ExpectationCounter; import junit.framework.AssertionFailedError; /** * Trial version * @author Nitin Verma * @version 1.0 24 Dec 2001 */ public abstract class MockResultSet extends MockObject implements ResultSet{ /* Nested MockObjects */ /* Expectations objects that can be set */ private ExpectationCounter myCloseCalls = new ExpectationCounter("MockResultSet.close"); protected ExpectationCounter myNextCalls = new ExpectationCounter("MockResultSet.next"); /* Other objects*/ private ResultSetMetaData myMetaData; private Statement myStatement; /* Methods for mockobject's internal use only */ /* Methods wrapped*/ public MockResultSet() { super(); } /** * Used as the base implementation for getting all types of object, * based on 1-based column index * @see java.sql.ResultSet#getObject(int) */ abstract public Object getObject(int columnIndex) throws SQLException; /** * Used as the base implementation for getting all types of object, * based on columnName * @see java.sql.ResultSet#getObject(int) */ abstract public Object getObject(String columnName) throws SQLException; abstract public boolean next() throws SQLException; abstract public int getRow() throws SQLException; public void close() throws SQLException { myCloseCalls.inc(); } public Array getArray(int i) throws SQLException { return (Array)getObject(i); } public Array getArray(String colName) throws SQLException { return (Array)getObject(colName); } public InputStream getAsciiStream(int columnIndex) throws SQLException { return (InputStream)getObject(columnIndex); } public InputStream getAsciiStream(String columnName) throws SQLException { return (InputStream)getObject(columnName); } public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { return getBigDecimal(columnName); } public BigDecimal getBigDecimal(int columnIndex) throws SQLException { return (BigDecimal)getObject(columnIndex); } public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { return (BigDecimal)getObject(columnIndex); } public BigDecimal getBigDecimal(String columnName) throws SQLException { return (BigDecimal)getObject(columnName); } public InputStream getBinaryStream(int columnIndex) throws SQLException { return (InputStream)getObject(columnIndex); } public InputStream getBinaryStream(String columnName) throws SQLException { return (InputStream)getObject(columnName); } public Blob getBlob(int i) throws SQLException { return (Blob)getObject(i); } public Blob getBlob(String colName) throws SQLException { return (Blob)getObject(colName); } public boolean getBoolean(int columnIndex) throws SQLException { return ((Boolean)getObject(columnIndex)).booleanValue(); } public boolean getBoolean(String columnName) throws SQLException { return ((Boolean)getObject(columnName)).booleanValue(); } public byte getByte(int columnIndex) throws SQLException { return ((Byte)getObject(columnIndex)).byteValue(); } public byte getByte(String columnName) throws SQLException { return ((Byte)getObject(columnName)).byteValue(); } public byte[] getBytes(int columnIndex) throws SQLException { return (byte[])getObject(columnIndex); } public byte[] getBytes(String columnName) throws SQLException { return (byte[])getObject(columnName); } public Reader getCharacterStream(int columnIndex) throws SQLException { return (Reader)getObject(columnIndex); } public Reader getCharacterStream(String columnName) throws SQLException { return (Reader)getObject(columnName); } public Clob getClob(int i) throws SQLException { return (Clob)getObject(i); } public Clob getClob(String colName) throws SQLException { return (Clob)getObject(colName); } public String getCursorName() throws SQLException { throw new AssertionFailedError("MockResultSet getCursorName not implemented"); } public int getConcurrency() throws SQLException { throw new AssertionFailedError("MockResultSet getConcurrency not implemented"); } public Date getDate(int columnIndex) throws SQLException { return (Date)getObject(columnIndex); } public Date getDate(String columnName) throws SQLException { return (Date)getObject(columnName); } public Date getDate(int columnIndex, Calendar cal) throws SQLException { return getDate(columnIndex); } public Date getDate(String columnName, Calendar cal) throws SQLException { return getDate(columnName); } public double getDouble(int columnIndex) throws SQLException { return ((Double)getObject(columnIndex)).doubleValue(); } public double getDouble(String columnName) throws SQLException { return ((Double)getObject(columnName)).doubleValue(); } public int getFetchDirection() throws SQLException { throw new AssertionFailedError("MockResultSet getFetchDirection not implemented"); } public int getFetchSize() throws SQLException { throw new AssertionFailedError("MockResultSet getFetchSize not implemented"); } public float getFloat(int columnIndex) throws SQLException { return ((Float)getObject(columnIndex)).floatValue(); } public float getFloat(String columnName) throws SQLException { return ((Float)getObject(columnName)).floatValue(); } public int getInt(int columnIndex) throws SQLException { return ((Integer) getObject(columnIndex)).intValue(); } public int getInt(String columnName) throws SQLException { return ((Integer) getObject(columnName)).intValue(); } public long getLong(int columnIndex) throws SQLException { return ((Long) getObject(columnIndex)).longValue(); } public long getLong(String columnName) throws SQLException { return ((Long) getObject(columnName)).longValue(); } public ResultSetMetaData getMetaData() throws SQLException { return myMetaData; } public Object getObject(int i, Map map) throws SQLException { throw new AssertionFailedError("MockResultSet getObject not implemented"); } public Object getObject(String colName, Map map) throws SQLException { throw new AssertionFailedError("MockResultSet getObject not implemented"); } public Ref getRef(int i) throws SQLException { return (Ref)getObject(i); } public Ref getRef(String colName) throws SQLException { return (Ref)getObject(colName); } public short getShort(String columnName) throws SQLException { return ((Short)getObject(columnName)).shortValue(); } public short getShort(int columnIndex) throws SQLException { return ((Short)getObject(columnIndex)).shortValue(); } public Statement getStatement() throws SQLException { return myStatement; } public String getString(int columnIndex) throws SQLException { return (String)getObject(columnIndex); } public String getString(String columnName) throws SQLException { return (String)getObject(columnName); } public Time getTime(int columnIndex) throws SQLException { return (Time)getObject(columnIndex); } public Time getTime(String columnName) throws SQLException { return (Time)getObject(columnName); } public Time getTime(int columnIndex, Calendar cal) throws SQLException { return getTime(columnIndex); } public Time getTime(String columnName, Calendar cal) throws SQLException { return getTime(columnName); } public Timestamp getTimestamp(int columnIndex) throws SQLException { return (Timestamp)getObject(columnIndex); } public Timestamp getTimestamp(String columnName) throws SQLException { return (Timestamp)getObject(columnName); } public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { return getTimestamp(columnIndex); } public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException { return getTimestamp(columnName); } public int getType() throws SQLException { throw new AssertionFailedError("MockResultSet getType not implemented"); } public InputStream getUnicodeStream(int columnIndex) throws SQLException { return (InputStream)getObject(columnIndex); } public InputStream getUnicodeStream(String columnName) throws SQLException { return (InputStream)getObject(columnName); } public SQLWarning getWarnings() throws SQLException { throw new AssertionFailedError("MockResultSet getWarnings not implemented"); } public void clearWarnings() throws SQLException { throw new AssertionFailedError("MockResultSet clearWarnings not implemented"); } public int findColumn(String columnName) throws SQLException { throw new AssertionFailedError("MockResultSet findColumn not implemented"); } public boolean isBeforeFirst() throws SQLException { throw new AssertionFailedError("MockResultSet isBeforeFirst not implemented"); } public boolean isAfterLast() throws SQLException { throw new AssertionFailedError("MockResultSet getFetchSize not implemented"); } public boolean isFirst() throws SQLException { throw new AssertionFailedError("MockResultSet isFirst not implemented"); } public boolean isLast() throws SQLException { throw new AssertionFailedError("MockResultSet isLast not implemented"); } public void beforeFirst() throws SQLException { throw new AssertionFailedError("MockResultSet beforeFirst not implemented"); } public void afterLast() throws SQLException { throw new AssertionFailedError("MockResultSet afterLast not implemented"); } public boolean first() throws SQLException { throw new AssertionFailedError("MockResultSet first not implemented"); } public boolean last() throws SQLException { throw new AssertionFailedError("MockResultSet last not implemented"); } public boolean absolute(int row) throws SQLException { throw new AssertionFailedError("MockResultSet absolute not implemented"); } public boolean relative(int rows) throws SQLException { throw new AssertionFailedError("MockResultSet relative not implemented"); } public boolean previous() throws SQLException { throw new AssertionFailedError("MockResultSet previous not implemented"); } public void setFetchDirection(int direction) throws SQLException { throw new AssertionFailedError("MockResultSet setFetchDirection not implemented"); } public void setFetchSize(int rows) throws SQLException { throw new AssertionFailedError("MockResultSet setFetchSize not implemented"); } public boolean rowUpdated() throws SQLException { throw new AssertionFailedError("MockResultSet rowUpdated not implemented"); } public boolean rowInserted() throws SQLException { throw new AssertionFailedError("MockResultSet rowInserted not implemented"); } public boolean rowDeleted() throws SQLException { throw new AssertionFailedError("MockResultSet rowDeleted not implemented"); } public void updateNull(int columnIndex) throws SQLException { throw new AssertionFailedError("MockResultSet updateNull not implemented"); } public void updateBoolean(int columnIndex, boolean x) throws SQLException { throw new AssertionFailedError("MockResultSet updateBoolean not implemented"); } public void updateByte(int columnIndex, byte x) throws SQLException { throw new AssertionFailedError("MockResultSet updateByte not implemented"); } public void updateShort(int columnIndex, short x) throws SQLException { throw new AssertionFailedError("MockResultSet updateShort not implemented"); } public void updateInt(int columnIndex, int x) throws SQLException { throw new AssertionFailedError("MockResultSet updateInt not implemented"); } public void updateLong(int columnIndex, long x) throws SQLException { throw new AssertionFailedError("MockResultSet updateLong not implemented"); } public void updateFloat(int columnIndex, float x) throws SQLException { throw new AssertionFailedError("MockResultSet updateFloat not implemented"); } public void updateDouble(int columnIndex, double x) throws SQLException { throw new AssertionFailedError("MockResultSet updateDouble not implemented"); } public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { throw new AssertionFailedError("MockResultSet updateBigDecimal not implemented"); } public void updateString(int columnIndex, String x) throws SQLException { throw new AssertionFailedError("MockResultSet updateString not implemented"); } public void updateBytes(int columnIndex, byte x[]) throws SQLException { throw new AssertionFailedError("MockResultSet updateBytes not implemented"); } public void updateDate(int columnIndex, Date x) throws SQLException { throw new AssertionFailedError("MockResultSet updateDate not implemented"); } public void updateTime(int columnIndex, Time x) throws SQLException { throw new AssertionFailedError("MockResultSet updateTime not implemented"); } public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { throw new AssertionFailedError("MockResultSet updateTimestamp not implemented"); } public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateAsciiStream not implemented"); } public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateBinaryStream not implemented"); } public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateCharacterStream not implemented"); } public void updateObject(int columnIndex, Object x, int scale) throws SQLException { throw new AssertionFailedError("MockResultSet updateObject not implemented"); } public void updateObject(int columnIndex, Object x) throws SQLException { throw new AssertionFailedError("MockResultSet updateObject not implemented"); } public void updateNull(String columnName) throws SQLException { throw new AssertionFailedError("MockResultSet updateNull not implemented"); } public void updateBoolean(String columnName, boolean x) throws SQLException { throw new AssertionFailedError("MockResultSet updateBoolean not implemented"); } public void updateByte(String columnName, byte x) throws SQLException { throw new AssertionFailedError("MockResultSet updateByte not implemented"); } public void updateShort(String columnName, short x) throws SQLException { throw new AssertionFailedError("MockResultSet updateShort not implemented"); } public void updateInt(String columnName, int x) throws SQLException { throw new AssertionFailedError("MockResultSet updateInt not implemented"); } public void updateLong(String columnName, long x) throws SQLException { throw new AssertionFailedError("MockResultSet updateLong not implemented"); } public void updateFloat(String columnName, float x) throws SQLException { throw new AssertionFailedError("MockResultSet updateFloat not implemented"); } public void updateDouble(String columnName, double x) throws SQLException { throw new AssertionFailedError("MockResultSet updateDouble not implemented"); } public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { throw new AssertionFailedError("MockResultSet updateBigDecimal not implemented"); } public void updateString(String columnName, String x) throws SQLException { throw new AssertionFailedError("MockResultSet updateString not implemented"); } public void updateBytes(String columnName, byte x[]) throws SQLException { throw new AssertionFailedError("MockResultSet updateBytes not implemented"); } public void updateDate(String columnName, Date x) throws SQLException { throw new AssertionFailedError("MockResultSet updateDate not implemented"); } public void updateTime(String columnName, Time x) throws SQLException { throw new AssertionFailedError("MockResultSet updateTime not implemented"); } public void updateTimestamp(String columnName, Timestamp x) throws SQLException { throw new AssertionFailedError("MockResultSet updateTimestamp not implemented"); } public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateAsciiStream not implemented"); } public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateBinaryStream not implemented"); } public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateCharacterStream not implemented"); } public void updateObject(String columnName, Object x, int scale) throws SQLException { throw new AssertionFailedError("MockResultSet updateObject not implemented"); } public void updateObject(String columnName, Object x) throws SQLException { throw new AssertionFailedError("MockResultSet updateObject not implemented"); } public void insertRow() throws SQLException { throw new AssertionFailedError("MockResultSet insertRow not implemented"); } public void updateRow() throws SQLException { throw new AssertionFailedError("MockResultSet updateRow not implemented"); } public void deleteRow() throws SQLException { throw new AssertionFailedError("MockResultSet deleteRow not implemented"); } public void refreshRow() throws SQLException { throw new AssertionFailedError("MockResultSet refreshRow not implemented"); } public void cancelRowUpdates() throws SQLException { throw new AssertionFailedError("MockResultSet cancelRowUpdates not implemented"); } public void moveToInsertRow() throws SQLException { throw new AssertionFailedError("MockResultSet moveToInsertRow not implemented"); } public void moveToCurrentRow() throws SQLException { throw new AssertionFailedError("MockResultSet moveToCurrentRow not implemented"); } public boolean wasNull() throws SQLException { throw new AssertionFailedError("MockResultSet wasNull not implemented"); } //-------------------------- JDBC 3.0 ---------------------------------------- public java.net.URL getURL(int columnIndex) throws SQLException{ return (java.net.URL)getObject(columnIndex); } public java.net.URL getURL(String columnName) throws SQLException{ return (java.net.URL)getObject(columnName); } public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateRef not implemented"); } public void updateRef(String columnName, java.sql.Ref x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateRef not implemented"); } public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateBlob not implemented"); } public void updateBlob(String columnName, java.sql.Blob x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateBlob not implemented"); } public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateClob not implemented"); } public void updateClob(String columnName, java.sql.Clob x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateClob not implemented"); } public void updateArray(int columnIndex, java.sql.Array x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateArray not implemented"); } public void updateArray(String columnName, java.sql.Array x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateArray not implemented"); } /* Methods only to be called inside test classes */ public void setExpectedCloseCalls(int calls) { myCloseCalls.setExpected(calls); } public void setExpectedNextCalls(int calls) { myNextCalls.setExpected(calls); } public void setupMetaData(ResultSetMetaData metaData) { myMetaData = metaData; } public void setupStatement(Statement statement) { myStatement = statement; } } "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." |
From: Verma, N. (C. G. L529706) <Nit...@ge...> - 2002-01-08 22:00:32
|
package com.mockobjects.sql; import java.math.BigDecimal; import java.util.Calendar; import java.sql.*; import java.io.InputStream; import java.io.Reader; import java.util.Map; import com.mockobjects.MockObject; import com.mockobjects.ExpectationCounter; import junit.framework.AssertionFailedError; /** * Trial version * @author Nitin Verma * @version 1.0 24 Dec 2001 */ public abstract class MockResultSet extends MockObject implements ResultSet{ /* Nested MockObjects */ /* Expectations objects that can be set */ private ExpectationCounter myCloseCalls = new ExpectationCounter("MockResultSet.close"); protected ExpectationCounter myNextCalls = new ExpectationCounter("MockResultSet.next"); /* Other objects*/ private ResultSetMetaData myMetaData; private Statement myStatement; /* Methods for mockobject's internal use only */ /* Methods wrapped*/ public MockResultSet() { super(); } /** * Used as the base implementation for getting all types of object, * based on 1-based column index * @see java.sql.ResultSet#getObject(int) */ abstract public Object getObject(int columnIndex) throws SQLException; /** * Used as the base implementation for getting all types of object, * based on columnName * @see java.sql.ResultSet#getObject(int) */ abstract public Object getObject(String columnName) throws SQLException; abstract public boolean next() throws SQLException; abstract public int getRow() throws SQLException; public void close() throws SQLException { myCloseCalls.inc(); } public Array getArray(int i) throws SQLException { return (Array)getObject(i); } public Array getArray(String colName) throws SQLException { return (Array)getObject(colName); } public InputStream getAsciiStream(int columnIndex) throws SQLException { return (InputStream)getObject(columnIndex); } public InputStream getAsciiStream(String columnName) throws SQLException { return (InputStream)getObject(columnName); } public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { return getBigDecimal(columnName); } public BigDecimal getBigDecimal(int columnIndex) throws SQLException { return (BigDecimal)getObject(columnIndex); } public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { return (BigDecimal)getObject(columnIndex); } public BigDecimal getBigDecimal(String columnName) throws SQLException { return (BigDecimal)getObject(columnName); } public InputStream getBinaryStream(int columnIndex) throws SQLException { return (InputStream)getObject(columnIndex); } public InputStream getBinaryStream(String columnName) throws SQLException { return (InputStream)getObject(columnName); } public Blob getBlob(int i) throws SQLException { return (Blob)getObject(i); } public Blob getBlob(String colName) throws SQLException { return (Blob)getObject(colName); } public boolean getBoolean(int columnIndex) throws SQLException { return ((Boolean)getObject(columnIndex)).booleanValue(); } public boolean getBoolean(String columnName) throws SQLException { return ((Boolean)getObject(columnName)).booleanValue(); } public byte getByte(int columnIndex) throws SQLException { return ((Byte)getObject(columnIndex)).byteValue(); } public byte getByte(String columnName) throws SQLException { return ((Byte)getObject(columnName)).byteValue(); } public byte[] getBytes(int columnIndex) throws SQLException { return (byte[])getObject(columnIndex); } public byte[] getBytes(String columnName) throws SQLException { return (byte[])getObject(columnName); } public Reader getCharacterStream(int columnIndex) throws SQLException { return (Reader)getObject(columnIndex); } public Reader getCharacterStream(String columnName) throws SQLException { return (Reader)getObject(columnName); } public Clob getClob(int i) throws SQLException { return (Clob)getObject(i); } public Clob getClob(String colName) throws SQLException { return (Clob)getObject(colName); } public String getCursorName() throws SQLException { throw new AssertionFailedError("MockResultSet getCursorName not implemented"); } public int getConcurrency() throws SQLException { throw new AssertionFailedError("MockResultSet getConcurrency not implemented"); } public Date getDate(int columnIndex) throws SQLException { return (Date)getObject(columnIndex); } public Date getDate(String columnName) throws SQLException { return (Date)getObject(columnName); } public Date getDate(int columnIndex, Calendar cal) throws SQLException { return getDate(columnIndex); } public Date getDate(String columnName, Calendar cal) throws SQLException { return getDate(columnName); } public double getDouble(int columnIndex) throws SQLException { return ((Double)getObject(columnIndex)).doubleValue(); } public double getDouble(String columnName) throws SQLException { return ((Double)getObject(columnName)).doubleValue(); } public int getFetchDirection() throws SQLException { throw new AssertionFailedError("MockResultSet getFetchDirection not implemented"); } public int getFetchSize() throws SQLException { throw new AssertionFailedError("MockResultSet getFetchSize not implemented"); } public float getFloat(int columnIndex) throws SQLException { return ((Float)getObject(columnIndex)).floatValue(); } public float getFloat(String columnName) throws SQLException { return ((Float)getObject(columnName)).floatValue(); } public int getInt(int columnIndex) throws SQLException { return ((Integer) getObject(columnIndex)).intValue(); } public int getInt(String columnName) throws SQLException { return ((Integer) getObject(columnName)).intValue(); } public long getLong(int columnIndex) throws SQLException { return ((Long) getObject(columnIndex)).longValue(); } public long getLong(String columnName) throws SQLException { return ((Long) getObject(columnName)).longValue(); } public ResultSetMetaData getMetaData() throws SQLException { return myMetaData; } public Object getObject(int i, Map map) throws SQLException { throw new AssertionFailedError("MockResultSet getObject not implemented"); } public Object getObject(String colName, Map map) throws SQLException { throw new AssertionFailedError("MockResultSet getObject not implemented"); } public Ref getRef(int i) throws SQLException { return (Ref)getObject(i); } public Ref getRef(String colName) throws SQLException { return (Ref)getObject(colName); } public short getShort(String columnName) throws SQLException { return ((Short)getObject(columnName)).shortValue(); } public short getShort(int columnIndex) throws SQLException { return ((Short)getObject(columnIndex)).shortValue(); } public Statement getStatement() throws SQLException { return myStatement; } public String getString(int columnIndex) throws SQLException { return (String)getObject(columnIndex); } public String getString(String columnName) throws SQLException { return (String)getObject(columnName); } public Time getTime(int columnIndex) throws SQLException { return (Time)getObject(columnIndex); } public Time getTime(String columnName) throws SQLException { return (Time)getObject(columnName); } public Time getTime(int columnIndex, Calendar cal) throws SQLException { return getTime(columnIndex); } public Time getTime(String columnName, Calendar cal) throws SQLException { return getTime(columnName); } public Timestamp getTimestamp(int columnIndex) throws SQLException { return (Timestamp)getObject(columnIndex); } public Timestamp getTimestamp(String columnName) throws SQLException { return (Timestamp)getObject(columnName); } public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { return getTimestamp(columnIndex); } public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException { return getTimestamp(columnName); } public int getType() throws SQLException { throw new AssertionFailedError("MockResultSet getType not implemented"); } public InputStream getUnicodeStream(int columnIndex) throws SQLException { return (InputStream)getObject(columnIndex); } public InputStream getUnicodeStream(String columnName) throws SQLException { return (InputStream)getObject(columnName); } public SQLWarning getWarnings() throws SQLException { throw new AssertionFailedError("MockResultSet getWarnings not implemented"); } public void clearWarnings() throws SQLException { throw new AssertionFailedError("MockResultSet clearWarnings not implemented"); } public int findColumn(String columnName) throws SQLException { throw new AssertionFailedError("MockResultSet findColumn not implemented"); } public boolean isBeforeFirst() throws SQLException { throw new AssertionFailedError("MockResultSet isBeforeFirst not implemented"); } public boolean isAfterLast() throws SQLException { throw new AssertionFailedError("MockResultSet getFetchSize not implemented"); } public boolean isFirst() throws SQLException { throw new AssertionFailedError("MockResultSet isFirst not implemented"); } public boolean isLast() throws SQLException { throw new AssertionFailedError("MockResultSet isLast not implemented"); } public void beforeFirst() throws SQLException { throw new AssertionFailedError("MockResultSet beforeFirst not implemented"); } public void afterLast() throws SQLException { throw new AssertionFailedError("MockResultSet afterLast not implemented"); } public boolean first() throws SQLException { throw new AssertionFailedError("MockResultSet first not implemented"); } public boolean last() throws SQLException { throw new AssertionFailedError("MockResultSet last not implemented"); } public boolean absolute(int row) throws SQLException { throw new AssertionFailedError("MockResultSet absolute not implemented"); } public boolean relative(int rows) throws SQLException { throw new AssertionFailedError("MockResultSet relative not implemented"); } public boolean previous() throws SQLException { throw new AssertionFailedError("MockResultSet previous not implemented"); } public void setFetchDirection(int direction) throws SQLException { throw new AssertionFailedError("MockResultSet setFetchDirection not implemented"); } public void setFetchSize(int rows) throws SQLException { throw new AssertionFailedError("MockResultSet setFetchSize not implemented"); } public boolean rowUpdated() throws SQLException { throw new AssertionFailedError("MockResultSet rowUpdated not implemented"); } public boolean rowInserted() throws SQLException { throw new AssertionFailedError("MockResultSet rowInserted not implemented"); } public boolean rowDeleted() throws SQLException { throw new AssertionFailedError("MockResultSet rowDeleted not implemented"); } public void updateNull(int columnIndex) throws SQLException { throw new AssertionFailedError("MockResultSet updateNull not implemented"); } public void updateBoolean(int columnIndex, boolean x) throws SQLException { throw new AssertionFailedError("MockResultSet updateBoolean not implemented"); } public void updateByte(int columnIndex, byte x) throws SQLException { throw new AssertionFailedError("MockResultSet updateByte not implemented"); } public void updateShort(int columnIndex, short x) throws SQLException { throw new AssertionFailedError("MockResultSet updateShort not implemented"); } public void updateInt(int columnIndex, int x) throws SQLException { throw new AssertionFailedError("MockResultSet updateInt not implemented"); } public void updateLong(int columnIndex, long x) throws SQLException { throw new AssertionFailedError("MockResultSet updateLong not implemented"); } public void updateFloat(int columnIndex, float x) throws SQLException { throw new AssertionFailedError("MockResultSet updateFloat not implemented"); } public void updateDouble(int columnIndex, double x) throws SQLException { throw new AssertionFailedError("MockResultSet updateDouble not implemented"); } public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { throw new AssertionFailedError("MockResultSet updateBigDecimal not implemented"); } public void updateString(int columnIndex, String x) throws SQLException { throw new AssertionFailedError("MockResultSet updateString not implemented"); } public void updateBytes(int columnIndex, byte x[]) throws SQLException { throw new AssertionFailedError("MockResultSet updateBytes not implemented"); } public void updateDate(int columnIndex, Date x) throws SQLException { throw new AssertionFailedError("MockResultSet updateDate not implemented"); } public void updateTime(int columnIndex, Time x) throws SQLException { throw new AssertionFailedError("MockResultSet updateTime not implemented"); } public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { throw new AssertionFailedError("MockResultSet updateTimestamp not implemented"); } public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateAsciiStream not implemented"); } public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateBinaryStream not implemented"); } public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateCharacterStream not implemented"); } public void updateObject(int columnIndex, Object x, int scale) throws SQLException { throw new AssertionFailedError("MockResultSet updateObject not implemented"); } public void updateObject(int columnIndex, Object x) throws SQLException { throw new AssertionFailedError("MockResultSet updateObject not implemented"); } public void updateNull(String columnName) throws SQLException { throw new AssertionFailedError("MockResultSet updateNull not implemented"); } public void updateBoolean(String columnName, boolean x) throws SQLException { throw new AssertionFailedError("MockResultSet updateBoolean not implemented"); } public void updateByte(String columnName, byte x) throws SQLException { throw new AssertionFailedError("MockResultSet updateByte not implemented"); } public void updateShort(String columnName, short x) throws SQLException { throw new AssertionFailedError("MockResultSet updateShort not implemented"); } public void updateInt(String columnName, int x) throws SQLException { throw new AssertionFailedError("MockResultSet updateInt not implemented"); } public void updateLong(String columnName, long x) throws SQLException { throw new AssertionFailedError("MockResultSet updateLong not implemented"); } public void updateFloat(String columnName, float x) throws SQLException { throw new AssertionFailedError("MockResultSet updateFloat not implemented"); } public void updateDouble(String columnName, double x) throws SQLException { throw new AssertionFailedError("MockResultSet updateDouble not implemented"); } public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { throw new AssertionFailedError("MockResultSet updateBigDecimal not implemented"); } public void updateString(String columnName, String x) throws SQLException { throw new AssertionFailedError("MockResultSet updateString not implemented"); } public void updateBytes(String columnName, byte x[]) throws SQLException { throw new AssertionFailedError("MockResultSet updateBytes not implemented"); } public void updateDate(String columnName, Date x) throws SQLException { throw new AssertionFailedError("MockResultSet updateDate not implemented"); } public void updateTime(String columnName, Time x) throws SQLException { throw new AssertionFailedError("MockResultSet updateTime not implemented"); } public void updateTimestamp(String columnName, Timestamp x) throws SQLException { throw new AssertionFailedError("MockResultSet updateTimestamp not implemented"); } public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateAsciiStream not implemented"); } public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateBinaryStream not implemented"); } public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException { throw new AssertionFailedError("MockResultSet updateCharacterStream not implemented"); } public void updateObject(String columnName, Object x, int scale) throws SQLException { throw new AssertionFailedError("MockResultSet updateObject not implemented"); } public void updateObject(String columnName, Object x) throws SQLException { throw new AssertionFailedError("MockResultSet updateObject not implemented"); } public void insertRow() throws SQLException { throw new AssertionFailedError("MockResultSet insertRow not implemented"); } public void updateRow() throws SQLException { throw new AssertionFailedError("MockResultSet updateRow not implemented"); } public void deleteRow() throws SQLException { throw new AssertionFailedError("MockResultSet deleteRow not implemented"); } public void refreshRow() throws SQLException { throw new AssertionFailedError("MockResultSet refreshRow not implemented"); } public void cancelRowUpdates() throws SQLException { throw new AssertionFailedError("MockResultSet cancelRowUpdates not implemented"); } public void moveToInsertRow() throws SQLException { throw new AssertionFailedError("MockResultSet moveToInsertRow not implemented"); } public void moveToCurrentRow() throws SQLException { throw new AssertionFailedError("MockResultSet moveToCurrentRow not implemented"); } public boolean wasNull() throws SQLException { throw new AssertionFailedError("MockResultSet wasNull not implemented"); } //-------------------------- JDBC 3.0 ---------------------------------------- public java.net.URL getURL(int columnIndex) throws SQLException{ return (java.net.URL)getObject(columnIndex); } public java.net.URL getURL(String columnName) throws SQLException{ return (java.net.URL)getObject(columnName); } public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateRef not implemented"); } public void updateRef(String columnName, java.sql.Ref x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateRef not implemented"); } public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateBlob not implemented"); } public void updateBlob(String columnName, java.sql.Blob x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateBlob not implemented"); } public void updateClob(int columnIndex, java.sql.Clob x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateClob not implemented"); } public void updateClob(String columnName, java.sql.Clob x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateClob not implemented"); } public void updateArray(int columnIndex, java.sql.Array x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateArray not implemented"); } public void updateArray(String columnName, java.sql.Array x) throws SQLException{ throw new AssertionFailedError("MockResultSet updateArray not implemented"); } /* Methods only to be called inside test classes */ public void setExpectedCloseCalls(int calls) { myCloseCalls.setExpected(calls); } public void setExpectedNextCalls(int calls) { myNextCalls.setExpected(calls); } public void setupMetaData(ResultSetMetaData metaData) { myMetaData = metaData; } public void setupStatement(Statement statement) { myStatement = statement; } } "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." |
From: Verma, N. (C. G. L529706) <Nit...@ge...> - 2002-01-08 21:59:32
|
package com.mockobjects.sql; import java.sql.*; import java.util.ArrayList; import java.util.Map; import junit.framework.AssertionFailedError; import com.mockobjects.MockObject; import com.mockobjects.ExpectationCounter; import com.mockobjects.ExpectationCollection; import com.mockobjects.ExpectationList; import com.mockobjects.ExpectationValue; /** * Trial version * @author Nitin Verma, Sridhar * @version 1.0 24 Dec 2001 */ public class MockConnection extends MockObject implements Connection{ /* Nested MockObjects */ private MockCallableStatement myCallableStatement; /*Expectations objects that can be set */ private ExpectationCounter myCommitCalls = new ExpectationCounter("MockConnection.commit"); private ExpectationCounter myRollbackCalls = new ExpectationCounter("MockConnection.rollback"); private ExpectationCounter myCloseCalls = new ExpectationCounter("MockConnection.close"); private ExpectationValue myPrepareCallString = new ExpectationValue("MockConnection.prepareCallString"); private ExpectationCollection myPreparedStatementStrings = new ExpectationList("MockConnection.preparedStatementString"); private ExpectationCounter myCreateStatementCalls = new ExpectationCounter("MockConnection.createStatement"); private ExpectationValue myAutoCommit = new ExpectationValue("MockConnection.setAutoCommit"); /*Other objects*/ private Statement myStatement; private ArrayList myPreparedStatements = new ArrayList(); private SQLException myStatementException = null; private int myHoldability = 0; /* Methods for mockobject's internal use only */ /* Methods wrapped*/ public MockConnection() { super(); } public void clearWarnings() throws SQLException { } public void close() throws SQLException { myCloseCalls.inc(); } public void commit() throws SQLException { myCommitCalls.inc(); } public Statement createStatement() throws SQLException { myCreateStatementCalls.inc(); throwStatementExceptionIfAny(); return myStatement; } public Statement createStatement( int resultSetType, int resultSetConcurrency) throws SQLException { throw new UnsupportedOperationException(); } public boolean getAutoCommit() throws SQLException { throw new UnsupportedOperationException(); } public String getCatalog() throws SQLException { throw new UnsupportedOperationException(); } public DatabaseMetaData getMetaData() throws SQLException { throw new UnsupportedOperationException(); } public int getTransactionIsolation() throws SQLException { throw new UnsupportedOperationException(); } public Map getTypeMap() throws SQLException { throw new UnsupportedOperationException(); } public SQLWarning getWarnings() throws SQLException { throw new UnsupportedOperationException(); } public boolean isClosed() throws SQLException { throw new UnsupportedOperationException(); } public boolean isReadOnly() throws SQLException { throw new UnsupportedOperationException(); } public String nativeSQL(String sql) throws SQLException { throw new UnsupportedOperationException(); } // Implementation provided as this method is called in executeStoredProcedure(TSFStdSP) of TSFDatabase public CallableStatement prepareCall(String sql) throws SQLException { myPrepareCallString.setActual(sql); throwStatementExceptionIfAny(); return myCallableStatement; } public CallableStatement prepareCall( String sql, int resultSetType, int resultSetConcurrency) throws SQLException { throw new UnsupportedOperationException(); } public PreparedStatement prepareStatement(String sql) throws SQLException { myPreparedStatementStrings.addActual(sql); throwStatementExceptionIfAny(); return (PreparedStatement) myPreparedStatements.remove(0); } public PreparedStatement prepareStatement( String sql, int resultSetType, int resultSetConcurrency) throws SQLException { throw new UnsupportedOperationException(); } public void rollback() throws SQLException { myRollbackCalls.inc(); } public void setExpectedAutoCommit(boolean autoCommit) { myAutoCommit.setExpected(autoCommit); } public void setAutoCommit(boolean autoCommit) throws SQLException { myAutoCommit.setActual(autoCommit); } public void setCatalog(String catalog) throws SQLException { throw new UnsupportedOperationException(); } public void setReadOnly(boolean readOnly) throws SQLException { throw new UnsupportedOperationException(); } public void setTransactionIsolation(int level) throws SQLException { throw new UnsupportedOperationException(); } public void setTypeMap(Map map) throws SQLException { throw new UnsupportedOperationException(); } //--------------------------JDBC 3.0----------------------------- public void setHoldability(int holdability) throws SQLException{ myHoldability = holdability; } public int getHoldability() throws SQLException{ return myHoldability; } public Savepoint setSavepoint() throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public Savepoint setSavepoint(String name) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void rollback(Savepoint savepoint) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void releaseSavepoint(Savepoint savepoint) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public PreparedStatement prepareStatement(String sql, int columnIndexes[]) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public PreparedStatement prepareStatement(String sql, String columnNames[]) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } /* Methods only to be called inside test classes */ public void setExpectedCloseCalls(int callCount) { myCloseCalls.setExpected(callCount); } public void setExpectedCommitCalls(int callCount) { myCommitCalls.setExpected(callCount); } public void setExpectedCreateStatementCalls(int calls) { myCreateStatementCalls.setExpected(calls); } public void addExpectedPreparedStatementString(String sql) { myPreparedStatementStrings.addExpected(sql); } public void addExpectedPrepareCallString(String sql) { myPrepareCallString.setExpected(sql); } public void setExpectedRollbackCalls(int callCount) { myRollbackCalls.setExpected(callCount); } public void setupAddPreparedStatement(PreparedStatement prepared) { myPreparedStatements.add(prepared); } public void setupStatement(Statement statement) { myStatement = statement; } public void setupThrowExceptionOnPrepareOrCreate(SQLException exception) { myStatementException = exception; } private void throwStatementExceptionIfAny() throws SQLException { if (null != myStatementException) { throw myStatementException; } } } "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." |
From: Verma, N. (C. G. L529706) <Nit...@ge...> - 2002-01-08 21:57:57
|
package com.mockobjects.sql; import java.sql.*; import com.mockobjects.MockObject; import com.mockobjects.ExpectationCounter; import com.mockobjects.ExpectationValue; import junit.framework.AssertionFailedError; /** * Trial version * @author Nitin Verma * @version 1.0 24 Dec 2001 */ public class MockStatement extends MockObject implements Statement { /* Nested MockObjects */ protected MockResultSet myResultSet; /*Expectations objects that can be set */ protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockStatement.closeCalls"); protected ExpectationCounter myExecuteCalls = new ExpectationCounter("MockStatement.executeCalls"); protected ExpectationValue myQueryString = new ExpectationValue("MockStatement.queryString"); protected ExpectationValue myAutoGeneratedKeysInt = new ExpectationValue("MockStatement.executeUpdate(String,int)"); /*Other objects*/ private int myUpdateCount = 0; private boolean myAutoGenerated = false; private boolean myExecuteReturn = false; private int myResultSetHoldability = 0; private SQLException myExecuteException = null; /* Methods for mockobject's internal use only */ protected void innerExecute() throws SQLException { myExecuteCalls.inc(); if (null != myExecuteException) { throw myExecuteException; } } /* Methods wrapped*/ public MockStatement() { super(); } public ResultSet executeQuery(String p_sql) throws SQLException{ myQueryString.setActual(p_sql); innerExecute(); return myResultSet; } public int executeUpdate(String p_sql) throws SQLException{ myQueryString.setActual(p_sql); innerExecute(); return myUpdateCount; } public void close() throws SQLException{ myCloseCalls.inc(); } public int getMaxFieldSize() throws SQLException{ throw new UnsupportedOperationException(); } public void setMaxFieldSize(int max) throws SQLException{ throw new UnsupportedOperationException(); } public int getMaxRows() throws SQLException{ throw new UnsupportedOperationException(); } public void setMaxRows(int max) throws SQLException{ throw new UnsupportedOperationException(); } public void setEscapeProcessing(boolean enable) throws SQLException{ throw new UnsupportedOperationException(); } public int getQueryTimeout() throws SQLException{ throw new UnsupportedOperationException(); } public void setQueryTimeout(int seconds) throws SQLException{ throw new UnsupportedOperationException(); } public void cancel() throws SQLException{ throw new UnsupportedOperationException(); } public SQLWarning getWarnings() throws SQLException{ throw new UnsupportedOperationException(); } public void clearWarnings() throws SQLException{ throw new UnsupportedOperationException(); } public void setCursorName(String name) throws SQLException{ throw new UnsupportedOperationException(); } public boolean execute(String p_sql) throws SQLException{ myQueryString.setActual(p_sql); innerExecute(); return myExecuteReturn; } public ResultSet getResultSet() throws SQLException{ throw new UnsupportedOperationException(); } public int getUpdateCount() throws SQLException{ throw new UnsupportedOperationException(); } public boolean getMoreResults() throws SQLException{ throw new UnsupportedOperationException(); } //--------------------------JDBC 2.0----------------------------- public void setFetchDirection(int direction) throws SQLException{ throw new UnsupportedOperationException(); } public int getFetchDirection() throws SQLException{ throw new UnsupportedOperationException(); } public void setFetchSize(int rows) throws SQLException{ throw new UnsupportedOperationException(); } public int getFetchSize() throws SQLException{ throw new UnsupportedOperationException(); } public int getResultSetConcurrency() throws SQLException{ throw new UnsupportedOperationException(); } public int getResultSetType() throws SQLException{ throw new UnsupportedOperationException(); } public void addBatch( String sql ) throws SQLException{ throw new UnsupportedOperationException(); } public void clearBatch() throws SQLException{ throw new UnsupportedOperationException(); } public int[] executeBatch() throws SQLException{ throw new UnsupportedOperationException(); } public Connection getConnection() throws SQLException{ throw new UnsupportedOperationException(); } //--------------------------JDBC 3.0----------------------------- public boolean getMoreResults(int current) throws SQLException{ throw new UnsupportedOperationException(); } public ResultSet getGeneratedKeys() throws SQLException{ if(myAutoGenerated == true) return myResultSet; else throw new SQLException("executeUpdate/execute not called"); } public int executeUpdate(String p_sql, int p_autoGeneratedKeys) throws SQLException{ myQueryString.setActual(p_sql); myAutoGeneratedKeysInt.setActual(p_autoGeneratedKeys); innerExecute(); myAutoGenerated = true; return myUpdateCount; } public int executeUpdate(String sql, int columnIndexes[]) throws SQLException{ throw new UnsupportedOperationException(); } public int executeUpdate(String sql, String columnNames[]) throws SQLException{ throw new UnsupportedOperationException(); } public boolean execute(String p_sql, int p_autoGeneratedKeys) throws SQLException{ myQueryString.setActual(p_sql); myAutoGeneratedKeysInt.setActual(p_autoGeneratedKeys); innerExecute(); myAutoGenerated = true; return myExecuteReturn; } public boolean execute(String sql, int columnIndexes[]) throws SQLException{ throw new UnsupportedOperationException(); } public boolean execute(String sql, String columnNames[]) throws SQLException{ throw new UnsupportedOperationException(); } public int getResultSetHoldability() throws SQLException{ return myResultSetHoldability; } /* Methods only to be called inside test classes */ public void setExpectedExecuteCalls(int p_callCount) { myExecuteCalls.setExpected(p_callCount); } public void setExpectedQueryString(String p_queryString) { myQueryString.setExpected(p_queryString); } public void setExpectedCloseCalls(int p_callCount) { myCloseCalls.setExpected(p_callCount); } public void setupResultSet(MockResultSet p_resultSet) { myResultSet = p_resultSet; } public void setupThrowExceptionOnExecute(SQLException p_exception) { myExecuteException = p_exception; } public void setupUpdateCount(int p_updateCount) { myUpdateCount = p_updateCount; } public void setupExecuteReturn(boolean p_executeReturn) { myExecuteReturn = p_executeReturn; } public void setupResultSetHoldability(int p_resultSetHoldability){ myResultSetHoldability = p_resultSetHoldability; } } "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." |
From: Verma, N. (C. G. L529706) <Nit...@ge...> - 2002-01-08 21:56:51
|
package com.mockobjects.sql; import java.math.BigDecimal; import java.util.Calendar; import java.sql.*; import com.mockobjects.ExpectationCounter; import com.mockobjects.ExpectationSet; import com.mockobjects.MapEntry; import junit.framework.AssertionFailedError; /** * Trial version * @author Nitin Verma * @version 1.0 24 Dec 2001 */ public class MockPreparedStatement extends MockStatement implements PreparedStatement{ /* Nested MockObjects */ /*Expectations objects that can be set */ private ExpectationSet mySetParameters = new ExpectationSet("MockPreparedStatement.setParameters"); private ExpectationCounter myclearParametersCalls = new ExpectationCounter("MockPreparedStatement.clearParameters() calls"); /*Other objects*/ ParameterMetaData myparameterMetaData; /* Methods for mockobject's internal use only */ /* Methods wrapped*/ public MockPreparedStatement() { super(); } public void clearParameters() throws SQLException { myclearParametersCalls.inc(); } public boolean execute() throws SQLException { return execute(""); } public ResultSet executeQuery() throws SQLException { return executeQuery(""); } public int executeUpdate() throws SQLException { return executeUpdate(""); } public void setInt(int parameterIndex, int x) throws SQLException { setObject(parameterIndex, new Integer(x)); } public void setString(int parameterIndex, String x) throws SQLException { setObject(parameterIndex, x); } public void setTimestamp(int param, Timestamp timestamp) throws SQLException { setObject(param, timestamp); } public void setClob(int param, Clob clob) throws SQLException { setObject(param, clob); } public void setLong(int param, long aLong) throws SQLException { setObject(param, new Long(aLong)); } public void addBatch() throws SQLException { throw new UnsupportedOperationException(); } public void setNull(int param, int param1) throws SQLException { throw new UnsupportedOperationException(); } public void setArray(int param, Array array) throws SQLException { setObject(param, array); } public void setShort(int param, short aShort) throws SQLException { setObject(param, new Short(aShort)); } public void setTime(int param, Time time, Calendar calendar) throws SQLException { setObject(param, time); } public void setObject(int param, Object obj, int targetSqlType, int scale) throws SQLException { throw new UnsupportedOperationException(); } public void setObject(int param, Object obj, int targetSqlType) throws SQLException { throw new UnsupportedOperationException(); } public void setRef(int param, Ref ref) throws SQLException { setObject(param, ref); } public void setDate(int param, Date date) throws SQLException { setObject(param, date); } public void setFloat(int param, float aFloat) throws SQLException { setObject(param, new Float(aFloat)); } public void setBlob(int param, Blob blob) throws SQLException { setObject(param, blob); } public void setCharacterStream(int param, java.io.Reader reader, int length) throws SQLException { throw new UnsupportedOperationException(); } public void setAsciiStream(int param, java.io.InputStream inputStream, int length) throws SQLException { throw new UnsupportedOperationException(); } public void setDate(int param, Date date, Calendar calendar) throws SQLException { setDate(param, date); } public void setBinaryStream(int param, java.io.InputStream inputStream, int length) throws SQLException { throw new UnsupportedOperationException(); } public void setUnicodeStream(int param, java.io.InputStream inputStream, int length) throws SQLException { throw new UnsupportedOperationException(); } public void setBytes(int param, byte[] values) throws SQLException { setObject(param, values); } public void setObject(int param, Object obj) throws SQLException { mySetParameters.addActual(new MapEntry(new Integer(param), obj)); } public void setByte(int param, byte aByte) throws SQLException { setObject(param, new Byte(aByte)); } public void setDouble(int param, double aDouble) throws SQLException { setObject(param, new Double(aDouble)); } public ResultSetMetaData getMetaData() throws SQLException { throw new UnsupportedOperationException(); } public void setTimestamp(int param, Timestamp timestamp, Calendar calendar) throws SQLException { throw new UnsupportedOperationException(); } public void setTime(int param, Time time) throws SQLException { setObject(param, time); } public void setBoolean(int param, boolean aBoolean) throws SQLException { setObject(param, new Boolean(aBoolean)); } public void setNull(int param, int param1, String typeName) throws SQLException { throw new UnsupportedOperationException(); } public void setBigDecimal(int param, BigDecimal bigDecimal) throws SQLException { setObject(param, bigDecimal); } //------------------------- JDBC 3.0 ----------------------------------- public void setURL(int parameterIndex, java.net.URL p_url) throws SQLException{ setObject(parameterIndex, p_url); } public ParameterMetaData getParameterMetaData() throws SQLException{ throw new AssertionFailedError("Not Implemented"); } /* Methods only to be called inside test classes */ public void addExpectedSetParameter(int p_parameterIndex, boolean p_value) { addExpectedSetParameter(p_parameterIndex, new Boolean(p_value)); } public void addExpectedSetParameter(int p_parameterIndex, byte p_value) { addExpectedSetParameter(p_parameterIndex, new Byte(p_value)); } public void addExpectedSetParameter(int p_parameterIndex, char p_value) { addExpectedSetParameter(p_parameterIndex, new Character(p_value)); } public void addExpectedSetParameter(int p_parameterIndex, short p_value) { addExpectedSetParameter(p_parameterIndex, new Short(p_value)); } public void addExpectedSetParameter(int p_parameterIndex, int p_value) { addExpectedSetParameter(p_parameterIndex, new Integer(p_value)); } public void addExpectedSetParameter(int p_parameterIndex, long p_value) { addExpectedSetParameter(p_parameterIndex, new Long(p_value)); } public void addExpectedSetParameter(int p_parameterIndex, float p_value) { addExpectedSetParameter(p_parameterIndex, new Float(p_value)); } public void addExpectedSetParameter(int p_parameterIndex, double p_value) { addExpectedSetParameter(p_parameterIndex, new Double(p_value)); } public void addExpectedSetParameter(int parameterIndex, Object parameterValue) { mySetParameters.addExpected(new MapEntry(new Integer(parameterIndex), parameterValue)); } public void addExpectedSetParameters(Object[] parameters) { for (int i = 0; i < parameters.length; ++i) { addExpectedSetParameter(i + 1, parameters[i]); } } public void setExpectedClearParametersCalls(int callCount) { myclearParametersCalls.setExpected(callCount); } public void setExpectingNoSetParameters() { mySetParameters.setExpectNothing(); } public void setupParameterMetaData(ParameterMetaData p_parameterMetaData){ myparameterMetaData = p_parameterMetaData; } } "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." |
From: Verma, N. (C. G. L529706) <Nit...@ge...> - 2002-01-08 21:53:48
|
package com.mockobjects.sql; import java.math.BigDecimal; import java.util.Calendar; import java.sql.*; import com.mockobjects.util.NotImplementedException; import com.mockobjects.ExpectationValue; import com.mockobjects.ExpectationSet; import com.mockobjects.MapEntry; import junit.framework.AssertionFailedError; /** * Trial version * @author Nitin Verma * @version 1.0 24 Dec 2001 */ public class MockCallableStatement extends MockPreparedStatement implements CallableStatement { /* Nested MockObjects */ /*Expectations objects that can be set */ private ExpectationSet myRegisterOutParameters = new ExpectationSet("MockCallableStatement.myRegisterOutParameters"); private ExpectationSet myRegisterOutParametersName = new ExpectationSet("MockCallableStatement.myRegisterOutParameters(parameterName) "); private ExpectationValue myCalendarObject = new ExpectationValue("MockCallableStatement.calendar"); /*Other objects*/ /* Methods for mockobject's internal use only */ /* Methods wrapped*/ public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException{ myRegisterOutParameters.addActual(new MapEntry(new Integer(parameterIndex),new OutParameter(new Integer(sqlType)))); } public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException{ myRegisterOutParameters.addActual(new MapEntry(new Integer(parameterIndex),new OutParameter(new Integer(sqlType),new Integer(scale)))); } public boolean wasNull() throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public String getString(int parameterIndex) throws SQLException{ return myResultSet.getString(parameterIndex); } public boolean getBoolean(int parameterIndex) throws SQLException{ return myResultSet.getBoolean(parameterIndex); } public byte getByte(int parameterIndex) throws SQLException{ return myResultSet.getByte(parameterIndex); } public short getShort(int parameterIndex) throws SQLException{ return myResultSet.getShort(parameterIndex); } public int getInt(int parameterIndex) throws SQLException{ return myResultSet.getInt(parameterIndex); } public long getLong(int parameterIndex) throws SQLException{ return myResultSet.getLong(parameterIndex); } public float getFloat(int parameterIndex) throws SQLException{ return myResultSet.getFloat(parameterIndex); } public double getDouble(int parameterIndex) throws SQLException{ return myResultSet.getDouble(parameterIndex); } public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException{ return myResultSet.getBigDecimal(parameterIndex); } public byte[] getBytes(int parameterIndex) throws SQLException{ return myResultSet.getBytes(parameterIndex); } public java.sql.Date getDate(int parameterIndex) throws SQLException{ return myResultSet.getDate(parameterIndex); } public java.sql.Time getTime(int parameterIndex) throws SQLException{ return myResultSet.getTime(parameterIndex); } public java.sql.Timestamp getTimestamp(int parameterIndex) throws SQLException{ return myResultSet.getTimestamp(parameterIndex); } public Object getObject(int parameterIndex) throws SQLException{ return myResultSet.getObject(parameterIndex); } //--------------------------JDBC 2.0----------------------------- public BigDecimal getBigDecimal(int parameterIndex) throws SQLException{ return myResultSet.getBigDecimal(parameterIndex); } public Object getObject(int i, java.util.Map map) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public Ref getRef(int parameterIndex) throws SQLException{ return myResultSet.getRef(parameterIndex); } public Blob getBlob(int parameterIndex) throws SQLException{ return myResultSet.getBlob(parameterIndex); } public Clob getClob(int parameterIndex) throws SQLException{ return myResultSet.getClob(parameterIndex); } public Array getArray (int parameterIndex) throws SQLException{ return myResultSet.getArray(parameterIndex); } public java.sql.Date getDate(int parameterIndex, Calendar cal) throws SQLException{ return myResultSet.getDate(parameterIndex); } public java.sql.Time getTime(int parameterIndex, Calendar cal) throws SQLException{ return myResultSet.getTime(parameterIndex); } public java.sql.Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException{ return myResultSet.getTimestamp(parameterIndex); } public void registerOutParameter (int parameterIndex, int sqlType, String typeName) throws SQLException{ myRegisterOutParameters.addActual(new MapEntry(new Integer(parameterIndex),new OutParameter(new Integer(sqlType),typeName))); } //--------------------------JDBC 3.0----------------------------- public void registerOutParameter(String parameterName, int sqlType) throws SQLException{ myRegisterOutParametersName.addActual(new MapEntry(parameterName,new OutParameter(new Integer(sqlType)))); } public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException{ myRegisterOutParametersName.addActual(new MapEntry(parameterName,new OutParameter(new Integer(sqlType),new Integer(scale)))); } public void registerOutParameter (String parameterName, int sqlType, String typeName) throws SQLException{ myRegisterOutParametersName.addActual(new MapEntry(parameterName,new OutParameter(new Integer(sqlType),typeName))); } public java.net.URL getURL(int parameterIndex) throws SQLException{ return myResultSet.getURL(parameterIndex); } public void setURL(String parameterName, java.net.URL val) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setNull(String parameterName, int sqlType) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setBoolean(String parameterName, boolean x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setByte(String parameterName, byte x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setShort(String parameterName, short x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setInt(String parameterName, int x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setLong(String parameterName, long x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setFloat(String parameterName, float x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setDouble(String parameterName, double x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setString(String parameterName, String x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setBytes(String parameterName, byte x[]) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setDate(String parameterName, java.sql.Date x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setTime(String parameterName, java.sql.Time x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setTimestamp(String parameterName, java.sql.Timestamp x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setAsciiStream(String parameterName, java.io.InputStream x, int length) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setBinaryStream(String parameterName, java.io.InputStream x, int length) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setObject(String parameterName, Object x, int targetSqlType, int scale) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setObject(String parameterName, Object x, int targetSqlType) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setObject(String parameterName, Object x) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setCharacterStream(String parameterName, java.io.Reader reader, int length) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setDate(String parameterName, java.sql.Date x, Calendar cal) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setTime(String parameterName, java.sql.Time x, Calendar cal) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public String getString(String parameterName) throws SQLException{ return myResultSet.getString(parameterName); } public boolean getBoolean(String parameterName) throws SQLException{ return myResultSet.getBoolean(parameterName); } public byte getByte(String parameterName) throws SQLException{ return myResultSet.getByte(parameterName); } public short getShort(String parameterName) throws SQLException{ return myResultSet.getShort(parameterName); } public int getInt(String parameterName) throws SQLException{ return myResultSet.getInt(parameterName); } public long getLong(String parameterName) throws SQLException{ return myResultSet.getLong(parameterName); } public float getFloat(String parameterName) throws SQLException{ return myResultSet.getFloat(parameterName); } public double getDouble(String parameterName) throws SQLException{ return myResultSet.getDouble(parameterName); } public byte[] getBytes(String parameterName) throws SQLException{ return myResultSet.getBytes(parameterName); } public java.sql.Date getDate(String parameterName) throws SQLException{ return myResultSet.getDate(parameterName); } public java.sql.Time getTime(String parameterName) throws SQLException{ return myResultSet.getTime(parameterName); } public java.sql.Timestamp getTimestamp(String parameterName) throws SQLException{ return myResultSet.getTimestamp(parameterName); } public Object getObject(String parameterName) throws SQLException{ return myResultSet.getObject(parameterName); } public BigDecimal getBigDecimal(String parameterName) throws SQLException{ return myResultSet.getBigDecimal(parameterName); } public Object getObject (String parameterName, java.util.Map map) throws SQLException{ throw new AssertionFailedError("Not Implemented"); } public Ref getRef(String parameterName) throws SQLException{ return myResultSet.getRef(parameterName); } public Blob getBlob(String parameterName) throws SQLException{ return myResultSet.getBlob(parameterName); } public Clob getClob(String parameterName) throws SQLException{ return myResultSet.getClob(parameterName); } public Array getArray(String parameterName) throws SQLException{ return myResultSet.getArray(parameterName); } public java.sql.Date getDate(String parameterName, Calendar cal) throws SQLException{ myCalendarObject.setActual(cal); return myResultSet.getDate(parameterName); } public java.sql.Time getTime(String parameterName, Calendar cal) throws SQLException{ myCalendarObject.setActual(cal); return myResultSet.getTime(parameterName); } public java.sql.Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException{ myCalendarObject.setActual(cal); return myResultSet.getTimestamp(parameterName); } public java.net.URL getURL(String parameterName) throws SQLException{ return myResultSet.getURL(parameterName); } /* Methods only to be called inside test classes */ public void setupCalendarObject(Calendar p_calendar){ myCalendarObject.setExpected(p_calendar); } public void addExpectedRegisterOutParameter(int parameterIndex, OutParameter parameterValue) { myRegisterOutParameters.addExpected(new MapEntry(new Integer(parameterIndex), parameterValue)); } public void addExpectedRegisterOutParameters(OutParameter[] parameters) { for (int i = 0; i < parameters.length; ++i) { addExpectedSetParameter(i + 1, parameters[i]); } } public void addExpectedRegisterOutParameterName(String parameterName, OutParameter parameterValue) { myRegisterOutParametersName.addExpected(new MapEntry(parameterName, parameterValue)); } } class OutParameter{ private Integer mySqlType; private Integer myScale; private String myTypeName; public OutParameter(Integer p_sqlType, Integer p_scale){ this(p_sqlType,null,p_scale); } public OutParameter(Integer p_sqlType){ this(p_sqlType,null,null); } public OutParameter(Integer p_sqlType, String p_typeName){ this(p_sqlType,p_typeName,null); } private OutParameter(Integer p_sqlType, String p_typeName, Integer p_scale){ mySqlType = p_sqlType; myTypeName = p_typeName; myScale = p_scale; } public Integer getSqlType(){ return mySqlType; } public String getTypeName(){ return myTypeName; } public Integer getScale(){ return myScale; } public boolean equals(Object obj){ if(obj instanceof com.mockobjects.sql.OutParameter){ return equals((OutParameter)obj); } else{ return false; } } public boolean equals(OutParameter obj){ if(mySqlType.equals(obj.getSqlType())){ if(myScale != null){ return myScale.equals(obj.getScale()); } else{ if(obj.getScale()==null){ if(myTypeName != null){ return myTypeName.equals(obj.getTypeName()); } else{ if(obj.getTypeName() == null) return true; else return false; } } else{ return false; } } } else{ return false; } } } "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." |