Advertisement
Guest User

Untitled

a guest
Jan 29th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. public class MyDaoTest extends DatabaseTestCase
  2. {
  3. private XmlDataSet loadedDataSet;
  4.  
  5. MyDao dao;
  6.  
  7. protected void setUp() throws Exception
  8. {
  9. dao = new CourierUploadQueueMilestonedDaoImpl();
  10. super.setUp();
  11. }
  12.  
  13. @Override
  14. protected IDatabaseConnection getConnection() throws Exception
  15. {
  16. Class driverClass = Class.forName("com.mysql.jdbc.Driver");
  17. Connection jdbcConnection = DriverManager.getConnection("jdbc:mysql://localhost/test", "root", "root");
  18. return new DatabaseConnection(jdbcConnection);
  19. }
  20.  
  21. @Override
  22. protected IDataSet getDataSet() throws Exception
  23. {
  24. FileInputStream in = new FileInputStream("dataset.xml");
  25. loadedDataSet = new XmlDataSet(in);
  26. return loadedDataSet;
  27. }
  28.  
  29. protected DatabaseOperation getSetUpOperation() throws Exception
  30. {
  31. return DatabaseOperation.CLEAN_INSERT;
  32. }
  33.  
  34. protected DatabaseOperation getTearDownOperation() throws Exception
  35. {
  36. return DatabaseOperation.NONE;
  37. }
  38.  
  39. public void testCheckLoginDataLoaded() throws Exception
  40. {
  41. assertNotNull(loadedDataSet);
  42. int rowCount = loadedDataSet.getTable("person").getRowCount();
  43. assertEquals(2, rowCount);
  44. }
  45. }
  46.  
  47. <?xml version='1.0' encoding='UTF-8'?>
  48. <dataset>
  49. <person id="25" name'"Saurabh" phone="61458972564"/>
  50. <person id="21" name'"Saurabh" phone="61458972564"/>
  51. </dataset>
  52.  
  53. Method threw 'org.springframework.beans.factory.BeanDefinitionStoreException' exception.
  54. Unexpected exception parsing XML document from class path resource [applicationContext.xml]
  55. detailMessage : org/springframework/core/type/AnnotatedTypeMetadata
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement