Added: webservices/site/trunk/targets/sandesha/sandesha2/task-list.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/task-list.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/task-list.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/task-list.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,10 @@ +Sandesha2 - Articles

Todos

+ + + +
ClassClass Todos CountMethod with Todos
No class or method todo found

\ No newline at end of file Added: webservices/site/trunk/targets/sandesha/sandesha2/team-list.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/team-list.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/team-list.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/team-list.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,54 @@ +Sandesha2 - Project Team

The Team

+ A successful project requires many people to play many roles. + Some members write code or documentation, while others are + valuable as testers, submitting patches and suggestions. +

+ The team is comprised of Members + and Contributors. Members + have direct access to the source of a project and actively + evolve the code-base. Contributors improve the project + through submission of patches and suggestions to the Members. + The number of Contributors to the project is unbounded. + Get involved today. All contributions to the project are + greatly appreciated. +

Members

+ The following is a list of developers with commit privileges that have + directly contributed to the project in one way or another. +

+ + + + + + +
NameIdEmailOrganizationRolesTZ OffsetTime
Sanjiva Weerawaranasanjivasanjiva@opensource.lk + + Unknown
Davanum Srinivasdimsdims@yahoo.com + + Unknown
Jaliya Ekanayakejaliyajaliya@opensource.lk + + Unknown
Chamikara Jayalathchamikarachamikaramj@gmail.com + + Unknown

Contributors

+ There are no contributors listed for this project. Please check + back again later. +


\ No newline at end of file Added: webservices/site/trunk/targets/sandesha/sandesha2/userGuide.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/userGuide.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/userGuide.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/userGuide.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,87 @@ +Sandesha2 - Sandesha2 User Guide

Sandesha2 User Guide

This document introduces you to Apache Sandesha2. Sandesha2 is the +WS-ReliableMessaging implementation for Axis2. With Sandesha2 you can host +some reliable web services or interact with reliable web services hosted by +others.

Using Sandesha2 in the server side

First lets look at how to use Sandesha2 in the server side.

You can set up Sandesha2 for the server side in three steps.

    +
  1. Download and deploy axis2(please see Axis2 user guide for more + details).
  2. +
  3. Add a user phase called RMPhase to all four flows of axis2.xml.
  4. +
  5. Download latest Sandesha2 distribution and add Sandesha2 mar file to + <AXIS2_WEBAPP>\WEB_INF\modules directory.
  6. +
  7. Add sandesha2.properties file to the + <AXIS2_WEBAPP>\WEB_INF\classes directory.
  8. +

Now your Sandesha2 module is setup and deployed.

To host reliable web service you have to create a service archive (aar) +file with the given details (please see Axis2 user guide for more details on +creating aar files).

Add a module reference for Sandesha2 to the services.xml (within the aar +file) as given below.

+
<service name="OneWayService">
+<module ref="<Sandesha2 module name>"/>
+.......................
+<!-- Your operation definitions and other stuff
+........................
+</service>
+
+
+

Create the service archieve file.

Deploy it by dropping it to <AXIS2_WEBAPP>/WEB-INF/services +directory.

Now your service is deployed with reliable messaging support.

Using Sandesha2 in the client side

Add Sandesha2 module in the way you normally add a module to the Axis2 +client side (see Axis2 user guide for more details). Following scenarios will +explain you how to write the client code.

Basic scenarios

Sample RM enabled client code for a one way service call.

+
MessageSender sender = new MessageSender (AXIS2_CLIENT_PATH);
+sender.engageModule(new QName ("<Sandesha2 module name>"));
+sender.setTo(new EndpointReference(toEPR));
+sender.set(MessageContextConstants.TRANSPORT_URL,toEPR);
+sender.send("ping",getPingOMBlock("ping1"));
+sender.send("ping",getPingOMBlock("ping2"));
+sender.set(org.apache.sandesha2.Constants.LAST_MESSAGE, "true");
+sender.send("ping",getPingOMBlock("ping3"));
+

There are only two difference here from your normal client code.

First you have to engage the sandesha module as given in the line 2.

Before the last message you must set the last message property, which is +given in the line 7.

Simple RM enabled client code for a request reply service call.

First thing to remember is that you are not able to get synchronous +(single channel) responses with Sandesha2. Because of this if you expect +response message, you must have a return endpoint accessible from the server +side. But making two channel blocking invocations is perfectly valid. But +please make sure tht you have set a suitable time out interval within your +call object.

