From: <jbo...@li...> - 2006-06-27 12:57:37
|
Author: estebanschifman Date: 2006-06-27 08:57:33 -0400 (Tue, 27 Jun 2006) New Revision: 4838 Modified: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java Log: Minor details to help users understand how to set up their own test classes Modified: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java =================================================================== --- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java 2006-06-27 12:34:51 UTC (rev 4837) +++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/Controller.java 2006-06-27 12:57:33 UTC (rev 4838) @@ -32,6 +32,9 @@ private Controller() throws Exception { + // build this Class[] with the list of classes you wish to test + // Tested classes should have a public constructor with no arguments + Class[] oaTest = { TestParamsRepository.class Modified: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java =================================================================== --- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java 2006-06-27 12:34:51 UTC (rev 4837) +++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestObjStore.java 2006-06-27 12:57:33 UTC (rev 4838) @@ -24,7 +24,9 @@ import org.jboss.soa.esb.common.bizclasses.*; import org.jboss.soa.esb.services.*; -// The Rosetta Persistence handler has to be up and running +// DON'T FORGET !! +// The Rosetta Application server has to be up and running +// (set JNDI_SERVER appropriately) public class TestObjStore { @@ -36,7 +38,10 @@ static void performTest() throws Exception { + // get a handle to your business delegate m_oH = PersistHandlerFactory.getPersistHandler("remote",JNDI_SERVER); + + // request UID chunks for your own use int[] ia = {10,20,30}; for (int iCurr : ia) System.out.println @@ -49,14 +54,27 @@ static void storeAndRetrievePerson() throws Exception { + // set up a Person (see TestPersonAddrPhone.class) Person oPrs = TestPersonAddrPhone.getPerson(); + // timestamp, uid and snap Uid are added just to make it easier + // to compare output text oPrs.setStamp(System.currentTimeMillis()); long lUid = m_oH.addObject(oPrs); oPrs.setUid(lUid); oPrs.setSnap(lUid); + + // retrieve it from the Object Store Person oP2 = (Person)m_oH.getObject(Person.class,lUid); + + // output in XML format both objects, and compare + // timestamps will differ slightly because first object + // has a dummy timestamp (just before "store" request) System.out.println(oPrs.toDTO().toXml()); System.out.println(oP2.toDTO().toXml()); + + // if you used the "ObjStoreExample.xml" that comes with the + // standard example, you'll be able to see your objects + // in the "object_snap" and "people_index" tables } //________________________________ } //____________________________________________________________________________ Modified: labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java =================================================================== --- labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java 2006-06-27 12:34:51 UTC (rev 4837) +++ labs/jbossesb/trunk/ESBCore/Tests/src/org/jboss/soa/esb/tests/TestPersonAddrPhone.java 2006-06-27 12:57:33 UTC (rev 4838) @@ -55,11 +55,11 @@ oP.addAddress(getAddress()); - oP.addEmail(OneValue.getStringValue("dbr...@gm...","home")); - oP.addEmail(OneValue.getStringValue("dan...@jb...","work")); + oP.addEmail(OneValue.getStringValue("my...@gm...","home")); + oP.addEmail(OneValue.getStringValue("joh...@jb...","work")); - oP.addPhone(newPhone("basement","1","416","322-5832",null)); - oP.addPhone(newPhone("cell",null,"416","561-2151",null)); + oP.addPhone(newPhone("basement","1","416","555-1212",null)); + oP.addPhone(newPhone("cell",null,"416","666-4444",null)); return oP; } //________________________________ @@ -67,15 +67,15 @@ static Address getAddress() throws Exception { Address oP = new Address((String)null); - oP.setField(Address.ATTRIB.strNum,"2155"); - oP.setField(Address.ATTRIB.strLine1,"Tres de Febrero"); + oP.setField(Address.ATTRIB.strNum,"50"); + oP.setField(Address.ATTRIB.strLine1,"Balcarce"); oP.setField(Address.ATTRIB.twnCty1,"San Isidro"); oP.setField(Address.ATTRIB.postalZip,"1642"); oP.setField(Address.ATTRIB.provSt,"Buenos Aires"); oP.setField(Address.ATTRIB.cntry,"Argentina"); - oP.addPhone(newPhone("torIP",null,"416","628-1403",null)); - oP.addPhone(newPhone("home","54","11","4723-4085","7")); + oP.addPhone(newPhone("torIP",null,"416","555-1212",null)); + oP.addPhone(newPhone("home","54","11","4555-1111","7")); return oP; } //________________________________ |