Added: 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/BPELTimerTests.java
URL: 
http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/BPELTimerTests.java?rev=381686&view=auto
==============================================================================
--- 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/BPELTimerTests.java 
(added)
+++ 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/BPELTimerTests.java 
Tue Feb 28 08:02:48 2006
@@ -0,0 +1,101 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jan 26, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sybase.bpe.test;
+
+
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BPELTimerTests extends BPELTester {
+       
+
+
+       /**
+        * Constructor for BPELTests.
+        * @param arg0
+        */
+       public BPELTimerTests(String arg0) {
+               super(arg0);
+       }
+       
+       
+       public void testTimer1() throws Exception {
+               bpelFile = "testTimer1/bpelTestTimer1.jar";
+               threadNumber=1;
+               msgFiles = new String [] 
{"testTimer1/timer1Data.txt","testTimer1/timer1Data.txt"};
+               expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: PT3SPT7S\n";
+               assertTrue(go(30000, null));
+       }
+       
+       public void testTimer2() throws Exception {
+               bpelFile = "testTimer2/bpelTestTimer2.jar";
+               threadNumber=1;
+               msgFiles = new String [] 
{"testTimer2/timer2Data.txt","testTimer2/timer2Data.txt"};
+               expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: TESTPT7S\n";
+               assertTrue(go(20000, null));
+       }
+       
+       public void testTimer3() throws Exception {
+               bpelFile = "testTimer3/bpelTestTimer3.jar";
+               threadNumber=1;
+               msgFiles = new String [] {"testTimer3/timer3Data.txt"};
+               expectedResponse =
+"Fault Message:null\n";
+               assertTrue(go(1000, null));
+       }
+       
+       
+       public void testTimerOnAlarmAtRootScope() throws Exception {
+               bpelFile = 
"testTimerOnAlarmAtRootScope/bpelTestTimerOnAlarmAtRootScope.jar";
+               threadNumber=1;
+               msgFiles = new String [] 
{"testTimerOnAlarmAtRootScope/timer1Data.txt","testTimerOnAlarmAtRootScope/timer1Data.txt"};
+               expectedResponse =
+"Fault Message:null\n"+
+"Fault Message:null\n"+
+"Part \"replyText\" value: PT3SPT7S\n";
+               assertTrue(go(30000, null));
+       }
+       
+       /* (non-Javadoc)
+        * @see junit.framework.TestCase#setUp()
+        */
+       protected void setUp() throws Exception {
+               super.setUp();
+               getSystemProps();
+       }
+}

Added: 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/CleanUpThread.java
URL: 
http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/CleanUpThread.java?rev=381686&view=auto
==============================================================================
--- 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/CleanUpThread.java 
(added)
+++ 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/CleanUpThread.java 
Tue Feb 28 08:02:48 2006
@@ -0,0 +1,67 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Mar 1, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sybase.bpe.test;
+
+//import java.util.logging.Logger;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class CleanUpThread extends Thread {
+       
+       private boolean stop;
+//     private static Logger logger = 
+//             Logger.getLogger(CleanUpThread.class.getName());
+       private long interval;
+       
+       public CleanUpThread (long interval) {
+               this.interval = interval;
+       }
+
+       /* (non-Javadoc)
+        * @see java.lang.Runnable#run()
+        */
+       public void run() {
+               while (!stop) {
+                               // no op right now
+                       try {
+                               Thread.sleep(interval);
+                       } catch (InterruptedException e) {
+                       }
+               }
+       }
+       
+       public void stopCleanUp() {
+               stop = true;
+               this.interrupt();
+       }
+
+}

Added: 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/LocalInvokeDeadLockTest.java
URL: 
http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/LocalInvokeDeadLockTest.java?rev=381686&view=auto
==============================================================================
--- 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/LocalInvokeDeadLockTest.java
 (added)
+++ 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/LocalInvokeDeadLockTest.java
 Tue Feb 28 08:02:48 2006
