[jboss-svn-commits] JBL Code SVN: r5231 - in labs/jbossesb/branches/refactor/ESBCore: common/tests/src/org/jboss/soa/esb/common/tests common/tests/src/org/jboss/soa/esb/common/tests/bizclasses common/tests/src/org/jboss/soa/esb/common/tests/parameters common/tests/src/org/jboss/soa/esb/common/tests/utils services/tests services/tests/src/org/jboss/soa/esb/services/tests services/tests/src/org/jboss/soa/esb/services/tests/notification services/tests/src/org/jboss/soa/esb/services/tests/objectstore

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 21 18:20:51 EDT 2006


Author: arvinder
Date: 2006-07-21 18:20:44 -0400 (Fri, 21 Jul 2006)
New Revision: 5231

Added:
   labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/parameters/
   labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java
   labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/utils/
   labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java
   labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/notification/
   labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java
   labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/
   labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java
Modified:
   labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java
   labs/jbossesb/branches/refactor/ESBCore/services/tests/build.xml
Log:
Conversion of ESBCore/Tests to module related tests

Modified: labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java	2006-07-21 21:54:58 UTC (rev 5230)
+++ labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/bizclasses/PersonUnitTest.java	2006-07-21 22:20:44 UTC (rev 5231)
@@ -156,7 +156,7 @@
     }
 
 
-    static Person getPerson() throws Exception {
+    public static Person getPerson() throws Exception {
         Person oP = new Person((String) null);
         oP.setField(Person.ATTRIB.pfx, "Mr.");
         oP.setField(Person.ATTRIB.fmlyN, "Brum");
@@ -174,7 +174,7 @@
         return oP;
     }
 
-    static Address getAddress() throws Exception {
+    public static Address getAddress() throws Exception {
         Address oP = new Address((String) null);
         oP.setField(Address.ATTRIB.strNum, "50");
         oP.setField(Address.ATTRIB.strLine1, "Balcarce");

Added: labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java	2006-07-21 21:54:58 UTC (rev 5230)
+++ labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/parameters/ParamsRepositoryUnitTest.java	2006-07-21 22:20:44 UTC (rev 5231)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.common.tests.parameters;
+
+import javax.naming.*;
+
+import org.jboss.soa.esb.helpers.*;
+import org.jboss.soa.esb.parameters.*;
+import org.jboss.soa.esb.common.tests.BaseTest;
+
+public class ParamsRepositoryUnitTest extends BaseTest
+{
+    ParamsRepository m_oRepos;
+
+    /*
+    public ParamsRepositoryUnitTest() throws Exception
+    {
+        m_oRepos = ParamsReposUtil.reposFromFactory(null,null);
+        performTest();
+    } //________________________________
+
+    @SuppressWarnings("unused")
+    private void performTest() throws Exception
+    {
+        String sDir = "/tmp/jbossEsb/paramsDir";
+        Name oInpName = m_oRepos.nameFromString(sDir)
+            .add("FileMoverConfigExample.xml");
+
+        DomElement oElem = m_oRepos.getElement(oInpName);
+
+        Name oOutName = m_oRepos.nameFromString(sDir)
+            .add("outputTest.xml");
+        m_oRepos.storeElement(oOutName,oElem);
+
+        oElem = m_oRepos.getElement(oOutName);
+        System.out.println(oElem.toString());
+    } //________________________________
+    */
+
+    public void testNotImplementedUnitTest() {
+        log.info("*******************************************");
+        log.info("Requires Implementation");
+        log.info("*******************************************");
+    }
+
+} //____________________________________________________________________________

Added: labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java	2006-07-21 21:54:58 UTC (rev 5230)
+++ labs/jbossesb/branches/refactor/ESBCore/common/tests/src/org/jboss/soa/esb/common/tests/utils/DrainQueuesAndTopics.java	2006-07-21 22:20:44 UTC (rev 5231)
@@ -0,0 +1,92 @@
+package org.jboss.soa.esb.common.tests.utils;
+
+import javax.jms.*;
+import javax.naming.*;
+
+import org.jboss.soa.esb.helpers.*;
+
+public class DrainQueuesAndTopics
+{
+  private static final int	  MAX_TIMES_NOMSG = 10;
+  private static final String JNDI_URL	= "localhost";
+  private static final String JNDI_TYPE 
+  						= AppServerContext.SERVER_TYPE.jboss.toString();
+ 
+  private Context m_oCtx;
+  
+  public DrainQueuesAndTopics() throws Exception
+  {
+	  purgeQueueTopic("queue/A");
+	  purgeQueueTopic("queue/B");
+	  purgeQueueTopic("topic/testTopic");
+  } //__________________________________
+  
+  public int purgeQueueTopic(String p_sName) throws Exception
+  { 
+	int iRet = 0;
+	m_oCtx = AppServerContext.getServerContext(JNDI_TYPE,JNDI_URL);
+	
+	System.out.println(p_sName);
+	MessageConsumer oCns = null;
+	switch(p_sName.toLowerCase().charAt(0))
+	{	case 't' : oCns = getTopic(p_sName);	break;
+		case 'q' : oCns = getQueue(p_sName);	break;
+	}
+	if (null==oCns)
+		return 0;
+	
+	for (int iNoRcv=0; iNoRcv < MAX_TIMES_NOMSG; )
+	{	Message oMsg = oCns.receive(200);
+		if (null==oMsg)
+		{	iNoRcv++;
+			System.out.print(".");
+			continue;
+		}
+		iRet++;
+		dumpMessage(oMsg);
+		iNoRcv = 0;
+	}
+	System.out.println();
+	return iRet;
+  } //__________________________________
+  
+  void dumpMessage(Message pM)
+  {
+	  System.out.println(pM);
+  } //__________________________________
+  
+  QueueReceiver getQueue(String p_sJndi) throws Exception
+  {
+	QueueConnection oQconn = null;
+	QueueSession 	oQsess = null;
+	QueueConnectionFactory qcf = (QueueConnectionFactory) m_oCtx
+		.lookup("ConnectionFactory");
+
+	oQconn = qcf.createQueueConnection();
+	oQsess = oQconn.createQueueSession(false
+			,QueueSession.AUTO_ACKNOWLEDGE);
+    Queue oQueue
+    	= (Queue) m_oCtx.lookup(p_sJndi);
+
+    QueueReceiver oRcv = oQsess.createReceiver(oQueue);
+    oQconn.start();
+    return oRcv;
+  } //__________________________________
+
+  TopicSubscriber getTopic(String p_sJndi) throws Exception
+  {
+	TopicConnection oTconn = null;
+	TopicSession 	oTsess = null;
+	TopicConnectionFactory qcf = (TopicConnectionFactory) m_oCtx
+		.lookup("ConnectionFactory");
+
+	oTconn = qcf.createTopicConnection();
+	oTsess = oTconn.createTopicSession(false
+			,QueueSession.AUTO_ACKNOWLEDGE);
+    Topic oT = (Topic) m_oCtx.lookup(p_sJndi);
+
+    TopicSubscriber oRcv = oTsess.createSubscriber(oT);
+    oTconn.start();
+    return oRcv;
+  } //__________________________________ 
+} //____________________________________________________________________________

Modified: labs/jbossesb/branches/refactor/ESBCore/services/tests/build.xml
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/services/tests/build.xml	2006-07-21 21:54:58 UTC (rev 5230)
+++ labs/jbossesb/branches/refactor/ESBCore/services/tests/build.xml	2006-07-21 22:20:44 UTC (rev 5231)
@@ -13,10 +13,16 @@
         <equals arg1="${org.jboss.esb.frominstall}" arg2="yes"/>
     </condition>
 
+
+
+
     <path id="org.jboss.esb.tests.base.classpath">
         <fileset dir="../${org.jboss.esb.ext.lib.dir}"
                  includes="activation.jar jbossall-client.jar log4j.jar mail.jar junit.jar"/>
-        <pathelement location="${org.jboss.esb.core.bin.dir}"/>
+
+        <pathelement location="${org.jboss.esb.core.bin.dir}/common"/>
+        <pathelement location="${org.jboss.esb.core.bin.dir}/services"/>
+
     </path>
 
     <target name="org.jboss.esb.tests.init">
@@ -52,7 +58,7 @@
     <!--                             T E S T                                    -->
     <!-- ====================================================================== -->
     <target name="org.jboss.esb.services.internal.test">
-        <antcall target="org.jboss.esb.services.internal.test.unit"/>
+        <antcall target="org.jboss.esb.services.internal.test.unit"/>        
         <antcall target="org.jboss.esb.services.internal.test.functional"/>
     </target>
 

Added: labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java	2006-07-21 21:54:58 UTC (rev 5230)
+++ labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/notification/NotificationFuncTest.java	2006-07-21 22:20:44 UTC (rev 5231)
@@ -0,0 +1,215 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.services.tests.notification;
+
+import java.util.*;
+import java.text.SimpleDateFormat;
+
+import org.jboss.soa.esb.common.EsbSysProps;
+import org.jboss.soa.esb.common.tests.BaseTest;
+import org.jboss.soa.esb.helpers.*;
+import org.jboss.soa.esb.helpers.persist.SimpleDataSource;
+import org.jboss.soa.esb.notification.*;
+import org.jboss.soa.esb.services.*;
+
+// DON'T FORGET !!
+// The Rosetta Application server has to be up and running 
+//  (set JNDI_SERVER appropriately)
+//  For e-mail notification: System properties for smtp 
+//	(server, user, password, port) must be set up in app server
+
+public class NotificationFuncTest extends BaseTest
+{
+	private static 	InotificationHandler m_oH;
+
+
+    public NotificationFuncTest() {
+    }
+
+    public void testNotImplementedFuncTest() {
+        log.info("*******************************************");
+        log.info("Requires Implementation");
+        log.info("*******************************************");
+    }
+
+    /*
+     public NotificationFuncTest () throws Exception
+         { performTest(); }
+
+     static void performTest() throws Exception
+     {
+         // get a handle to your business delegate
+         m_oH = NotificationHandlerFactory.getNotifHandler
+             ("remote"
+             ,EsbSysProps.getJndiServerType()
+             ,EsbSysProps.getJndiServerURL()
+             );
+
+         DomElement oEl = new DomElement("MyFileList");
+         oEl.setAttr(NotificationList.TYPE,"OK");
+		
+ //		oEl.addElemChild(fileListTarget());
+ //		oEl.addElemChild(emailTarget());
+ //		oEl.addElemChild(jmsQueueTarget());
+ //		oEl.addElemChild(jmsTopicTarget());
+         oEl.addElemChild(sqlTableTarget());
+		
+         NotificationList oNL = new NotificationList(oEl);
+		
+         // to see how the XML looks like
+         // this is just a unit test class
+         // Typically the XML is used in a parameter object (DomElement.fromXml())
+         System.out.println(oNL.toString());
+
+         // a simple timestamped message
+         Date oNow = new Date(System.currentTimeMillis());
+         SimpleDateFormat oStamp = new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss.SSS");
+         StringBuilder sb = new StringBuilder(oStamp.format(oNow))
+             .append(" This message from Notification test");
+		
+         m_oH.sendNotifications(oNL,sb.toString());
+     } //________________________________
+	
+     static DomElement emailTarget() throws Exception
+     {
+         DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
+         oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyEmail");
+         oTgt.setAttr(EsbEmail.FROM,"sender at jboss.com");
+         oTgt.setAttr(EsbEmail.SENDTO,"receiver1 at hotmail.com,receiver2 at jboss.com");;
+         oTgt.setAttr(EsbEmail.SUBJECT,"TEST from Rosetta");
+         oTgt.setAttr(EsbEmail.MESSAGE,"This is the text of your message");
+		
+         // This class does NOT send the e-mails, the app server does
+         // consequently these paths would have to be accessible in the
+         // application server (filesystem / mounts)
+         String[] sa = {"/tmp/tomcat.sh","/tmp/program.js"};
+         for (String sCurr : sa)
+             oTgt.addTextChild(EsbEmail.ATTACH,sCurr);
+
+         return oTgt;
+     } //________________________________
+
+     static DomElement fileListTarget() throws Exception
+     {
+         DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
+         oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyFiles");
+
+         // This class does NOT write the files, the app server does
+         // consequently these paths would have to be accessible in the
+         // application server (filesystem / mounts)
+         String[] sa = {"file:///tmp/file1.notif","file:///tmp/file2.notif"};
+         for (String sCurr : sa)
+         {	DomElement oFile = new DomElement(NotifyFiles.CHILD_FILE);
+             oFile.setAttr(NotifyFiles.ATT_URI,sCurr);
+             oFile.setAttr(NotifyFiles.ATT_APPEND,Boolean.toString(true));
+             oTgt.addElemChild(oFile);
+         }
+         return oTgt;
+     } //________________________________
+
+     static DomElement jmsQueueTarget() throws Exception
+     {
+         DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
+         oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyQueues");
+
+         String[] sa = {"queue/A","queue/B"};
+         for (String sCurr : sa)
+         {	DomElement oQ = new DomElement(NotifyQueues.CHILD_QUEUE);
+             oQ.setAttr(NotifyJMS.ATT_DEST_NAME,sCurr);
+             for (DomElement oProp : getMessageProperties())
+                 oQ.addElemChild(oProp);
+             oTgt.addElemChild(oQ);
+         }
+         return oTgt;
+     } //________________________________
+
+     static DomElement jmsTopicTarget() throws Exception
+     {
+         DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
+         oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifyTopics");
+
+         String[] sa = {"topic/testTopic"};
+         for (String sCurr : sa)
+         {	DomElement oQ = new DomElement(NotifyTopics.CHILD_TOPIC);
+             oQ.setAttr(NotifyJMS.ATT_DEST_NAME,sCurr);
+             for (DomElement oProp : getMessageProperties())
+                 oQ.addElemChild(oProp);
+             oTgt.addElemChild(oQ);
+         }
+         return oTgt;
+     } //________________________________
+
+     static DomElement[] getMessageProperties() throws Exception
+     {
+         KeyValuePair[] oaProps = new KeyValuePair[]
+         {new KeyValuePair("prop1","111")
+         ,new KeyValuePair("prop2","bbb")
+         ,new KeyValuePair("prop3","abc123")
+         };
+         DomElement[] oaRet = new DomElement[oaProps.length];
+         int iCurr = 0;
+         for (KeyValuePair oCurr : oaProps)
+         {	DomElement oElem = new DomElement(NotifyJMS.CHILD_MSG_PROP);
+             oElem.setAttr(NotifyJMS.ATT_PROP_NAME,oCurr.getKey());
+             oElem.setAttr(NotifyJMS.ATT_PROP_VALUE,oCurr.getValue());
+             oaRet[iCurr++] = oElem;
+         }
+         return oaRet;
+     } //________________________________
+
+     static DomElement sqlTableTarget() throws Exception
+     {
+         DomElement oTgt = new DomElement(NotificationList.CHILD_TGT);
+         oTgt.setAttr(NotificationTarget.PRM_NOTIF_CLASS,"NotifySqlTable");
+
+         oTgt.setAttr(SimpleDataSource.DRIVER,"org.postgresql.Driver");
+         oTgt.setAttr(SimpleDataSource.URL,"jdbc:postgresql://lavasca:5432/rosetta");
+         oTgt.setAttr(SimpleDataSource.USER,"postgres");
+         oTgt.setAttr(SimpleDataSource.PASSWORD,"");
+		
+         // Table name for insert - must exist in database (URL)
+         oTgt.setAttr(NotifySqlTable.ATT_TABLE,"test_notif_table");
+         // Column that will contain the dynamic data generated by the ActionClass
+         // must exist in table (ATT_TABLE above)
+         oTgt.setAttr(NotifySqlTable.ATT_DATA,"msg");
+		
+         // constant data that can be also added in the insert
+         // (perhaps needed for queries)
+         // Key = column name (it must exist in the table, same as ATT_DATA column)
+         KeyValuePair[] oaCols = new KeyValuePair[]
+           {new KeyValuePair("src","TestNotification")
+           ,new KeyValuePair("ref","any Ref")
+           ,new KeyValuePair("val1","VVVV 11111")
+           };
+         for (KeyValuePair oCurr : oaCols)
+         {	DomElement oElem = new DomElement(NotifySqlTable.CHILD_COLUMN);
+             oElem.setAttr(NotifySqlTable.ATT_NAME,oCurr.getKey());
+             oElem.setAttr(NotifySqlTable.ATT_VALUE,oCurr.getValue());
+             oTgt.addElemChild(oElem);
+         }
+		
+		
+         return oTgt;
+     } //________________________________
+
+     */
+} //____________________________________________________________________________

Added: labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java
===================================================================
--- labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java	2006-07-21 21:54:58 UTC (rev 5230)
+++ labs/jbossesb/branches/refactor/ESBCore/services/tests/src/org/jboss/soa/esb/services/tests/objectstore/ObjectStoreFuncTest.java	2006-07-21 22:20:44 UTC (rev 5231)
@@ -0,0 +1,97 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.soa.esb.services.tests.objectstore;
+
+import org.jboss.soa.esb.common.EsbSysProps;
+import org.jboss.soa.esb.common.tests.bizclasses.PersonUnitTest;
+import org.jboss.soa.esb.common.tests.BaseTest;
+import org.jboss.soa.esb.common.bizclasses.*;
+import org.jboss.soa.esb.services.*;
+
+// DON'T FORGET !!
+// The Rosetta Application server has to be up and running 
+//  (set JNDI_SERVER appropriately)
+
+public class ObjectStoreFuncTest extends BaseTest
+{
+	private static 	IpersistHandler m_oH;
+
+    public ObjectStoreFuncTest() {
+    }
+
+     public void testNotImplementedFuncTest() {
+        log.info("*******************************************");
+        log.info("Requires Implementation");
+        log.info("*******************************************");
+    }
+
+    /*
+     public ObjectStoreFuncTest () throws Exception
+         { performTest(); }
+
+     static void performTest() throws Exception
+     {
+         // get a handle to your business delegate
+         m_oH = PersistHandlerFactory.getPersistHandler
+                 ("remote"
+                 ,EsbSysProps.getJndiServerType()
+                 ,EsbSysProps.getJndiServerURL()
+                 );
+
+         // request UID chunks for your own use
+ //		int[] ia = {10,20,30};
+ //		for (int iCurr : ia)
+ //			System.out.println
+ //				("Requesting "+iCurr+" uids "
+ //				+" - First UID returned = " +m_oH.getUidChunk(iCurr)
+ //				);
+
+         storeAndRetrievePerson();
+     } //________________________________
+	
+     static void storeAndRetrievePerson() throws Exception
+     {
+         // set up a Person (see TestPersonAddrPhone.class)
+         Person oPrs = PersonUnitTest.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
+
+     } //________________________________
+     */
+} //____________________________________________________________________________




More information about the jboss-svn-commits mailing list