Gregory M. KapfhammerAssociate Professor of Computer Sciencehttp://www.cs.allegheny.edu/~gkapfham/ |
Laboratory One Discussion
If you have questions or comments about this laboratory, please post them here.Remember, this conversation should adhere to the Computer Science Department's Honor Code; it is acceptable to conduct high level conversations, but it is not acceptable to share source code! Remember, post your questions here instead of sending them to me via email! GregTestCaseJust as a general note: as you continue to work on this laboratory assignment, you should remember that I do not expect you to completely test this class. But, you should conduct the best effort that is within your grasp! Hopefully, this lab will force you to grapple with some of the "accidents" of Java development and you will become comfortable with them from this point forward! As I have mentioned to other students, we will also be using tools (some of which Chris McNamara alluded to at his talk today) that will make this process much easier! Greg
I'm curious as to why our test case class that extends
TestCasedoesn't inherit the constructor (i.e. we have to write a constructor that calls its superclass's constructor as the only action). Greg alluded to an answer earlier, so I assume it's something logical. bps
The
TestCaseclass happens to have a constructor that is not public. This means that you will need to make your own constructor in your own subclass of
super()that simply calls
namewith the same
assertparameter. What did the tutorials say about this design decision? Greg
We're a little confused as to what the variables True and False are used for (We assume they return true and false, but where does that fit in the program?), and how exactly the getBank(), setBank(), and Transaction agents are supposed to funcion.
Matt Rummel
Basically there is an int variable called TRUE that's set equal to 1 and another int variable called FALSE that's equal to 0. Because there are apparently no boolean fields in a mysql database fields like acct_locked can't take boolean true or false so we just work around that by having 1 = TRUE and 0 = FALSE. Jim Clause
I think that the response provided by Jim Clause is right on track. Let me go one step further and talk about how this affects testing (based on a conversation that I had with Matt DeNapoli). If you want to write an
accountExists()concerning whether or not an
assertTrue, these methods do not return true or false (even though you might expect them to do this!). This means that you cannot use the
TestCasemethod that is provided by
accountExists()unless you do more than just make an assertion against the output of
accuntExists. Greg
accountExists(java.lang.String account_type, java.lang.String rank, int card_number) What exactly are we suppose to supply to the rank part of this constructor. There's no rank field in the database, the only other string value is the user name and that doesn't make a whole lot of sense so what are we suppose to put there. Also how are we suppose to unlock accounts? We really can't have atomic tests if we can't set the database back to the way it was before the test was run. Jim Clause Just an idea, but as part of the test, attempt to set the database back to its original state after the actual test itself executes Matt DeNapoli Nevermind Jim, I see what you are saying, there is no createAccount() either...ignore my first comment, and I pose the same question...as for "rank" question, may it be the id? Matt DeNapoli
Just for fun, here is a code segment that could have been used to implement the
public int accountExists(String account_type, String rank,
int card_number)
throws SQLException, RemoteException
{
/** Variable that will return the unique account ID if the account
does exist and otherwise it will return 0 if the account not found */
int exists = FALSE;
String account_name = rank + " " + account_type;
// create a select string and then execute it against the loaded DB
String qs = "SELECT account_name, card_number, id FROM Account";
Statement stmt = m_connect.createStatement();
ResultSet rs = stmt.executeQuery(qs);
// loop through the result set and see if we can find the account
while( rs.next() )
{
// we found the account in the result set and we can assign a value
if( account_name.equals( rs.getString("account_name") ) &&
card_number == rs.getInt("card_number") )
{
exists = rs.getInt("id");
}
}
// return the status of the existence now that we have traversed resultset
return exists;
}
method. Hopefully, this will clear up some of your questions about the usage of "rank." If you are confused, check the initial assignment sheet and you will notice that it is possible to have a primary checking account and a secondary checking account. Greg/net
Greg, the /net directory on Alden103 appears to be empty again
Deb Wright
If it turns out that
labtech@ultrais not mounted on a machine correctly, you cannot change that. You will need to send an email message to
alden101(I think). Alternatively, you can just use another machine. It turns out that
/netappears to have everything there. Also, if you copy all of the files into your local account, you will not need to use . Don't worry, these types of things will become more streamlined as we iron out all of the problems that are associated with our application server. Greg
Link to this Page
- Laboratory One: Simple Software Development Tools last edited on 29 August 2002 at 1:43 pm by 141.195.35.147