Author: thilina
Date: Sat May 13 19:55:47 2006
New Revision: 406208

URL: http://svn.apache.org/viewcvs?rev=406208&view=rev
Log:
Updating the tests to reflect the latest changes
added a seperate test methode to the integration test to test the sync 
behaviour...
But cannot run both tests due to "engaging module already engaged exception"

Modified:
    
webservices/kandula/trunk/java/test/org/apache/kandula/context/ActivityContextTest.java
    
webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
    
webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java
    
webservices/kandula/trunk/java/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
    
webservices/kandula/trunk/java/test/org/apache/kandula/integration/DummyResource.java
    
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoService.java
    
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoServiceStub.java

Modified: 
webservices/kandula/trunk/java/test/org/apache/kandula/context/ActivityContextTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/test/org/apache/kandula/context/ActivityContextTest.java?rev=406208&r1=406207&r2=406208&view=diff
==============================================================================
--- 
webservices/kandula/trunk/java/test/org/apache/kandula/context/ActivityContextTest.java
 (original)
+++ 
webservices/kandula/trunk/java/test/org/apache/kandula/context/ActivityContextTest.java
 Sat May 13 19:55:47 2006
@@ -24,27 +24,27 @@
 public class ActivityContextTest extends TestCase {
 
        public void testGetActivityID() {
-               //TODO Implement getActivityID().
+               // TODO Implement getActivityID().
        }
 
        public void testAddParticipant() {
-               //TODO Implement addParticipant().
+               // TODO Implement addParticipant().
        }
 
        public void testGetStatus() {
-               //TODO Implement getStatus().
+               // TODO Implement getStatus().
        }
 
        public void testSetStatus() {
-               //TODO Implement setStatus().
+               // TODO Implement setStatus().
        }
 
        public void testLock() {
-               //TODO Implement lock().
+               // TODO Implement lock().
        }
 
        public void testUnlock() {
-               //TODO Implement unlock().
+               // TODO Implement unlock().
        }
 
 }

Modified: 
webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/CoordinatorImplTest.java?rev=406208&r1=406207&r2=406208&view=diff
==============================================================================
--- 
webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
 (original)
+++ 
webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
 Sat May 13 19:55:47 2006
@@ -83,7 +83,7 @@
        }
 
        public void testRegisterParticipant() {
-               //TODO Implement registerParticipant().
+               // TODO Implement registerParticipant().
        }
 
 }

Modified: 
webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java?rev=406208&r1=406207&r2=406208&view=diff
==============================================================================
--- 
webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java
 (original)
+++ 
webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java
 Sat May 13 19:55:47 2006
@@ -40,11 +40,11 @@
        }
 
        public void testCommitOperation() {
-               //TODO Implement commitOperation().
+               // TODO Implement commitOperation().
        }
 
        public void testRollbackOperation() {
-               //TODO Implement rollbackOperation().
+               // TODO Implement rollbackOperation().
        }
 
 }

Modified: 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/test/org/apache/kandula/integration/CreateCoordinationContextTest.java?rev=406208&r1=406207&r2=406208&view=diff
==============================================================================
--- 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
 (original)
+++ 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
 Sat May 13 19:55:47 2006
@@ -24,7 +24,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
@@ -36,18 +35,28 @@
 
        private String repository = "target/testing-repository";
 
+       private KandulaDemoServiceStub stub;
+
        private SimpleHTTPServer server;
 
