Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
Articles_pt
LeftMenu




JSPWiki v2.2.33

[RSS]


Hide Menu

CreateDAO_es


Difference between version 19 and version 18:

At line 205 changed 1 line.
The code you see above is what we need for a basic JUnit test that initializes and destroys our PersonDao. The "ctx" object is a reference to Spring's ApplicationContext, which is initialized in a static block of the [BaseDaoTestCase's|http://raibledesigns.com/downloads/appfuse/api/org/appfuse/dao/BaseDaoTestCase.java.html] class.
El c&oacutedigo anterior es lo que Ud. necesita para realizar una prueba unitaria b&aacutesica que inicialize y destruya nuestro PersonDao. El objeto "ctx" es una referencia al objeto Application Context de Spring, el cual es inicializado en un bloque est&aacutetico de la clase [BaseDaoTestCase's|http://raibledesigns.com/downloads/appfuse/api/org/appfuse/dao/BaseDaoTestCase.java.html] .
At line 207 changed 1 line.
Now we need to actually test that the CRUD (create, retrieve, update, delete) methods work in our DAO. To do this we created methods that begin with "test" (all lower case). As long as these methods are public, have a void return type and take no arguments, they will be called by our <junit> task in our Ant build.xml file. Here's some simple tests for testing CRUD. An important thing to remember is that each method (also known as a test), should be autonomous. Add the following methods to your PersonDaoTest.java file:
Ahora necesitamos probar que las operaciones CRUD (create, retrieve, update, delete) methods funcionan en nuestro DAO. Para ello, crearemos metodos que empiecen con el vocablo "test" (en min&uacutesculas). Estos m&eacutetodos al ser p&uacuteblicos,retornan void y no aceptan par&aacutemetros de entrada, ser&aacuten ejecutados por la tarea <junit> que se encuentra en el fichero build.xml de Ant .
At line 209 added 3 lines.
Aca le mostramos algunas pruebas sencillas para probar las operaciones CRUD. Lo importante a recordad es que cada m&eacutetodo debe ser aut&oacutenomo. Anada los siguientes metodos a la clase
PersonDaoTest.java:
At line 273 changed 1 line.
;:%%(color: blue)''This way, you can eliminate the "create new" functionality in the testGetPerson method. If you'd rather add this record directly into the database (via SQL or a GUI), you can rebuild your sample-data.xml file using "ant db-export" and then "cp db-export.xml metadata/sql/sample-data.xml".''%%
;:%%(color: blue)''De esta manera,puedes eliminar la funcionalidad "create new" en el m&eacutetodo testGetPerson. Si prefiere anadir este record directamente a la base de datos , (via SQL o una intefaz GUI), you can rebuild your sample-data.xml file using "ant db-export" and then "cp db-export.xml metadata/sql/sample-data.xml".''%%

Back to CreateDAO_es, or to the Page History.