Here is a code sample for this scenario.

+
Call call = new Call(AXIS2_CLIENT_PATH);
+call.engageModule(new QName("<Sandesha2 module name>"));
+call.setTo(new EndpointReference(toEPR));
+call.setTransportInfo(org.apache.axis2.Constants.TRANSPORT_HTTP,org.apache.axis2.Constants.TRANSPORT_HTTP,true);
+Callback callback1 = new TestCallback ("Callback 1");
+call.invokeNonBlocking("echoString",getEchoOMBlock("echo1"),callback1);
+Callback callback2 = new TestCallback ("Callback 2");
+call.invokeNonBlocking("echoString",getEchoOMBlock("echo2"),callback2);
+call.set(Constants.LAST_MESSAGE, "true");
+Callback callback3 = new TestCallback ("Callback 3");
+call.invokeNonBlocking("echoString",getEchoOMBlock("echo3"),callback3);
+

Here also the only difference from a normal client code is addition of the +Sandesha2 module reference and setting the last message property.

Advance scenarios

Getting acknowledgements and faults to a given endpoint.

In the dafault configuration response path for acknowledgements and faults +related to a sequene is the anonymous endpoint. Because of this for example +HTTP transport will send acknowledgements and faults in the HTTP response. If +you want to avaoid this and if you want to get acknowledgements and faults to +a different endpoing add following part to the client code before doing any +incovation.

+
sender.set(Constants.AcksTo,<endpoint>); //example endpoint - http://tempuri.org/acks.
+
+
+

Managing sequences.

I the default behavious Sandesha 2 assumes that messages going to the same +endpoing should go in the same RM sequence. If you invoke two endpoints they +will go in two sequences. If you want you can tell sandesha2 to start two +sequences for the same endpoint as well. To do this you have to set a +property called Sequence Key.

+
call.set(Constants.SEQUENCE_KEY,<a string to identify the sequence>);
+
+
+

If the sequence key is different Sandesha2 will send messages in two +sequences even if they are sent to the same endpoint.

Offering a sequence ID for the response sequence.

This is a concept of reliable messaging which may not be very useful to +you as a user. Here what you do is offering a sequene ID for the sequence to +be created in the response side withing the first Create Sequence Request +message itself. with this you can avoid sending of a extra Create Sequence +message from the server to the client. To do this add following to the client +code.

+
call.set(Constants.OFFERED_SEQUENCE_ID,<new uuid>);
+
+
+


\ No newline at end of file Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/allclasses-frame.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/allclasses-frame.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/allclasses-frame.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/allclasses-frame.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,79 @@ + + + + + + + All Classes + + + + +

All Classes

+ + + + + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/index.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/index.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/index.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/index.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,22 @@ + + + + + + Apache Sandesha2 0.9 Reference + + + + + + + + + + <h1>Frame Alert</h1> + <p> + You don't have frames. Go + <a href="overview-summary.html">here</a> + </p> + + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/DuplicateMessageTest.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/DuplicateMessageTest.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/DuplicateMessageTest.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/DuplicateMessageTest.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,35 @@ + + + +DuplicateMessageTest xref + + + +
+
+1   /*
+2    * Created on Nov 13, 2005
+3    *
+4    * TODO To change the template for this generated file go to
+5    * Window - Preferences - Java - Code Style - Code Templates
+6    */
+7   package org.apache.sandesha2;
+8   
+9   import junit.framework.TestCase;
+10  
+11  /***
+12   * @author chamikara
+13   *
+14   * TODO To change the template for this generated type comment go to
+15   * Window - Preferences - Java - Code Style - Code Templates
+16   */
+17  public class DuplicateMessageTest extends TestCase {
+18  
+19  	public void testDuplicateMessage () {
+20  		
+21  	}
+22  }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/PorpertyLoaderTest.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/PorpertyLoaderTest.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/PorpertyLoaderTest.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/PorpertyLoaderTest.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,93 @@ + + + +PorpertyLoaderTest xref + + + +
+
+1   /*
+2    * Copyright 2004,2005 The Apache Software Foundation.
+3    *
+4    * Licensed under the Apache License, Version 2.0 (the "License");
+5    * you may not use this file except in compliance with the License.
+6    * You may obtain a copy of the License at
+7    *
+8    *      http://www.apache.org/licenses/LICENSE-2.0
+9    *
+10   * Unless required by applicable law or agreed to in writing, software
+11   * distributed under the License is distributed on an "AS IS" BASIS,
+12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+13   * See the License for the specific language governing permissions and
+14   * limitations under the License.
+15   */
+16  
+17  package org.apache.sandesha2;
+18  
+19  import java.io.File;
+20  import java.io.FileInputStream;
+21  import java.io.FileNotFoundException;
+22  import java.io.IOException;
+23  import java.io.InputStream;
+24  
+25  import org.apache.sandesha2.util.PropertyManager;
+26  
+27  import junit.framework.TestCase;
+28  
+29  /***
+30   * @author Chamikara Jayalath <chamikaramj@gmail.com>
+31   */
+32  
+33  public class PorpertyLoaderTest extends TestCase {
+34  	
+35  	PropertyManager manager = null;
+36  	
+37  	public void setUp () {
+38  		manager = PropertyManager.getInstance();
+39  		String fileName = "./test/resources/sandesha2.properties";
+40  		File file= new File (fileName);
+41  		if (!file.exists()) {
+42  			fail("'test/resources/sandesha2.prop' not found");
+43  		}
+44  		
+45  		try {
+46  			InputStream in = new FileInputStream (file);
+47  			manager.reload(in);
+48  			in.close();
+49  		} catch (Exception e) {
+50  			fail (e.getMessage());
+51  		}
+52  		
+53  	}
+54  	
+55  	public void testRetransmissionInterval () {
+56  		long value = manager.getRetransmissionInterval();
+57  		assertEquals(value,20000);
+58  	}
+59  	
+60  	public void testExponentialBackOff () {
+61  		boolean value = manager.isExponentialBackoff();
+62  		assertEquals(value,false);
+63  	}
+64  	
+65  	public void testAcknowledgementInterval () {
+66  		long value = manager.getAcknowledgementInterval();
+67  		assertEquals(value,8000);
+68  	}
+69  	
+70  	public void testInactivityTImeout () {
+71  		long value = manager.getInactivityTimeout();
+72  		assertEquals(value,(60*60*3*1000));
+73  	}
+74  	
+75  	
+76  	public void testStorageManager () {
+77  		String storageMgr = manager.getStorageManagerClass();
+78  		assertEquals(storageMgr,"org.apache.sandesha2.storage.inmemory.InMemoryStorageManager1");
+79  	}
+80  }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/RMPolicyTest.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/RMPolicyTest.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/RMPolicyTest.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/RMPolicyTest.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,36 @@ + + + +RMPolicyTest xref + + + +
+
+1   /*
+2    * Created on Nov 13, 2005
+3    *
+4    * TODO To change the template for this generated file go to
+5    * Window - Preferences - Java - Code Style - Code Templates
+6    */
+7   package org.apache.sandesha2;
+8   
+9   import junit.framework.TestCase;
+10  
+11  /***
+12   * @author chamikara
+13   *
+14   * TODO To change the template for this generated type comment go to
+15   * Window - Preferences - Java - Code Style - Code Templates
+16   */
+17  public class RMPolicyTest extends TestCase {
+18  
+19  	public void testRMPolicy () {
+20  		
+21  	}
+22  	
+23  }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/RetransmissionTest.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/RetransmissionTest.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/RetransmissionTest.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/RetransmissionTest.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,35 @@ + + + +RetransmissionTest xref + + + +
+
+1   /*
+2    * Created on Nov 13, 2005
+3    *
+4    * TODO To change the template for this generated file go to
+5    * Window - Preferences - Java - Code Style - Code Templates
+6    */
+7   package org.apache.sandesha2;
+8   
+9   import junit.framework.TestCase;
+10  
+11  /***
+12   * @author chamikara
+13   *
+14   * TODO To change the template for this generated type comment go to
+15   * Window - Preferences - Java - Code Style - Code Templates
+16   */
+17  public class RetransmissionTest extends TestCase {
+18  
+19  	public void testRetransmission () {
+20  		
+21  	}
+22  }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/SandeshaTestCase.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/SandeshaTestCase.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/SandeshaTestCase.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/SandeshaTestCase.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,100 @@ + + + +SandeshaTestCase xref + + + +
+
+1   package org.apache.sandesha2;
+2   
+3   import junit.framework.TestCase;
+4   import org.apache.axis2.context.MessageContext;
+5   import org.apache.axis2.context.ConfigurationContext;
+6   import org.apache.axis2.engine.AxisConfiguration;
+7   import org.apache.axis2.engine.AxisConfigurationImpl;
+8   import org.apache.axis2.soap.SOAPEnvelope;
+9   import org.apache.axis2.om.OMAbstractFactory;
+10  import org.apache.axis2.om.OMXMLParserWrapper;
+11  import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+12  
+13  import javax.xml.stream.XMLStreamReader;
+14  import javax.xml.stream.XMLInputFactory;
+15  import javax.xml.stream.XMLStreamException;
+16  import java.io.*;
+17  /*
+18   * Copyright 2004,2005 The Apache Software Foundation.
+19   *
+20   * Licensed under the Apache License, Version 2.0 (the "License");
+21   * you may not use this file except in compliance with the License.
+22   * You may obtain a copy of the License at
+23   *
+24   *      http://www.apache.org/licenses/LICENSE-2.0
+25   *
+26   * Unless required by applicable law or agreed to in writing, software
+27   * distributed under the License is distributed on an "AS IS" BASIS,
+28   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+29   * See the License for the specific language governing permissions and
+30   * limitations under the License.
+31   */
+32  
+33  public class SandeshaTestCase extends TestCase {
+34      String resourceDir = "test-resources";
+35  
+36      public SandeshaTestCase(String name) {
+37          super(name);
+38          File baseDir = new File("");
+39          String testRource = baseDir.getAbsolutePath() + File.separator + "test-resources";
+40          resourceDir = new File(testRource).getPath();
+41  
+42      }
+43  
+44      protected InputStreamReader getResource(String relativePath, String resourceName) {
+45          String resourceFile = resourceDir + relativePath + File.separator + resourceName;
+46          String file = new File("/home/sanka/sandesha2-src/trunk/test-resources/CreateSequence.xml").getPath();
+47  
+48          try {
+49              FileReader reader = new FileReader(resourceFile);
+50              return reader;
+51          } catch (FileNotFoundException e) {
+52              throw new RuntimeException("cannot load the test-resource", e);
+53          }
+54      }
+55  
+56      protected SOAPEnvelope getSOAPEnvelope() {
+57          return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+58      }
+59  
+60      protected SOAPEnvelope getSOAPEnvelope(String relativePath, String resourceName) {
+61          try {
+62              XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(
+63                      getResource(relativePath, resourceName));
+64              OMXMLParserWrapper wrapper = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+65                      OMAbstractFactory.getSOAP11Factory(), reader);
+66              return (SOAPEnvelope) wrapper.getDocumentElement();
+67  
+68          } catch (XMLStreamException e) {
+69              throw new RuntimeException(e);
+70          }
+71      }
+72  
+73      protected SOAPEnvelope getEmptySOAPEnvelope() {
+74          return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+75      }
+76  
+77  
+78      private MessageContext getMessageContext() throws Exception{
+79          AxisConfiguration axisConfig = new AxisConfigurationImpl();
+80          ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
+81          MessageContext msgCtx = new MessageContext(configCtx);
+82          return msgCtx;
+83  
+84      }
+85  
+86  
+87  }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/package-frame.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/package-frame.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/package-frame.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/package-frame.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,43 @@ + + + + + + + Apache Sandesha2 0.9 Reference Package org.apache.sandesha2 + + + + +

