The DAO tests show that it is working. My Struts action pretty much is
identical to my DAO test but it returns an empty list. The other method
which returns a list works fine so I figured (maybe incorrectly) that I
needed to register my new method somewhere. I haven't spent much with
appfuse but it sure has saved me a ton of time! I get to spend more time
on the GUI while not worrying about how to connect everything. This is
the first method I added to all the generated classes so I could just be
missing the boat somewhere.
package org.midwestreliability.dao;
import java.util.List;
import org.midwestreliability.model.UploadedData;
import org.midwestreliability.model.User;
public class UploadedDataDAOTest extends BaseDaoTestCase {
private UploadedDataDao dao = null;
public void setUploadedDataDao(UploadedDataDao dao){
this.dao = dao;
}
public void testGetUploadedData() throws Exception {
UploadedData data = dao.getUploadedData(1);
assertNotNull(data);
assertEquals("MRO", data.getRegion());
}
public void testGetUploadedDataList() throws Exception {
UploadedData uploadedData = null;
List datas = dao.getUploadedDatas(uploadedData);
assertNotNull(datas);
assertEquals(2,datas.size());
}
public void testGetUploadedDataListByRegion() throws Exception
{
String region = "MRO";
List datas = dao.getUploadedDatasByRegion(region);
assertNotNull(datas);
assertEquals(1,datas.size());
}
public void testAddUpdateRemoveUploadedData() throws Exception
{
UploadedData uploadedData = null;
UploadedData data = new UploadedData();
data.setEntity("TESTENTITYNAME");
data.setRegion("MRO");
List datas = dao.getUploadedDatas(uploadedData);
assertNotNull(datas);
assertEquals(2,datas.size());
dao.saveUploadedData(data);
datas = dao.getUploadedDatas(uploadedData);
assertNotNull(datas);
assertEquals(3,datas.size());
UploadedData popData =
(UploadedData)dao.getUploadedDatas(uploadedData).get(2);
assertEquals("TESTENTITYNAME",popData.getEntity());
dao.removeUploadedData(popData.getId());
datas = dao.getUploadedDatas(uploadedData);
assertNotNull(datas);
assertEquals(2,datas.size());
}
}
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt
Raible
Sent: Wednesday, February 21, 2007 9:42 AM
To: [email protected]
Subject: Re: [appfuse-user] RE: Did I miss a Spring Config??
Do you have a DAO test that proves things aren't working as expected?
Matt
On 2/21/07, sionsmith <[EMAIL PROTECTED]> wrote:
>
> can you post your config mate?
>
> Clark D. Liu wrote:
> >
> > More info - I'm using appfuse 1.9.4 and used appgen to generate the
> > classes.
> >
> >
> >
> > ________________________________
> >
> > From: Clark D. Liu [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, February 21, 2007 3:59 AM
> > To: [email protected]
> > Subject: [appfuse-user] Did I miss a Spring Config??
> >
> >
> >
> > I added a new method to my DAO that uses a where clause as
follows...
> >
> > public List getUploadedDatasByRegion(String region) {
> >
> > return getHibernateTemplate().find("from UploadedData
where
> > region=?",region);
> >
> >
> >
> > Hibernate returns two rows but the action shows null...
> >
> > UploadedDataManager mgr =
> > (UploadedDataManager)getBean("uploadedDataManager");
> >
> > List datas = mgr.getUploadedDatas(uploadedData);
> >
> >
> >
> > ... so I am guessing I don't have Spring setup correctly? All other
CRUD
> > operation work though! Any help would be greatly appreciated!!
> >
> >
> >
> > Clark
> >
> >
> >
> >
> >
>
> --
> View this message in context:
http://www.nabble.com/Did-I-miss-a-Spring-Config---tf3265741s2369.html#a
9083057
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
http://raibledesigns.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]