-       public CreateCoordinationContextTest() {
+       public CreateCoordinationContextTest() throws Exception {
                super(CreateCoordinationContextTest.class.getName());
+               stub = new KandulaDemoServiceStub(
+                               "target/initiator-repository",
+                               new EndpointReference(
+                                               
"http://localhost:8081/axis2/services/KandulaDemoService";));
        }
 
-       public CreateCoordinationContextTest(String testName) {
+       public CreateCoordinationContextTest(String testName) throws Exception {
                super(testName);
+               stub = new KandulaDemoServiceStub(
+                               "target/initiator-repository",
+                               new EndpointReference(
+                                               
"http://localhost:8081/axis2/services/KandulaDemoService";));
        }
 
        protected void setUp() throws Exception {
-                               File file = new File(repository);
+               File file = new File(repository);
                File configFile = new File(repository + "/axis2.xml");
                if (!file.exists()) {
                        throw new Exception("repository directory "
@@ -65,37 +74,39 @@
                } finally {
 
                }
-
-               try {
-                       Thread.sleep(2000);
-               } catch (InterruptedException e1) {
-                       throw new AxisFault("Thread interuptted", e1);
-               }
-
        }
 
        protected void tearDown() throws Exception {
                server.stop();
        }
 
-       public void testEchoXMLSync() throws Exception {
+       public void testEchoXMLASync() throws Exception {
                TransactionManager tm = new TransactionManager(
                                Constants.WS_AT,
                                new EndpointReference(
-                                               
"http://localhost:8082/axis2/services/ActivationCoordinator";));
-
-               
tm.begin("target/initiator-repository","target/initiator-repository/axis2.xml");
-               // Thread.sleep(10000);
-               KandulaDemoServiceStub stub = new KandulaDemoServiceStub(
-                               "target/initiator-repository",
-                               new EndpointReference(
-                                               
"http://131.107.72.15:8085/Transactions_Service_Indigo/TransactionalService.svc";));
-               stub.creditOperation();
-               // try{
+                                               
"http://localhost:8081/axis2/services/ActivationCoordinator";));
+               tm.begin("target/initiator-repository",
+                               "target/initiator-repository/axis2.xml", true);
+               try {
+                       stub.creditOperation();
+               } catch (Exception e) {
+                       tm.rollback();
+               }
                tm.commit();
-               // }catch (Exception e)
-               // {
-               // e.printStackTrace();
-               // }
        }
+
+//     public void testEchoXMLSync() throws Exception {
+//             TransactionManager tm = new TransactionManager(
+//                             Constants.WS_AT,
+//                             new EndpointReference(
+//                                             
"http://localhost:8082/axis2/services/ActivationCoordinator";));
+//             tm.begin("target/initiator-repository",
+//                             "target/initiator-repository/axis2.xml", false);
+//             try {
+//                     stub.creditOperation();
+//             } catch (Exception e) {
+//                     tm.rollback();
+//             }
+//             tm.commit();
+//     }
 }

Modified: 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/DummyResource.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/test/org/apache/kandula/integration/DummyResource.java?rev=406208&r1=406207&r2=406208&view=diff
==============================================================================
--- 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/DummyResource.java
 (original)
+++ 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/DummyResource.java
 Sat May 13 19:55:47 2006
@@ -26,7 +26,7 @@
 public class DummyResource implements KandulaResource {
 
        /**
-        *  
+        * 
         */
        public DummyResource() {
                super();

Modified: 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoService.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoService.java?rev=406208&r1=406207&r2=406208&view=diff
==============================================================================
--- 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoService.java
 (original)
+++ 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoService.java
 Sat May 13 19:55:47 2006
@@ -24,7 +24,7 @@
 public class KandulaDemoService {
 
        /**
-        *  
+        * 
         */
        public KandulaDemoService() {
 

Modified: 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
URL: 
http://svn.apache.org/viewcvs/webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoServiceStub.java?rev=406208&r1=406207&r2=406208&view=diff
==============================================================================
--- 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
 (original)
+++ 
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
 Sat May 13 19:55:47 2006
@@ -21,6 +21,7 @@
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.OperationClient;
@@ -78,17 +79,15 @@
                configurationContext = ConfigurationContextFactory
                                
.createConfigurationContextFromFileSystem(axis2Home, axis2Home
                                                + "/axis2.xml");
-               // configurationContext.getAxisConfiguration().engageModule(new
-               // QName("addressing"));
                
configurationContext.getAxisConfiguration().addService(_service);
                ServiceGroupContext sgc = new ServiceGroupContext(
-                               this.configurationContext, 
(AxisServiceGroup)_service
+                               this.configurationContext, (AxisServiceGroup) 
_service
                                                .getParent());
                this.serviceContext = new ServiceContext(_service, sgc);
 
        }
 
-       public void creditOperation() throws IOException {
+       public void creditOperation() throws IOException, AxisFault{
 
                Options options = new Options();
                MessageContext messageContext = new MessageContext();
@@ -99,9 +98,9 @@
 
                // _service.engageModule("addressing");
 
-               
options.setAction("http://tempuri.org/ITransactionalService/Commit";);
+               options.setAction("creditOperation");
                options.setTo(this.toEPR);
-               
+
                // messageSender
                // 
.setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
                OperationClient client = 
operations[0].createClient(serviceContext,



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to