Author: azeez Date: Wed Jan 9 22:32:52 2008 New Revision: 610692 URL: http://svn.apache.org/viewvc?rev=610692&view=rev Log: Updating testcases
Added: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ObjectSerializationTest.java - copied, changed from r609519, webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ObjectSerializationTest.java webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/TestDO.java - copied, changed from r609519, webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/TestDO.java Removed: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ObjectSerializationTest.java webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/TestDO.java webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/UpdateStateTest.java Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java Modified: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java?rev=610692&r1=610691&r2=610692&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java (original) +++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java Wed Jan 9 22:32:52 2008 @@ -28,6 +28,7 @@ import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.ServiceGroupContext; +import org.apache.axis2.context.ServiceContext; import org.apache.axis2.description.AxisService; import org.apache.axis2.description.AxisServiceGroup; import org.apache.axis2.engine.AxisConfiguration; @@ -174,7 +175,6 @@ } public void testSetPropertyInServiceGroupContext() throws Exception { -// String sgcID = UUIDGenerator.getUUID(); ServiceGroupContext serviceGroupContext1 = configurationContext1.createServiceGroupContext(serviceGroup1); @@ -219,6 +219,60 @@ Thread.sleep(1000); assertEquals(val1, serviceGroupContext2.getProperty(key1)); + } + + public void testSetPropertyInServiceContext() throws Exception { + + ServiceGroupContext serviceGroupContext1 = + configurationContext1.createServiceGroupContext(serviceGroup1); + serviceGroupContext1.setId(TEST_SERVICE_NAME); + ServiceContext serviceContext1 = serviceGroupContext1.getServiceContext(service1); + configurationContext1.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext1); + assertNotNull(serviceGroupContext1); + assertNotNull(serviceContext1); + + ServiceGroupContext serviceGroupContext2 = + configurationContext2.createServiceGroupContext(serviceGroup2); + serviceGroupContext2.setId(TEST_SERVICE_NAME); + ServiceContext serviceContext2 = serviceGroupContext2.getServiceContext(service2); + configurationContext2.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext2); + assertNotNull(serviceGroupContext2); + assertNotNull(serviceContext2); + + String key1 = "sgCtxKey"; + String val1 = "sgCtxVal1"; + serviceContext1.setProperty(key1, val1); + ctxMan1.updateContext(serviceContext1); + + Thread.sleep(1000); + assertEquals(val1, serviceContext2.getProperty(key1)); + } + + public void testSetPropertyInServiceContext2() throws Exception { + + ServiceGroupContext serviceGroupContext1 = + configurationContext1.createServiceGroupContext(serviceGroup1); + serviceGroupContext1.setId(TEST_SERVICE_NAME); + ServiceContext serviceContext1 = serviceGroupContext1.getServiceContext(service1); + configurationContext1.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext1); + assertNotNull(serviceGroupContext1); + assertNotNull(serviceContext1); + + ServiceGroupContext serviceGroupContext2 = + configurationContext2.createServiceGroupContext(serviceGroup2); + serviceGroupContext2.setId(TEST_SERVICE_NAME); + ServiceContext serviceContext2 = serviceGroupContext2.getServiceContext(service2); + configurationContext2.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext2); + assertNotNull(serviceGroupContext2); + assertNotNull(serviceContext2); + + String key1 = "sgCtxKey"; + String val1 = "sgCtxVal1"; + serviceContext1.setProperty(key1, val1); + ctxMan1.updateContext(serviceContext1); + + Thread.sleep(1000); + assertEquals(val1, serviceContext2.getProperty(key1)); } protected void tearDown() throws Exception { Copied: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ObjectSerializationTest.java (from r609519, webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ObjectSerializationTest.java) URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ObjectSerializationTest.java?p2=webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ObjectSerializationTest.java&p1=webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ObjectSerializationTest.java&r1=609519&r2=610692&rev=610692&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/ObjectSerializationTest.java (original) +++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ObjectSerializationTest.java Wed Jan 9 22:32:52 2008 @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.axis2.clustering.tribes; +package org.apache.axis2.clustering; import junit.framework.TestCase; import org.apache.axis2.clustering.control.AckCommand; +import org.apache.axis2.clustering.TestDO; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -29,7 +30,7 @@ */ public class ObjectSerializationTest extends TestCase { - public void testSerialization() { + public void testSerialization() throws IOException, ClassNotFoundException { AckCommand ackCommand = new AckCommand("uuid"); ackCommand.setMemberId("123456"); @@ -40,7 +41,7 @@ assertEquals(ackCommand.getUniqueId(), ackCommand2.getUniqueId()); } - public void testSerialization2() { + public void testSerialization2() throws IOException, ClassNotFoundException { TestDO testDO = new TestDO("name", "value"); TestDO testDO2 = (TestDO) copy(testDO); @@ -54,28 +55,20 @@ * Returns a copy of the object, or null if the object cannot * be serialized. */ - public Object copy(Object orig) { + public Object copy(Object orig) throws ClassNotFoundException, IOException { Object obj = null; - try { - // Write the object out to a byte array - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream out = new ObjectOutputStream(bos); - out.writeObject(orig); - out.flush(); - out.close(); - - // Make an input stream from the byte array and read - // a copy of the object back in. - ObjectInputStream in = new ObjectInputStream( - new ByteArrayInputStream(bos.toByteArray())); - obj = in.readObject(); - } - catch (IOException e) { - e.printStackTrace(); - } - catch (ClassNotFoundException cnfe) { - cnfe.printStackTrace(); - } + // Write the object out to a byte array + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(bos); + out.writeObject(orig); + out.flush(); + out.close(); + + // Make an input stream from the byte array and read + // a copy of the object back in. + ObjectInputStream in = new ObjectInputStream( + new ByteArrayInputStream(bos.toByteArray())); + obj = in.readObject(); return obj; } } Copied: webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/TestDO.java (from r609519, webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/TestDO.java) URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/TestDO.java?p2=webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/TestDO.java&p1=webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/TestDO.java&r1=609519&r2=610692&rev=610692&view=diff ============================================================================== --- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/tribes/TestDO.java (original) +++ webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/TestDO.java Wed Jan 9 22:32:52 2008 @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.axis2.clustering.tribes; +package org.apache.axis2.clustering; import java.io.Serializable; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]