+ org.apache.sandesha2 +

+ +

Classes

+ + + + + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/package-summary.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/package-summary.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/package-summary.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/package-summary.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + Apache Sandesha2 0.9 Reference Package + + + + + + + + +
+ +
+
+ +
+ + + + + +

Package org.apache.sandesha2

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Class Summary
+ DuplicateMessageTest +
+ PorpertyLoaderTest +
+ RMPolicyTest +
+ RetransmissionTest +
+ SandeshaTestCase +
+ + + + + +
+ +
+
+ +
+ + + + + + +
+ + Copyright © 2005 Apache Web Services. All Rights Reserved. + + + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/storage/CreateSeqBeanMgrTest.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,109 @@ + + + +CreateSeqBeanMgrTest xref + + + +
+
+1   package org.apache.sandesha2.storage;
+2   
+3   import org.apache.sandesha2.storage.beanmanagers.CreateSeqBeanMgr;
+4   import org.apache.sandesha2.storage.beans.CreateSeqBean;
+5   import org.apache.sandesha2.util.SandeshaUtil;
+6   import org.apache.sandesha2.SandeshaTestCase;
+7   import org.apache.axis2.engine.AxisConfiguration;
+8   import org.apache.axis2.engine.AxisConfigurationImpl;
+9   import org.apache.axis2.context.ConfigurationContext;
+10  
+11  import java.util.Iterator;
+12  /*
+13   * Copyright 2004,2005 The Apache Software Foundation.
+14   *
+15   * Licensed under the Apache License, Version 2.0 (the "License");
+16   * you may not use this file except in compliance with the License.
+17   * You may obtain a copy of the License at
+18   *
+19   *      http://www.apache.org/licenses/LICENSE-2.0
+20   *
+21   * Unless required by applicable law or agreed to in writing, software
+22   * distributed under the License is distributed on an "AS IS" BASIS,
+23   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+24   * See the License for the specific language governing permissions and
+25   * limitations under the License.
+26   */
+27  
+28  public class CreateSeqBeanMgrTest extends SandeshaTestCase {
+29      private CreateSeqBeanMgr mgr;
+30  
+31      public CreateSeqBeanMgrTest() {
+32          super("CreateSeqBeanMgrTest");
+33      }
+34  
+35      public void setUp() throws Exception {
+36          AxisConfiguration axisConfig =  new AxisConfigurationImpl();
+37          ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
+38  
+39          StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx);
+40          mgr = storageManager.getCreateSeqBeanMgr();
+41      }
+42  
+43      public void testDelete() {
+44          mgr.insert(new CreateSeqBean("TmpSeqId1", "CreateSeqMsgId1", "SeqId1"));
+45          mgr.delete("CreateSeqMsgId1");
+46          assertNull(mgr.retrieve("CreateSeqMsgId1"));
+47      }
+48  
+49      public void testFind() {
+50          mgr.insert(new CreateSeqBean("TmpSeqId2", "CreateSeqMsgId2", "SeqId2"));
+51          mgr.insert(new CreateSeqBean("TmpSeqId2", "CreateSeqMsgId3", "SeqId3"));
+52  
+53          CreateSeqBean target = new CreateSeqBean();
+54          target.setInternalSequenceId("TmpSeqId2");
+55  
+56          Iterator iter = mgr.find(target).iterator();
+57          CreateSeqBean tmp = (CreateSeqBean) iter.next();
+58          if (tmp.getCreateSeqMsgId().equals("CreateSeqMsgId1")) {
+59              tmp = (CreateSeqBean) iter.next();
+60              assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId2"));
+61  
+62          }   else {
+63              tmp = (CreateSeqBean) iter.next();
+64              assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId3"));
+65          }
+66      }
+67  
+68      public void testInsert() {
+69          CreateSeqBean bean = new CreateSeqBean("TmpSeqId4", "CreateSeqMsgId4", "SeqId4");
+70          mgr.insert(bean);
+71          CreateSeqBean tmpbean = mgr.retrieve("CreateSeqMsgId4");
+72          assertTrue(tmpbean.getCreateSeqMsgId().equals("CreateSeqMsgId4"));
+73          assertTrue(tmpbean.getSequenceId().equals("SeqId4"));
+74          assertTrue(tmpbean.getInternalSequenceId().equals("TmpSeqId4"));
+75      }
+76  
+77  
+78      public void testRetrieve() {
+79          assertNull(mgr.retrieve("CreateSeqMsgId5"));
+80  
+81          CreateSeqBean bean = new CreateSeqBean("TmpSeqId5", "CreateSeqMsgId5", "SeqId5");
+82          mgr.insert(bean);
+83          CreateSeqBean tmp = mgr.retrieve("CreateSeqMsgId5");
+84          assertTrue(tmp.getCreateSeqMsgId().equals("CreateSeqMsgId5"));
+85      }
+86  
+87      public void testUpdate() {
+88  
+89          CreateSeqBean bean = new CreateSeqBean("TmpSeqId6", "CreateSeqMsgId6", "SeqId6");
+90          mgr.insert(bean);
+91          bean.setInternalSequenceId("TmpSeqId7");
+92          mgr.update(bean);
+93          CreateSeqBean tmp = mgr.retrieve("CreateSeqMsgId6");
+94          assertTrue(tmp.getInternalSequenceId().equals("TmpSeqId7"));
+95      }
+96  }
+
+
+ + Added: webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.html URL: http://svn.apache.org/viewcvs/webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.html?rev=349924&view=auto ============================================================================== --- webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.html (added) +++ webservices/site/trunk/targets/sandesha/sandesha2/xref-test/org/apache/sandesha2/storage/NextMsgBeanMgrTest.html Wed Nov 30 03:11:01 2005 @@ -0,0 +1,106 @@ + + + +NextMsgBeanMgrTest xref + + + +
+
+1   package org.apache.sandesha2.storage;
+2   
+3   import org.apache.sandesha2.storage.beanmanagers.NextMsgBeanMgr;
+4   import org.apache.sandesha2.storage.beans.NextMsgBean;
+5   import org.apache.sandesha2.util.SandeshaUtil;
+6   import org.apache.sandesha2.SandeshaTestCase;
+7   import org.apache.axis2.engine.AxisConfiguration;
+8   import org.apache.axis2.engine.AxisConfigurationImpl;
+9   import org.apache.axis2.context.ConfigurationContext;
+10  
+11  import java.util.Iterator;
+12  /*
+13   * Copyright 2004,2005 The Apache Software Foundation.
+14   *
+15   * Licensed under the Apache License, Version 2.0 (the "License");
+16   * you may not use this file except in compliance with the License.
+17   * You may obtain a copy of the License at
+18   *
+19   *      http://www.apache.org/licenses/LICENSE-2.0
+20   *
+21   * Unless required by applicable law or agreed to in writing, software
+22   * distributed under the License is distributed on an "AS IS" BASIS,
+23   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+24   * See the License for the specific language governing permissions and
+25   * limitations under the License.
+26   */
+27  
+28  public class NextMsgBeanMgrTest extends SandeshaTestCase {
+29      private NextMsgBeanMgr mgr;
+30  
+31      public NextMsgBeanMgrTest(String name) {
+32          super(name);
+33      }
+34  
+35      public void setUp() throws Exception {
+36          AxisConfiguration axisConfig = new AxisConfigurationImpl();
+37          ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
+38          StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx);
+39          mgr = storageManager.getNextMsgBeanMgr();
+40  
+41      }
+42  
+43      public void testDelete() {
+44          mgr.insert(new NextMsgBean("SeqId1", 1001));
+45          mgr.delete("SeqId1");
+46          assertNull(mgr.retrieve("SeqId1"));
+47      }
+48  
+49      public void testFind() {
+50          mgr.insert(new NextMsgBean("SeqId2", 1002));
+51          mgr.insert(new NextMsgBean("SeqId3", 1002));
+52  
+53          NextMsgBean target = new NextMsgBean();
+54          target.setNextMsgNoToProcess(1002);
+55  
+56          Iterator iterator = mgr.find(target).iterator();
+57          NextMsgBean tmp = (NextMsgBean) iterator.next();
+58  
+59          if (tmp.getSequenceId().equals("SeqId2")) {
+60              tmp = (NextMsgBean) iterator.next();
+61              tmp.getSequenceId().equals("SeqId3");
+62          } else {
+63              tmp = (NextMsgBean) iterator.next();
+64              tmp.getSequenceId().equals("SeqId2");
+65          }
+66  
+67      }
+68  
+69      public void testInsert() {
+70          NextMsgBean bean = new NextMsgBean("SeqId4", 1004);
+71          mgr.insert(bean);
+72          NextMsgBean tmp = mgr.retrieve("SeqId4");
+73          assertTrue(tmp.getNextMsgNoToProcess() == 1004);
+74      }
+75  
+76      public void testRetrieve() {
+77          assertNull(mgr.retrieve("SeqId5"));
+78          mgr.insert(new NextMsgBean("SeqId5", 1005));
+79  
+80          NextMsgBean tmp = mgr.retrieve("SeqId5");
+81          assertTrue(tmp.getNextMsgNoToProcess() == 1005);
+82      }
+83  
+84      public void testUpdate() {
+85          NextMsgBean bean = new NextMsgBean("SeqId6", 1006);
+86          mgr.insert(bean);
+87          bean.setNextMsgNoToProcess(1007);
+88          mgr.update(bean);
+89          NextMsgBean tmp = mgr.retrieve("SeqId6");
+90          assertTrue(tmp.getNextMsgNoToProcess() ==1007);
+91      }
+92  
+93  }
+
+
+ +