You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Sanka Samaranayake <ss...@gmail.com> on 2005/10/06 04:52:50 UTC
[Sandesha2][Patch] Some more testcases ..
Dear Sandesha2 Committers,
Please accept these testcases for org.apache.sandesha2.storage.* package
Thanks;
--Sanka
Re: [Sandesha2][Patch] Some more testcases ..
Posted by Jaliya Ekanayake <ja...@opensource.lk>.
Done, Thanks!
Jaliya
----- Original Message -----
From: "Sanka Samaranayake" <ss...@gmail.com>
To: <sa...@ws.apache.org>
Sent: Wednesday, October 05, 2005 9:52 PM
Subject: [Sandesha2][Patch] Some more testcases ..
> Dear Sandesha2 Committers,
>
> Please accept these testcases for org.apache.sandesha2.storage.* package
>
> Thanks;
> --Sanka
>
--------------------------------------------------------------------------------
> Index: test/org/apache/sandesha2/SimpleServerImpl.java
> ===================================================================
> --- test/org/apache/sandesha2/SimpleServerImpl.java (revision 294987)
> +++ test/org/apache/sandesha2/SimpleServerImpl.java (working copy)
> @@ -17,8 +17,8 @@
> public class SimpleServerImpl {
>
> public static void main(String[] args) throws IOException {
> - SimpleHTTPServer sas= new SimpleHTTPServer("E:\\Program
> Files\\Apache Software Foundation\\Tomcat
> 5.0\\webapps\\axis2\\WEB-INF",8080);
> - sas.start();
> + SimpleHTTPServer simpleServer = new
> SimpleHTTPServer("/home/sanka/tomcat/jakarta-tomcat-4.1.30/webapps/axis2/WEB-INF",8080);
> + simpleServer.start();
> System.out.println ("Sandesha2 Simple Axis Server Started....");
> }
> }
> Index: test/org/apache/sandesha2/SandeshaTestCase.java
> ===================================================================
> --- test/org/apache/sandesha2/SandeshaTestCase.java (revision 0)
> +++ test/org/apache/sandesha2/SandeshaTestCase.java (revision 0)
> @@ -0,0 +1,39 @@
> +package org.apache.sandesha2;
> +
> +import junit.framework.TestCase;
> +import org.apache.axis2.context.MessageContext;
> +import org.apache.axis2.context.ConfigurationContext;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class SandeshaTestCase extends TestCase {
> +
> + public SandeshaTestCase(String name) {
> + super(name);
> + }
> +
> + private MessageContext getMessageContext() throws Exception{
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + MessageContext msgCtx = new MessageContext(configCtx);
> + return msgCtx;
> +
> + }
> +
> +
> +}
> Index: test/org/apache/sandesha2/storage/RetransmitterBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/RetransmitterBeanMgrTest.java
> (revision 0)
> +++ test/org/apache/sandesha2/storage/RetransmitterBeanMgrTest.java
> (revision 0)
> @@ -0,0 +1,121 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.SandeshaException;
> +import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
> +import org.apache.sandesha2.storage.beans.RetransmitterBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class RetransmitterBeanMgrTest extends SandeshaTestCase {
> + private RetransmitterBeanMgr mgr;
> +
> + public RetransmitterBeanMgrTest() {
> + super("RetransmitterBeanMgrTest");
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getRetransmitterBeanMgr();
> + }
> +
> + public void testDelete() {
> + assertNull(mgr.retrieve(""));
> + try {
> + mgr.insert(new RetransmitterBean("MsgId1", "Key1", 1001,
> false, "TmpSeqId1", 1001));
> + } catch (Exception ex) {
> + fail("should not throw an exception");
> + }
> + assertNotNull(mgr.retrieve("MsgId1"));
> + }
> +
> + public void testFind() {
> + try {
> + mgr.insert(new RetransmitterBean("MsgId2", "Key2", 1002,
> false, "TmpSeqId2", 1002));
> + mgr.insert(new RetransmitterBean("MsgId3", "Key3", 1003,
> false, "TmpSeqId2", 1003));
> +
> + RetransmitterBean target = new RetransmitterBean();
> + target.setTempSequenceId("TmpSeqId2");
> +
> + Iterator iterator = mgr.find(target).iterator();
> + RetransmitterBean tmp = (RetransmitterBean) iterator.next();
> +
> + if (tmp.getMessageId().equals("MsgId2")) {
> + tmp = (RetransmitterBean) iterator.next();
> + assertTrue(tmp.getMessageId().equals("MsgId3"));
> + } else {
> + tmp = (RetransmitterBean) iterator.next();
> + assertTrue(tmp.getMessageId().equals("MsgId2"));
> + }
> +
> +
> + } catch (SandeshaException e) {
> + fail("should not throw an exception");
> + }
> +
> +
> + }
> +
> + public void testInsert() {
> + try {
> + mgr.insert(new RetransmitterBean());
> + fail("should throw an exception");
> +
> + } catch (SandeshaException ex) {
> + }
> +
> + try {
> + mgr.insert(new RetransmitterBean("MsgId4","Key4", 1004,
> false, "TmpSeqId4", 1004));
> + RetransmitterBean tmp = mgr.retrieve("MsgId4");
> + assertTrue(tmp.getKey().equals("Key4"));
> +
> +
> + } catch (SandeshaException e) {
> + fail("should not throw an exception");
> + }
> +
> + }
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("MsgId5"));
> + try {
> + mgr.insert(new RetransmitterBean("MsgId5", "Key5", 1005,
> false, "TmpSeqId5", 1005));
> + } catch (SandeshaException e) {
> + fail("this should not throw an exception");
> + }
> + assertNotNull(mgr.retrieve("MsgId5"));
> + }
> +
> + public void testUpdate() {
> + RetransmitterBean bean = new RetransmitterBean("MsgId6", "Key6",
> 1006, false, "TmpSeqId6", 1006);
> + try {
> + mgr.insert(bean);
> + } catch (SandeshaException e) {
> + fail("should not throw an exception");
> + }
> + bean.setSend(true);
> + mgr.update(bean);
> +
> + RetransmitterBean tmp = mgr.retrieve("MsgId6");
> + assertTrue(tmp.isSend());
> + }
> +}
> Index: test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.java (revision 0)
> +++ test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.java (revision 0)
> @@ -0,0 +1,91 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
> +import org.apache.sandesha2.storage.beans.NextMsgBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class NextMsgBeanMgrTest extends SandeshaTestCase {
> + private NextMsgBeanMgr mgr;
> +
> + public NextMsgBeanMgrTest(String name) {
> + super(name);
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getNextMsgBeanMgr();
> +
> + }
> +
> + public void testDelete() {
> + mgr.insert(new NextMsgBean("SeqId1", 1001));
> + mgr.delete("SeqId1");
> + assertNull(mgr.retrieve("SeqId1"));
> + }
> +
> + public void testFind() {
> + mgr.insert(new NextMsgBean("SeqId2", 1002));
> + mgr.insert(new NextMsgBean("SeqId3", 1002));
> +
> + NextMsgBean target = new NextMsgBean();
> + target.setNextMsgNoToProcess(1002);
> +
> + Iterator iterator = mgr.find(target).iterator();
> + NextMsgBean tmp = (NextMsgBean) iterator.next();
> +
> + if (tmp.getSequenceId().equals("SeqId2")) {
> + tmp = (NextMsgBean) iterator.next();
> + tmp.getSequenceId().equals("SeqId3");
> + } else {
> + tmp = (NextMsgBean) iterator.next();
> + tmp.getSequenceId().equals("SeqId2");
> + }
> +
> + }
> +
> + public void testInsert() {
> + NextMsgBean bean = new NextMsgBean("SeqId4", 1004);
> + mgr.insert(bean);
> + NextMsgBean tmp = mgr.retrieve("SeqId4");
> + assertTrue(tmp.getNextMsgNoToProcess() == 1004);
> + }
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("SeqId5"));
> + mgr.insert(new NextMsgBean("SeqId5", 1005));
> +
> + NextMsgBean tmp = mgr.retrieve("SeqId5");
> + assertTrue(tmp.getNextMsgNoToProcess() == 1005);
> + }
> +
> + public void testUpdate() {
> + NextMsgBean bean = new NextMsgBean("SeqId6", 1006);
> + mgr.insert(bean);
> + bean.setNextMsgNoToProcess(1007);
> + mgr.update(bean);
> + NextMsgBean tmp = mgr.retrieve("SeqId6");
> + assertTrue(tmp.getNextMsgNoToProcess() ==1007);
> + }
> +
> +}
> Index: test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.java (revision
> 0)
> +++ test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.java (revision
> 0)
> @@ -0,0 +1,94 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
> +import org.apache.sandesha2.storage.beans.CreateSeqBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class CreateSeqBeanMgrTest extends SandeshaTestCase {
> + private CreateSeqBeanMgr mgr;
> +
> + public CreateSeqBeanMgrTest() {
> + super("CreateSeqBeanMgrTest");
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> +
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getCreateSeqBeanMgr();
> + }
> +
> + public void testDelete() {
> + mgr.insert(new CreateSeqBean("TmpSeqId1", "CreateSeqMsgId1",
> "SeqId1"));
> + mgr.delete("CreateSeqMsgId1");
> + assertNull(mgr.retrieve("CreateSeqMsgId1"));
> + }
> +
> + public void testFind() {
> + mgr.insert(new CreateSeqBean("TmpSeqId2", "CreateSeqMsgId2",
> "SeqId2"));
> + mgr.insert(new CreateSeqBean("TmpSeqId2", "CreateSeqMsgId3",
> "SeqId3"));
> +
> + CreateSeqBean target = new CreateSeqBean();
> + target.setTempSequenceId("TmpSeqId2");
> +
> + Iterator iter = mgr.find(target).iterator();
> + CreateSeqBean tmp = (CreateSeqBean) iter.next();
> + if (tmp.getCreateSeqMsgId().equals("CreateSeqMsgId1")) {
> + tmp = (CreateSeqBean) iter.next();
> +
> assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId2"));
> +
> + } else {
> + tmp = (CreateSeqBean) iter.next();
> +
> assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId3"));
> + }
> + }
> +
> + public void testInsert() {
> + CreateSeqBean bean = new CreateSeqBean("TmpSeqId4",
> "CreateSeqMsgId4", "SeqId4");
> + mgr.insert(bean);
> + CreateSeqBean tmpbean = mgr.retrieve("CreateSeqMsgId4");
> +
> assertTrue(tmpbean.getCreateSeqMsgId().equals("CreateSeqMsgId4"));
> + assertTrue(tmpbean.getSequenceId().equals("SeqId4"));
> + assertTrue(tmpbean.getTempSequenceId().equals("TmpSeqId4"));
> + }
> +
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("CreateSeqMsgId5"));
> +
> + CreateSeqBean bean = new CreateSeqBean("TmpSeqId5",
> "CreateSeqMsgId5", "SeqId5");
> + mgr.insert(bean);
> + CreateSeqBean tmp = mgr.retrieve("CreateSeqMsgId5");
> + assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId5"));
> + }
> +
> + public void testUpdate() {
> +
> + CreateSeqBean bean = new CreateSeqBean("TmpSeqId6",
> "CreateSeqMsgId6", "SeqId6");
> + mgr.insert(bean);
> + bean.setTempSequenceId("TmpSeqId7");
> + mgr.update(bean);
> + CreateSeqBean tmp = mgr.retrieve("CreateSeqMsgId6");
> + assertTrue(tmp.getTempSequenceId().equals("TmpSeqId7"));
> + }
> +}
> Index: test/org/apache/sandesha2/storage/SequencePropertyBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/SequencePropertyBeanMgrTest.java
> (revision 0)
> +++ test/org/apache/sandesha2/storage/SequencePropertyBeanMgrTest.java
> (revision 0)
> @@ -0,0 +1,86 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
> +import org.apache.sandesha2.storage.beans.SequencePropertyBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class SequencePropertyBeanMgrTest extends SandeshaTestCase {
> + SequencePropertyBeanMgr mgr;
> +
> + public SequencePropertyBeanMgrTest() {
> + super("SequencePropertyBeanMgrTest");
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getSequencePropretyBeanMgr();
> +
> + }
> +
> + public void testDelete() {
> + mgr.insert(new SequencePropertyBean("SeqId1", "Name1",
> "Value1"));
> + mgr.delete("SeqId1", "Name1");
> + assertNull(mgr.retrieve("SeqId1", "Name1"));
> + }
> +
> + public void testFind() {
> + mgr.insert(new SequencePropertyBean("SeqId2", "Name2",
> "Value2"));
> + mgr.insert(new SequencePropertyBean("SeqId3", "Name3",
> "Value2"));
> +
> + SequencePropertyBean bean = new SequencePropertyBean();
> + bean.setValue("Value2");
> + Iterator iter = mgr.find(bean).iterator();
> + SequencePropertyBean tmp = (SequencePropertyBean) iter.next();
> + if (tmp.getSequenceId().equals("SeqId2")) {
> + tmp = (SequencePropertyBean) iter.next();
> + assertTrue(tmp.getSequenceId().equals("SeqId3"));
> + } else {
> + tmp = (SequencePropertyBean) iter.next();
> + assertTrue(tmp.getSequenceId().equals("SeqId2"));
> + }
> + }
> +
> + public void testInsert() {
> + mgr.insert(new SequencePropertyBean("SeqId4", "Name4",
> "Value4"));
> + SequencePropertyBean tmp = mgr.retrieve("SeqId4", "Name4");
> + assertTrue(tmp.getValue().equals("Value4"));
> +
> + }
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("SeqId5", "Name5"));
> + mgr.insert(new SequencePropertyBean("SeqId5", "Name5",
> "Value5"));
> + assertNotNull(mgr.retrieve("SeqId5", "Name5"));
> + }
> +
> +
> + public void testUpdate() {
> + SequencePropertyBean bean = new SequencePropertyBean("SeqId6",
> "Name6", "Value6");
> + mgr.insert(bean);
> + bean.setValue("Value7");
> + mgr.update(bean);
> + SequencePropertyBean tmp = mgr.retrieve("SeqId6", "Name6");
> + assertTrue(tmp.getValue().equals("Value7"));
> + }
> +}
> \ No newline at end of file
> Index: test/org/apache/sandesha2/storage/StorageMapBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/StorageMapBeanMgrTest.java (revision
> 0)
> +++ test/org/apache/sandesha2/storage/StorageMapBeanMgrTest.java (revision
> 0)
> @@ -0,0 +1,86 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.storage.beanmanagers.StorageMapBeanMgr;
> +import org.apache.sandesha2.storage.beans.StorageMapBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class StorageMapBeanMgrTest extends SandeshaTestCase {
> +
> + StorageMapBeanMgr mgr;
> +
> + public StorageMapBeanMgrTest() {
> + super ("StorageMapBeanMgrTest");
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getStorageMapBeanMgr();
> + }
> +
> + public void testDelete() {
> + mgr.insert(new StorageMapBean("Key1", 1001, "SeqId1"));
> + mgr.delete("Key1");
> + assertNull(mgr.retrieve("Key1"));
> + }
> +
> + public void testFind() {
> + mgr.insert(new StorageMapBean("Key2", 1002, "SeqId2"));
> + mgr.insert(new StorageMapBean("Key3", 1003, "SeqId2"));
> +
> + StorageMapBean bean = new StorageMapBean();
> + bean.setSequenceId("SeqId2");
> +
> + Iterator iter = mgr.find(bean).iterator();
> + StorageMapBean tmp = (StorageMapBean) iter.next();
> +
> + if (tmp.getKey().equals("Key2")) {
> + tmp = (StorageMapBean) iter.next();
> + assertTrue(tmp.getKey().equals("Key3"));
> + } else {
> + tmp = (StorageMapBean) iter.next();
> + assertTrue(tmp.getKey().equals("Key2"));
> +
> + }
> + }
> +
> + public void testInsert() {
> + mgr.insert(new StorageMapBean("Key4", 1004, "SeqId4"));
> + StorageMapBean tmp = mgr.retrieve("Key4");
> + assertTrue(tmp.getKey().equals("Key4"));
> + }
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("Key5"));
> + mgr.insert(new StorageMapBean("Key5", 1004, "SeqId5"));
> + assertNotNull(mgr.retrieve("Key5"));
> + }
> +
> + public void testUpdate() {
> + StorageMapBean bean = new StorageMapBean("Key6", 1006, "SeqId6");
> + mgr.insert(bean);
> + bean.setMsgNo(1007);
> + StorageMapBean tmp = mgr.retrieve("Key6");
> + assertTrue(tmp.getMsgNo() == 1007);
> + }
> +}
>
>
--------------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: sandesha-dev-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org
Re: [Sandesha2][Patch] Some more testcases ..
Posted by Jaliya Ekanayake <ja...@opensource.lk>.
Done, Thanks!
Jaliya
----- Original Message -----
From: "Sanka Samaranayake" <ss...@gmail.com>
To: <sa...@ws.apache.org>
Sent: Wednesday, October 05, 2005 9:52 PM
Subject: [Sandesha2][Patch] Some more testcases ..
> Dear Sandesha2 Committers,
>
> Please accept these testcases for org.apache.sandesha2.storage.* package
>
> Thanks;
> --Sanka
>
--------------------------------------------------------------------------------
> Index: test/org/apache/sandesha2/SimpleServerImpl.java
> ===================================================================
> --- test/org/apache/sandesha2/SimpleServerImpl.java (revision 294987)
> +++ test/org/apache/sandesha2/SimpleServerImpl.java (working copy)
> @@ -17,8 +17,8 @@
> public class SimpleServerImpl {
>
> public static void main(String[] args) throws IOException {
> - SimpleHTTPServer sas= new SimpleHTTPServer("E:\\Program
> Files\\Apache Software Foundation\\Tomcat
> 5.0\\webapps\\axis2\\WEB-INF",8080);
> - sas.start();
> + SimpleHTTPServer simpleServer = new
> SimpleHTTPServer("/home/sanka/tomcat/jakarta-tomcat-4.1.30/webapps/axis2/WEB-INF",8080);
> + simpleServer.start();
> System.out.println ("Sandesha2 Simple Axis Server Started....");
> }
> }
> Index: test/org/apache/sandesha2/SandeshaTestCase.java
> ===================================================================
> --- test/org/apache/sandesha2/SandeshaTestCase.java (revision 0)
> +++ test/org/apache/sandesha2/SandeshaTestCase.java (revision 0)
> @@ -0,0 +1,39 @@
> +package org.apache.sandesha2;
> +
> +import junit.framework.TestCase;
> +import org.apache.axis2.context.MessageContext;
> +import org.apache.axis2.context.ConfigurationContext;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class SandeshaTestCase extends TestCase {
> +
> + public SandeshaTestCase(String name) {
> + super(name);
> + }
> +
> + private MessageContext getMessageContext() throws Exception{
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + MessageContext msgCtx = new MessageContext(configCtx);
> + return msgCtx;
> +
> + }
> +
> +
> +}
> Index: test/org/apache/sandesha2/storage/RetransmitterBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/RetransmitterBeanMgrTest.java
> (revision 0)
> +++ test/org/apache/sandesha2/storage/RetransmitterBeanMgrTest.java
> (revision 0)
> @@ -0,0 +1,121 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.SandeshaException;
> +import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
> +import org.apache.sandesha2.storage.beans.RetransmitterBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class RetransmitterBeanMgrTest extends SandeshaTestCase {
> + private RetransmitterBeanMgr mgr;
> +
> + public RetransmitterBeanMgrTest() {
> + super("RetransmitterBeanMgrTest");
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getRetransmitterBeanMgr();
> + }
> +
> + public void testDelete() {
> + assertNull(mgr.retrieve(""));
> + try {
> + mgr.insert(new RetransmitterBean("MsgId1", "Key1", 1001,
> false, "TmpSeqId1", 1001));
> + } catch (Exception ex) {
> + fail("should not throw an exception");
> + }
> + assertNotNull(mgr.retrieve("MsgId1"));
> + }
> +
> + public void testFind() {
> + try {
> + mgr.insert(new RetransmitterBean("MsgId2", "Key2", 1002,
> false, "TmpSeqId2", 1002));
> + mgr.insert(new RetransmitterBean("MsgId3", "Key3", 1003,
> false, "TmpSeqId2", 1003));
> +
> + RetransmitterBean target = new RetransmitterBean();
> + target.setTempSequenceId("TmpSeqId2");
> +
> + Iterator iterator = mgr.find(target).iterator();
> + RetransmitterBean tmp = (RetransmitterBean) iterator.next();
> +
> + if (tmp.getMessageId().equals("MsgId2")) {
> + tmp = (RetransmitterBean) iterator.next();
> + assertTrue(tmp.getMessageId().equals("MsgId3"));
> + } else {
> + tmp = (RetransmitterBean) iterator.next();
> + assertTrue(tmp.getMessageId().equals("MsgId2"));
> + }
> +
> +
> + } catch (SandeshaException e) {
> + fail("should not throw an exception");
> + }
> +
> +
> + }
> +
> + public void testInsert() {
> + try {
> + mgr.insert(new RetransmitterBean());
> + fail("should throw an exception");
> +
> + } catch (SandeshaException ex) {
> + }
> +
> + try {
> + mgr.insert(new RetransmitterBean("MsgId4","Key4", 1004,
> false, "TmpSeqId4", 1004));
> + RetransmitterBean tmp = mgr.retrieve("MsgId4");
> + assertTrue(tmp.getKey().equals("Key4"));
> +
> +
> + } catch (SandeshaException e) {
> + fail("should not throw an exception");
> + }
> +
> + }
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("MsgId5"));
> + try {
> + mgr.insert(new RetransmitterBean("MsgId5", "Key5", 1005,
> false, "TmpSeqId5", 1005));
> + } catch (SandeshaException e) {
> + fail("this should not throw an exception");
> + }
> + assertNotNull(mgr.retrieve("MsgId5"));
> + }
> +
> + public void testUpdate() {
> + RetransmitterBean bean = new RetransmitterBean("MsgId6", "Key6",
> 1006, false, "TmpSeqId6", 1006);
> + try {
> + mgr.insert(bean);
> + } catch (SandeshaException e) {
> + fail("should not throw an exception");
> + }
> + bean.setSend(true);
> + mgr.update(bean);
> +
> + RetransmitterBean tmp = mgr.retrieve("MsgId6");
> + assertTrue(tmp.isSend());
> + }
> +}
> Index: test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.java (revision 0)
> +++ test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.java (revision 0)
> @@ -0,0 +1,91 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
> +import org.apache.sandesha2.storage.beans.NextMsgBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class NextMsgBeanMgrTest extends SandeshaTestCase {
> + private NextMsgBeanMgr mgr;
> +
> + public NextMsgBeanMgrTest(String name) {
> + super(name);
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getNextMsgBeanMgr();
> +
> + }
> +
> + public void testDelete() {
> + mgr.insert(new NextMsgBean("SeqId1", 1001));
> + mgr.delete("SeqId1");
> + assertNull(mgr.retrieve("SeqId1"));
> + }
> +
> + public void testFind() {
> + mgr.insert(new NextMsgBean("SeqId2", 1002));
> + mgr.insert(new NextMsgBean("SeqId3", 1002));
> +
> + NextMsgBean target = new NextMsgBean();
> + target.setNextMsgNoToProcess(1002);
> +
> + Iterator iterator = mgr.find(target).iterator();
> + NextMsgBean tmp = (NextMsgBean) iterator.next();
> +
> + if (tmp.getSequenceId().equals("SeqId2")) {
> + tmp = (NextMsgBean) iterator.next();
> + tmp.getSequenceId().equals("SeqId3");
> + } else {
> + tmp = (NextMsgBean) iterator.next();
> + tmp.getSequenceId().equals("SeqId2");
> + }
> +
> + }
> +
> + public void testInsert() {
> + NextMsgBean bean = new NextMsgBean("SeqId4", 1004);
> + mgr.insert(bean);
> + NextMsgBean tmp = mgr.retrieve("SeqId4");
> + assertTrue(tmp.getNextMsgNoToProcess() == 1004);
> + }
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("SeqId5"));
> + mgr.insert(new NextMsgBean("SeqId5", 1005));
> +
> + NextMsgBean tmp = mgr.retrieve("SeqId5");
> + assertTrue(tmp.getNextMsgNoToProcess() == 1005);
> + }
> +
> + public void testUpdate() {
> + NextMsgBean bean = new NextMsgBean("SeqId6", 1006);
> + mgr.insert(bean);
> + bean.setNextMsgNoToProcess(1007);
> + mgr.update(bean);
> + NextMsgBean tmp = mgr.retrieve("SeqId6");
> + assertTrue(tmp.getNextMsgNoToProcess() ==1007);
> + }
> +
> +}
> Index: test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.java (revision
> 0)
> +++ test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.java (revision
> 0)
> @@ -0,0 +1,94 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
> +import org.apache.sandesha2.storage.beans.CreateSeqBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class CreateSeqBeanMgrTest extends SandeshaTestCase {
> + private CreateSeqBeanMgr mgr;
> +
> + public CreateSeqBeanMgrTest() {
> + super("CreateSeqBeanMgrTest");
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> +
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getCreateSeqBeanMgr();
> + }
> +
> + public void testDelete() {
> + mgr.insert(new CreateSeqBean("TmpSeqId1", "CreateSeqMsgId1",
> "SeqId1"));
> + mgr.delete("CreateSeqMsgId1");
> + assertNull(mgr.retrieve("CreateSeqMsgId1"));
> + }
> +
> + public void testFind() {
> + mgr.insert(new CreateSeqBean("TmpSeqId2", "CreateSeqMsgId2",
> "SeqId2"));
> + mgr.insert(new CreateSeqBean("TmpSeqId2", "CreateSeqMsgId3",
> "SeqId3"));
> +
> + CreateSeqBean target = new CreateSeqBean();
> + target.setTempSequenceId("TmpSeqId2");
> +
> + Iterator iter = mgr.find(target).iterator();
> + CreateSeqBean tmp = (CreateSeqBean) iter.next();
> + if (tmp.getCreateSeqMsgId().equals("CreateSeqMsgId1")) {
> + tmp = (CreateSeqBean) iter.next();
> +
> assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId2"));
> +
> + } else {
> + tmp = (CreateSeqBean) iter.next();
> +
> assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId3"));
> + }
> + }
> +
> + public void testInsert() {
> + CreateSeqBean bean = new CreateSeqBean("TmpSeqId4",
> "CreateSeqMsgId4", "SeqId4");
> + mgr.insert(bean);
> + CreateSeqBean tmpbean = mgr.retrieve("CreateSeqMsgId4");
> +
> assertTrue(tmpbean.getCreateSeqMsgId().equals("CreateSeqMsgId4"));
> + assertTrue(tmpbean.getSequenceId().equals("SeqId4"));
> + assertTrue(tmpbean.getTempSequenceId().equals("TmpSeqId4"));
> + }
> +
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("CreateSeqMsgId5"));
> +
> + CreateSeqBean bean = new CreateSeqBean("TmpSeqId5",
> "CreateSeqMsgId5", "SeqId5");
> + mgr.insert(bean);
> + CreateSeqBean tmp = mgr.retrieve("CreateSeqMsgId5");
> + assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId5"));
> + }
> +
> + public void testUpdate() {
> +
> + CreateSeqBean bean = new CreateSeqBean("TmpSeqId6",
> "CreateSeqMsgId6", "SeqId6");
> + mgr.insert(bean);
> + bean.setTempSequenceId("TmpSeqId7");
> + mgr.update(bean);
> + CreateSeqBean tmp = mgr.retrieve("CreateSeqMsgId6");
> + assertTrue(tmp.getTempSequenceId().equals("TmpSeqId7"));
> + }
> +}
> Index: test/org/apache/sandesha2/storage/SequencePropertyBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/SequencePropertyBeanMgrTest.java
> (revision 0)
> +++ test/org/apache/sandesha2/storage/SequencePropertyBeanMgrTest.java
> (revision 0)
> @@ -0,0 +1,86 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
> +import org.apache.sandesha2.storage.beans.SequencePropertyBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class SequencePropertyBeanMgrTest extends SandeshaTestCase {
> + SequencePropertyBeanMgr mgr;
> +
> + public SequencePropertyBeanMgrTest() {
> + super("SequencePropertyBeanMgrTest");
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getSequencePropretyBeanMgr();
> +
> + }
> +
> + public void testDelete() {
> + mgr.insert(new SequencePropertyBean("SeqId1", "Name1",
> "Value1"));
> + mgr.delete("SeqId1", "Name1");
> + assertNull(mgr.retrieve("SeqId1", "Name1"));
> + }
> +
> + public void testFind() {
> + mgr.insert(new SequencePropertyBean("SeqId2", "Name2",
> "Value2"));
> + mgr.insert(new SequencePropertyBean("SeqId3", "Name3",
> "Value2"));
> +
> + SequencePropertyBean bean = new SequencePropertyBean();
> + bean.setValue("Value2");
> + Iterator iter = mgr.find(bean).iterator();
> + SequencePropertyBean tmp = (SequencePropertyBean) iter.next();
> + if (tmp.getSequenceId().equals("SeqId2")) {
> + tmp = (SequencePropertyBean) iter.next();
> + assertTrue(tmp.getSequenceId().equals("SeqId3"));
> + } else {
> + tmp = (SequencePropertyBean) iter.next();
> + assertTrue(tmp.getSequenceId().equals("SeqId2"));
> + }
> + }
> +
> + public void testInsert() {
> + mgr.insert(new SequencePropertyBean("SeqId4", "Name4",
> "Value4"));
> + SequencePropertyBean tmp = mgr.retrieve("SeqId4", "Name4");
> + assertTrue(tmp.getValue().equals("Value4"));
> +
> + }
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("SeqId5", "Name5"));
> + mgr.insert(new SequencePropertyBean("SeqId5", "Name5",
> "Value5"));
> + assertNotNull(mgr.retrieve("SeqId5", "Name5"));
> + }
> +
> +
> + public void testUpdate() {
> + SequencePropertyBean bean = new SequencePropertyBean("SeqId6",
> "Name6", "Value6");
> + mgr.insert(bean);
> + bean.setValue("Value7");
> + mgr.update(bean);
> + SequencePropertyBean tmp = mgr.retrieve("SeqId6", "Name6");
> + assertTrue(tmp.getValue().equals("Value7"));
> + }
> +}
> \ No newline at end of file
> Index: test/org/apache/sandesha2/storage/StorageMapBeanMgrTest.java
> ===================================================================
> --- test/org/apache/sandesha2/storage/StorageMapBeanMgrTest.java (revision
> 0)
> +++ test/org/apache/sandesha2/storage/StorageMapBeanMgrTest.java (revision
> 0)
> @@ -0,0 +1,86 @@
> +package org.apache.sandesha2.storage;
> +
> +import org.apache.sandesha2.SandeshaTestCase;
> +import org.apache.sandesha2.storage.beanmanagers.StorageMapBeanMgr;
> +import org.apache.sandesha2.storage.beans.StorageMapBean;
> +import org.apache.axis2.engine.AxisConfiguration;
> +import org.apache.axis2.engine.AxisConfigurationImpl;
> +import org.apache.axis2.context.ConfigurationContext;
> +
> +import java.util.Iterator;
> +/*
> + * Copyright 2004,2005 The Apache Software Foundation.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +public class StorageMapBeanMgrTest extends SandeshaTestCase {
> +
> + StorageMapBeanMgr mgr;
> +
> + public StorageMapBeanMgrTest() {
> + super ("StorageMapBeanMgrTest");
> + }
> +
> + public void setUp() throws Exception {
> + AxisConfiguration axisConfig = new AxisConfigurationImpl();
> + ConfigurationContext configCtx = new
> ConfigurationContext(axisConfig);
> + mgr =
> AbstractBeanMgrFactory.getInstance(configCtx).getStorageMapBeanMgr();
> + }
> +
> + public void testDelete() {
> + mgr.insert(new StorageMapBean("Key1", 1001, "SeqId1"));
> + mgr.delete("Key1");
> + assertNull(mgr.retrieve("Key1"));
> + }
> +
> + public void testFind() {
> + mgr.insert(new StorageMapBean("Key2", 1002, "SeqId2"));
> + mgr.insert(new StorageMapBean("Key3", 1003, "SeqId2"));
> +
> + StorageMapBean bean = new StorageMapBean();
> + bean.setSequenceId("SeqId2");
> +
> + Iterator iter = mgr.find(bean).iterator();
> + StorageMapBean tmp = (StorageMapBean) iter.next();
> +
> + if (tmp.getKey().equals("Key2")) {
> + tmp = (StorageMapBean) iter.next();
> + assertTrue(tmp.getKey().equals("Key3"));
> + } else {
> + tmp = (StorageMapBean) iter.next();
> + assertTrue(tmp.getKey().equals("Key2"));
> +
> + }
> + }
> +
> + public void testInsert() {
> + mgr.insert(new StorageMapBean("Key4", 1004, "SeqId4"));
> + StorageMapBean tmp = mgr.retrieve("Key4");
> + assertTrue(tmp.getKey().equals("Key4"));
> + }
> +
> + public void testRetrieve() {
> + assertNull(mgr.retrieve("Key5"));
> + mgr.insert(new StorageMapBean("Key5", 1004, "SeqId5"));
> + assertNotNull(mgr.retrieve("Key5"));
> + }
> +
> + public void testUpdate() {
> + StorageMapBean bean = new StorageMapBean("Key6", 1006, "SeqId6");
> + mgr.insert(bean);
> + bean.setMsgNo(1007);
> + StorageMapBean tmp = mgr.retrieve("Key6");
> + assertTrue(tmp.getMsgNo() == 1007);
> + }
> +}
>
>
--------------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: sandesha-dev-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org