Thursday, October 30, 2008
Debugging DBUnit
Today was more debugging of DBUnit bugs that was still plaguing our test cases. At first we thought the problem was that Hibernate was not creating the DB schema before DBUnit could load the database. So we tried opening/creating a session in the constructor of the testcase before dbunit loaded the sample.xml file into the HSQLDB. This, still produced errors about tables not being found. Eventually, after many attempts on changing the configuration of both Hibernate and DBUnit, we realized that DBUnit did not recognize it's own XML file it created from its Maven2 plugin incarnation. This makes utterly no sense and was unfathomable as to why it would create incompatible formats of XML files for backup. This seemed to be the root of the problem, even though the hunch of having to open a Hibernate session in the TestCase's constructor was still correct since DBUnit does not store the table's schema inside it's XML backups. Since the backup from the Maven2 dbunit plugin no longer worked, we had to first re-import the sample dataset into the server using the maven dbunit plugin, write a function (it's in a Main class right now) to export the database programmatically using the dbunit JAR (and its myriad of dependencies). Now that the JUnit tests work, we plan to encapsulate the quirks of the JUnit into its own subclass so we don't have to write boiler plate cold for each test file. Our test cases can use dbunit functions to compare the manipulated DB and the resulting DB as well as all the standard JUnit asserts.
Web Service Updates
Okay, today on the web services front we got the XSD (XML Schema) file written that defines the schema for public art objects in XML. We also finished working on the WSDL (although it will be expanded as we fill in the web service later). We have a NetBeans project up and running with our service and are looking into running some tests to make sure everything is working as it is supposed to. We are using a NetBeans plugin for SoapUI to allow for testing of the service. Namespaces in the XML have been a confusing issue but I think we got everything worked out today.
Wednesday, October 29, 2008
More on DBunit
We have only been trying to get dbunit to work as for backing up and restoring the database. This was done using the Maven2 plugin. However, when there is a need for having a sample dataset loaded every single time a test runs (e.g. during setUp() for JUnit) it isn't practical. This is because a Maven2 plugin can only be attached to a certain phase of the Maven2 build lifecycle, meaning the sample dataset would only load once at the beginning of all tests. So in order to have the sample dataset load for each test, we added the dbunit 2.3.0 as a dependency in Maven2 and use its original implementation. It has it's own DBTestCase class instead of the JUnit testcase, which is, we believe, just a subclass of the JUnit TestCase class anyway. It can also be used in a regular JUnit TestCase class as well, the initialization of some DBUnit specific variables just have to be done manually. This changes what we have been previously done for tests, which is simply programmatically inserting values through Hibernate, then running tests on the few tests we did. Now, we have 150 rows of sample data from the Public Art application as our test data. There are still some issues, but should be resolved summarily as we understand more about DBUnit.
More work with Web Services
Today we were given access to the university and have been able to spend a couple of hours working there so far.
One thing that we worked on was setting up our web service. We have been researching SOAP and WSDL files (This article has been helpful for understanding WSDL). We have started working on our WSDL file and defining how our objects are going to be represented in XML schema. We've got part of the WSDL written, but it will need to be expanded as we actually start integrating our Framework into the Web Service. We also set up a web project in NetBeans that we are going to develop our Web Service in.
One thing that we worked on was setting up our web service. We have been researching SOAP and WSDL files (This article has been helpful for understanding WSDL). We have started working on our WSDL file and defining how our objects are going to be represented in XML schema. We've got part of the WSDL written, but it will need to be expanded as we actually start integrating our Framework into the Web Service. We also set up a web project in NetBeans that we are going to develop our Web Service in.
Tuesday, October 28, 2008
Daily Entry for Tuesday, October 28th (DB & CODE)
Today, we found out how to do the unit testing in another scope, without altering the real data in on the server. First, we realized that in Maven2, the test source folder has it's own resource folder. We copied and changed values of the original hibernate.cfg.xml from MYSQL dialect to the HSQLDB dialect. This way the test can be run offline, without a test server.
As for the dbunit plugin, we can now run database backup and restoration through a maven command since the configuration data has been added to the POM.xml.
As for the dbunit plugin, we can now run database backup and restoration through a maven command since the configuration data has been added to the POM.xml.
- To Backup: type "dbunit:export"
- To Restore: type "dbunit:operation"
Researching Web Services
One of the things we did today was look into web services that we could use on top of our framework. We looked at using a RESTful web service first, but it after evaluating it, we realized that it is not as good of a solution as SOAP for what we are trying to do. We found an example for setting up a SOAP project in NetBeans and are looking more into how to write a WSDL file for our service. We also are most likely going to send the object data via XML.
After going through that tutorial, I was able to get the Web Service set up, but we still need to make our own bare-bones WSDL file and start integrating it with our framework as that gets more fleshed out.
After going through that tutorial, I was able to get the Web Service set up, but we still need to make our own bare-bones WSDL file and start integrating it with our framework as that gets more fleshed out.
Monday, October 27, 2008
Daily Entry for Monday, October 27th
Today, we started by adding values to all of our tracker tasks. We also split up and refined the tasks some more. We also met with Prof. Carrera today to talk about our iteration plans. We set up a meeting for tomorrow and also talked about the internet situation. Prof. Carrera said that the University is in the process of giving us access and with any luck we should have it tomorrow. In the meantime, we were given a key so that we can use the VPC at night.
So tonight we are in the VPC. We are working on using DBUnit so that we can export our database to XML and keep a copy (this XML will also be used when running JUnit tests). After, we will import the correct data into both tables and keep a copy with our project. We are also researching how to create a web service so that we can begin doing that in the near future. We are also trying to get access to the digital pictures that go along with the public art data.
So tonight we are in the VPC. We are working on using DBUnit so that we can export our database to XML and keep a copy (this XML will also be used when running JUnit tests). After, we will import the correct data into both tables and keep a copy with our project. We are also researching how to create a web service so that we can begin doing that in the near future. We are also trying to get access to the digital pictures that go along with the public art data.
Subscribe to:
Posts (Atom)