@@ -0,0 +1,69 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Nov 9, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.bpe.test;
+
+import com.sybase.bpe.performance.BPEClientThread;
+import com.sybase.bpe.performance.ThreadCounter;
+
+public class LocalInvokeDeadLockTest extends BPELTester {
+
+       public LocalInvokeDeadLockTest(String arg0) {
+               super(arg0);
+               // TODO Auto-generated constructor stub
+       }
+       
+       public void testLocalInvokeDeadLock() throws Exception {
+
+               getSystemProps();
+               mySetup();
+               
+               ThreadCounter tcw = new ThreadCounter(threadNumber);
+               for (int i = 0; i < threadNumber; i++) {
+                       // split up the messages
+                       int threadNumMessages =  numMessages/threadNumber;
+                       if ( i == 0) {
+                               threadNumMessages += numMessages%threadNumber;
+                       }
+                       // create and start a thread
+                       BPEClientThread bpect = 
+                               new 
BPEClientThread(eventDirectors[i],threadNumMessages,msgs,
+                               tcw,uniquePart,partNames, new String[]{
+                                               "Fault Message:null\n"+
+                                               "Part \"newParameter2\" value: 
test\n",
+                                               "Fault Message:null\n"+
+                                               "Part \"newParameter2\" value: 
test\n"});
+                       bpect.start();
+               }
+               
+               tcw.waitForThreadsToFinish();
+                                       
+               assertFalse(tcw.isFaulted());
+
+       }
+
+}

Added: 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializableCompatibility.java
URL: 
http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializableCompatibility.java?rev=381686&view=auto
==============================================================================
--- 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializableCompatibility.java
 (added)
+++ 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializableCompatibility.java
 Tue Feb 28 08:02:48 2006
@@ -0,0 +1,39 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+
+package com.sybase.bpe.test;
+
+import junit.framework.TestCase;
+
+
+public class SerializableCompatibility extends TestCase {
+       
+       public void testCompatability( ) throws Exception {
+               
+               String newJar = System.getProperty("COMPAT_NEW_JAR");
+               String oldJar = System.getProperty("COMPAT_OLD_JAR");
+               
+               String[] args = new String[]{newJar,oldJar};
+               assertTrue(
+                               SerializableCompatibilityTester.check(args));
+       }
+}

Added: 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializableCompatibilityTester.java
URL: 
http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializableCompatibilityTester.java?rev=381686&view=auto
==============================================================================
--- 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializableCompatibilityTester.java
 (added)
+++ 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializableCompatibilityTester.java
 Tue Feb 28 08:02:48 2006
@@ -0,0 +1,165 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Oct 4, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.bpe.test;
+
+import java.io.File;
+import java.io.ObjectStreamClass;
+import java.io.Serializable;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class SerializableCompatibilityTester {
+
+       public static void main(String[] args) throws Exception {
+               if ( SerializableCompatibilityTester.check(args) ) {
+                       System.out.println("Serialization compatible.");
+               } else {
+                       System.err.println("Serialization not compatible.");
+               }
+       }
+       
+       public static boolean check(String[] args) throws Exception {
+               
+               boolean ok = true;
+               int files = 0;
+               
+               File newJar = new File(args[0]);
+               JarFile jar = new JarFile(newJar);
+               ClassLoader newJarCL = new URLClassLoader(new 
URL[]{newJar.toURL()});
+               
+               File oldJar = new File(args[1]);
+               ClassLoader oldJarCL = new URLClassLoader(new 
URL[]{oldJar.toURL()});
+               
+               ArrayList clazzes = new ArrayList();
+               Enumeration enumeration = jar.entries();
+               while ( enumeration.hasMoreElements() ) {
+                       JarEntry je = (JarEntry)enumeration.nextElement();
+
+                       if ( je.getName().endsWith(".class")) {
+                               
+                               // EAS cant handle extra member vars in 
+                               // primary key classes, this class can't
+                               // have a servialVersionUID
+                               if ( ! 
je.getName().endsWith("RegistrationEntityPK.class")) {
+                                       clazzes.add(je.getName().
+                                                       
substring(0,je.getName().indexOf('.')).
+                                                       replace('/','.'));
+                               }
+                       }
+               }
+                       
+//             ArrayList serClazzes = new ArrayList();
+
+               for (Iterator iter = clazzes.iterator(); iter.hasNext();) {
+                       
+                       String element = (String) iter.next();
+                       
+                       Class newClazz = newJarCL.loadClass(element);
+
+                       if ( Serializable.class.isAssignableFrom(newClazz) ) {
+                               
+                               StringBuffer sb = new StringBuffer();
+
+                               Class oldClazz = null;
+                               try {
+                                       oldClazz = oldJarCL.loadClass(element);
+                               } catch (ClassNotFoundException e)  {
+                               
+                               }
+                               
+                               try {
+                                       
newClazz.getDeclaredField("serialVersionUID");
+                               } catch ( NoSuchFieldException e ) {
+                                       sb.append(element + " doesn't define a 
serialVersionUID.");
+                                       sb.append("\n");
+                                       files++;
+                                       ok = false;
+                                       if ( oldClazz != null ) {
+                                               
sb.append(getSVUIDline(getSVUID(oldClazz)));
+                                               sb.append("\n");
+                                       } else {
+                                               sb.append(getSVUIDline(1));
+                                               sb.append("\n");
+                                       }
+                                       print(sb);
+                                       continue;
+                               }
+
+                               if ( oldClazz != null ) {
+
+                                       if ( getSVUID(newClazz) != 
getSVUID(oldClazz) ) {
+                                               files++;
+                                               ok = false;
+                                               
+                                               sb.append(element + " is not 
compatible with old version.");
+                                               sb.append("\n");
+                                               
sb.append(getSVUIDline(getSVUID(oldClazz)));
+                                               sb.append("\n");
+                                       }
+                               }
+                               
+                               if ( ! sb.toString().equals("")) {
+                                       print(sb);
+                               }
+                               
+                       }
+
+               }
+
+               if ( !ok )      System.out.println("Files to change:"+files);
+
+               return ok;
+               
+       }
+       
+       static void print(StringBuffer sb) {
+               System.err.println(sb.toString());
+               System.err.println();
+       }
+       
+       static String getSVUIDline(long id) {
+               return "Add to class:\tstatic final long serialVersionUID = "
+               + String.valueOf(id) + "L;";
+       }
+       
+       static long getSVUID(Class clazz) {
+               ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
+               return osc.getSerialVersionUID();
+       }
+}

Added: 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializeTester.java
URL: 
http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializeTester.java?rev=381686&view=auto
==============================================================================
--- 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializeTester.java
 (added)
+++ 
incubator/ode/scratch/bpe/src/test/java/com/sybase/bpe/test/SerializeTester.java
 Tue Feb 28 08:02:48 2006
@@ -0,0 +1,128 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Aug 28, 2003
+ *
+ */
+package com.sybase.bpe.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+//import java.util.Collection;
+import java.util.Properties;
+
+import com.sybase.bpe.bped.DeployTypeEnum;
+import com.sybase.bpe.bped.EventDirector;
+import com.sybase.bpe.bped.EventDirectorFactory;
+import com.sybase.bpe.bped.IDeployer;
+import com.sybase.bpe.bped.IInternalEventDirector;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionService;
+
+/**
+ * @author charper
+ *  
+ */
+public class SerializeTester {
+
+       private static final String tmpfile = 
System.getProperty("java.io.tmpdir")
+               + System.getProperty("file.separator") + 
"serializTesterTmpFile";
+       private static final String keysfile = 
System.getProperty("java.io.tmpdir")
+               + System.getProperty("file.separator") + 
"serializTesterTmpFileProps";
+
+       public static void main(String[] args) throws Exception {
+               
+               if ( args[0].equals("-ser")) {
+                       write(args[1]);
+               } else {
+                       File f = new File(keysfile);
+                       Properties props = new Properties();
+                       props.load(f.toURL().openStream());
+                       Object[] objs = read();
+                       for (int i = 0; i < objs.length; i++) {
+                               IPMDRoot root = (IPMDRoot) objs[i];
+                               if ( props.getProperty(
+                                               
root.getLabel()).equals(root.getProcess().getKey().getValue())) {
+                                       System.out.println("Id for 
de-serialized defintion " +
+                                               root.getLabel() + " is " + 
+                                               
props.getProperty(root.getLabel()));
+                               } else {
+                                       System.err.println("Error:Id for 
de-serialized defintion " +
+                                                       root.getLabel() + " is 
" + 
+                                                       
root.getProcess().getKey().getValue());
+                               }
+                       }
+               }
+
+       }
+
+       private static void write(String bpelFile) throws Exception {
+
+               File defJar = new File(bpelFile);
+               EventDirector ed = EventDirectorFactory.createEventDirector();
+               IDeployer deployer = ed.getDeployer(DeployTypeEnum.BPEL);
+               deployer.loadDefinition(new FileInputStream(defJar),false);
+               DefinitionService ds = ((IInternalEventDirector) ed)
+                               .getProcessService().getInstanceService()
+                               .getDefinitionService();
+
+               Object[] defs = ds.getRootDefinitions().toArray();
+               
+               Properties props = new Properties();
+               for (int i = 0; i < defs.length; i++) {
+                       IPMDRoot root = (IPMDRoot)defs[i];
+                       
props.put(root.getLabel(),root.getProcess().getKey().getValue());
+               }
+               
+               FileOutputStream fos = null;
+               fos = new FileOutputStream(keysfile);
+               props.store(fos,"SerializeTester tmp file");
+
+               File f = new File(tmpfile);
+               f.delete();
+
+               fos = null;
+               ObjectOutputStream out = null;
+
+               fos = new FileOutputStream(tmpfile);
+               out = new ObjectOutputStream(fos);
+               out.writeObject(defs);
+               out.close();
+
+       }
+
+       private static Object[] read() throws Exception {
+               FileInputStream fis = null;
+               ObjectInputStream in = null;
+               Object obj = null;
+               fis = new FileInputStream(tmpfile);
+               in = new ObjectInputStream(fis);
+               obj = in.readObject();
+               in.close();
+
+               return (Object[])obj;
+       }
+
+}

Added: 
incubator/ode/scratch/bpe/src/test/java/com/sybase/uo/util/test/ApplicationLocalTest.java
URL: 
http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/test/java/com/sybase/uo/util/test/ApplicationLocalTest.java?rev=381686&view=auto
==============================================================================
--- 
incubator/ode/scratch/bpe/src/test/java/com/sybase/uo/util/test/ApplicationLocalTest.java
 (added)
+++ 
incubator/ode/scratch/bpe/src/test/java/com/sybase/uo/util/test/ApplicationLocalTest.java
 Tue Feb 28 08:02:48 2006
@@ -0,0 +1,75 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.uo.util.test;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import junit.framework.TestCase;
+
+import com.sybase.uo.util.ApplicationLocalStore;
+
+
+public class ApplicationLocalTest extends TestCase {
+       
+       public void testApplicationLocal() throws Exception {
+               
+               ClassLoader currentCL = 
Thread.currentThread().getContextClassLoader();
+               
+               try {
+                       String jar = System.getProperty("APP_LOCAL_JAR");
+                       File file = new File(jar);
+                       if (!file.canRead()) {
+                               throw new Exception(file + " doesn't exit!!!!");
+                       }
+                       URL url = file.toURL();
+
+                       ClassLoader cl1 = URLClassLoader.newInstance(new 
URL[]{url});
+                       ClassLoader cl2 = URLClassLoader.newInstance(new 
URL[]{url});
+
+                       setCCL(cl1);
+                       ApplicationLocalStore.set("key", "cl1");
+
+                       setCCL(cl2);
+                       ApplicationLocalStore.set("key", "cl2");
+
+                       setCCL(cl1);
+                       String str1 = (String) ApplicationLocalStore.get("key");
+
+                       setCCL(cl2);
+                       String str2 = (String) ApplicationLocalStore.get("key");
+
+                       assertTrue(str1.equals("cl1") && str2.equals("cl2"));
+                       
+               } catch (Exception e) {
+                       throw e;
+               } finally {
+                       setCCL(currentCL);
+               }
+               
+       }
+       
+       private static void setCCL(ClassLoader cl) {
+               Thread.currentThread().setContextClassLoader(cl);
+       }
+}

Added: 
incubator/ode/scratch/bpe/src/test/java/com/sybase/uo/util/test/ServerApplicationLocalTest.java
URL: 
http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/test/java/com/sybase/uo/util/test/ServerApplicationLocalTest.java?rev=381686&view=auto
==============================================================================
--- 
incubator/ode/scratch/bpe/src/test/java/com/sybase/uo/util/test/ServerApplicationLocalTest.java
 (added)
+++ 
incubator/ode/scratch/bpe/src/test/java/com/sybase/uo/util/test/ServerApplicationLocalTest.java
 Tue Feb 28 08:02:48 2006
@@ -0,0 +1,95 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Sep 19, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.uo.util.test;
+
+import java.io.Serializable;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import junit.framework.TestCase;
+
+import com.sybase.uo.util.ejb.ApplicationLocalStore;
+import com.sybase.uo.util.ejb.ApplicationLocalStoreHome;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class ServerApplicationLocalTest extends TestCase {
+       
+       private ApplicationLocalStore apls1;
+       private ApplicationLocalStore apls2;
+
+       /* (non-Javadoc)
+        * @see junit.framework.TestCase#setUp()
+        */
+       protected void setUp() throws Exception {
+               super.setUp();
+               
+               InitialContext ic = new InitialContext();
+               
+               Object alsobj = ic.lookup("UOBASE/ApplicationLocalStore");
+               ApplicationLocalStoreHome aplsh = 
+                       
(ApplicationLocalStoreHome)PortableRemoteObject.narrow(alsobj,
+                               ApplicationLocalStoreHome.class); 
+               apls1 = aplsh.create();
+               
+               Object alsobj2 = ic.lookup("UOBASE2/ApplicationLocalStore");
+               ApplicationLocalStoreHome aplsh2 = 
+                       
(ApplicationLocalStoreHome)PortableRemoteObject.narrow(alsobj2,
+                               ApplicationLocalStoreHome.class); 
+               apls2 = aplsh2.create();
+               
+       }
+       
+       public void testApplicationLocal() throws Exception {
+               
+                       apls1.set("key", "cl1");
+                       apls2.set("key", "cl2");
+                       String str1 = (String) apls1.get("key");
+                       String str2 = (String) apls2.get("key");
+
+                       assertTrue(str1.equals("cl1") && str2.equals("cl2"));   
+       }
+       
+       public void testApplicationLocalClear() throws Exception {
+               
+               apls1.set("key","cl1");
+               apls2.set("key","cl2");
+               apls1.clearStore();
+               apls2.clearStore();
+               Serializable obj1 = apls1.get("key");
+               Serializable obj2 = apls2.get("key");
+               
+               assertTrue(obj1 == null && obj2 == null );
+               
+       }
+}


Reply via email to