You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kandula-dev@ws.apache.org by th...@apache.org on 2006/07/23 07:49:40 UTC
svn commit: r424679 - in /webservices/kandula/trunk/java/test: interop/
interop/META-INF/ org/apache/kandula/context/
org/apache/kandula/coordinator/ org/apache/kandula/coordinator/at/
org/apache/kandula/integration/
Author: thilina
Date: Sat Jul 22 22:49:39 2006
New Revision: 424679
URL: http://svn.apache.org/viewvc?rev=424679&view=rev
Log:
New interop testing code
Added:
webservices/kandula/trunk/java/test/interop/
webservices/kandula/trunk/java/test/interop/CommitTestResource.java
webservices/kandula/trunk/java/test/interop/DurableReadOnlyResource.java
webservices/kandula/trunk/java/test/interop/InteropTest.java
webservices/kandula/trunk/java/test/interop/META-INF/
webservices/kandula/trunk/java/test/interop/META-INF/services.xml
webservices/kandula/trunk/java/test/interop/Phase2RollbackTestVolatileResource.java
webservices/kandula/trunk/java/test/interop/RollbackTestResource.java
webservices/kandula/trunk/java/test/interop/TestServiceStub.java
webservices/kandula/trunk/java/test/interop/VolatileAndDurableTestVolatileResource.java
webservices/kandula/trunk/java/test/interop/VolatileReadOnlyResource.java
webservices/kandula/trunk/java/test/interop/testService.java
webservices/kandula/trunk/java/test/org/apache/kandula/integration/CompletionCommitTest.java
Removed:
webservices/kandula/trunk/java/test/org/apache/kandula/integration/CreateCoordinationContextTest.java
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/KandulaDemoService.java
webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
Added: webservices/kandula/trunk/java/test/interop/CommitTestResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/CommitTestResource.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/CommitTestResource.java (added)
+++ webservices/kandula/trunk/java/test/interop/CommitTestResource.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 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.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class CommitTestResource implements KandulaResource {
+
+ /**
+ *
+ */
+ public CommitTestResource() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public boolean commit() {
+ System.out.println("Commited");
+ return true;
+ }
+
+ public void rollback() {
+ System.out.println("rollback");
+
+ }
+
+ public Vote prepare() {
+ return Vote.PREPARED;
+ }
+
+ public String getProtocol() {
+ return Constants.WS_AT_DURABLE2PC;
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/test/interop/DurableReadOnlyResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/DurableReadOnlyResource.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/DurableReadOnlyResource.java (added)
+++ webservices/kandula/trunk/java/test/interop/DurableReadOnlyResource.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 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.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class DurableReadOnlyResource implements KandulaResource {
+
+ /**
+ *
+ */
+ public DurableReadOnlyResource() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public boolean commit() {
+ System.out.println("Commited");
+ return true;
+ }
+
+ public void rollback() {
+ System.out.println("rollback");
+ }
+
+ public Vote prepare() {
+ return Vote.READ_ONLY;
+ }
+
+ public String getProtocol() {
+ return Constants.WS_AT_DURABLE2PC;
+ }
+
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/test/interop/InteropTest.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/InteropTest.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/InteropTest.java (added)
+++ webservices/kandula/trunk/java/test/interop/InteropTest.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+package interop;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
+ */
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.Constants;
+import org.apache.kandula.initiator.TransactionManager;
+
+public class InteropTest extends TestCase {
+
+ EndpointReference coordinator = new EndpointReference(
+ "http://localhost:8085/axis2/services/ActivationCoordinator");
+
+ String axis2Repo = "target/initiator-repository";
+
+ String axis2XML = "target/initiator-repository/axis2.xml";
+
+ TestServiceStub stub = new TestServiceStub("target/initiator-repository",
+ new EndpointReference(
+ "http://localhost:8085/axis2/services/TestService"));
+
+ public InteropTest() throws Exception {
+ super(InteropTest.class.getName());
+ }
+
+ public InteropTest(String testName) throws Exception {
+ super(testName);
+ }
+
+ public void testCompletionCommit() throws Exception {
+ TransactionManager tm = new TransactionManager(Constants.WS_AT,
+ coordinator, axis2Repo, axis2XML);
+ tm.begin(true);
+ tm.commit();
+ }
+
+ public void testCompletionRollback() throws Exception {
+ TransactionManager tm = new TransactionManager(Constants.WS_AT,
+ coordinator, axis2Repo, axis2XML);
+ tm.begin(true);
+ tm.rollback();
+ }
+
+ public void testCommit() throws Exception {
+ TransactionManager tm = new TransactionManager(Constants.WS_AT,
+ coordinator, axis2Repo, axis2XML);
+ tm.begin(true);
+ stub.commitOperation();
+ tm.commit();
+ }
+
+ public void testRollback() throws Exception {
+ TransactionManager tm = new TransactionManager(Constants.WS_AT,
+ coordinator, axis2Repo, axis2XML);
+ tm.begin(true);
+ stub.rollbackOperation();
+ tm.rollback();
+ }
+
+ public void testPhase2Rollback() throws Exception {
+ TransactionManager tm = new TransactionManager(Constants.WS_AT,
+ coordinator, axis2Repo, axis2XML);
+ tm.begin(true);
+ stub.phase2RollbackOperation();
+
+ boolean done = false;
+ try {
+ tm.commit();
+ } catch (Exception e) {
+ done = true;
+ }
+ assertTrue(done);
+ }
+
+ public void testReadonly() throws Exception {
+ TransactionManager tm = new TransactionManager(Constants.WS_AT,
+ coordinator, axis2Repo, axis2XML);
+ tm.begin(true);
+ stub.readonlyOperation();
+ tm.commit();
+ }
+
+ public void testVolatileAndDurable() throws Exception {
+ TransactionManager tm = new TransactionManager(Constants.WS_AT,
+ coordinator, axis2Repo, axis2XML);
+ tm.begin(true);
+ stub.readonlyOperation();
+ tm.commit();
+ }
+ public void testEarlyAborted() throws Exception {
+ TransactionManager tm = new TransactionManager(Constants.WS_AT,
+ coordinator, axis2Repo, axis2XML);
+ tm.begin(true);
+ stub.earlyAbortedOperation();
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/test/interop/META-INF/services.xml
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/META-INF/services.xml?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/META-INF/services.xml (added)
+++ webservices/kandula/trunk/java/test/interop/META-INF/services.xml Sat Jul 22 22:49:39 2006
@@ -0,0 +1,27 @@
+<service name="TestService">
+ <description>
+ Sample service for Testing
+ </description>
+ <module ref="kandula-inflow"/>
+ <parameter name="ServiceClass" locked="xsd:false">interop.testService</parameter>
+ <operation name="Commit">
+ <parameter name="KandulaResource" locked="xsd:false">interop.CommitTestResource</parameter>
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </operation>
+ <operation name="Rollback">
+ <parameter name="KandulaResource" locked="xsd:false">interop.RollbackTestResource</parameter>
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </operation>
+ <operation name="Phase2Rollback">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </operation>
+ <operation name="Readonly">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </operation>
+ <operation name="VolatileAndDurable">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </operation>
+ <operation name="EarlyAborted">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ </operation>
+</service>
Added: webservices/kandula/trunk/java/test/interop/Phase2RollbackTestVolatileResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/Phase2RollbackTestVolatileResource.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/Phase2RollbackTestVolatileResource.java (added)
+++ webservices/kandula/trunk/java/test/interop/Phase2RollbackTestVolatileResource.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 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.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class Phase2RollbackTestVolatileResource implements KandulaResource {
+
+ /**
+ *
+ */
+ public Phase2RollbackTestVolatileResource() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public boolean commit() {
+ System.out.println("Commited");
+ return true;
+ }
+
+ public void rollback() {
+ System.out.println("rollback");
+
+ }
+
+ public Vote prepare() {
+ return Vote.PREPARED;
+ }
+
+ public String getProtocol() {
+ return Constants.WS_AT_VOLATILE2PC;
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/test/interop/RollbackTestResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/RollbackTestResource.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/RollbackTestResource.java (added)
+++ webservices/kandula/trunk/java/test/interop/RollbackTestResource.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 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.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class RollbackTestResource implements KandulaResource {
+
+ /**
+ *
+ */
+ public RollbackTestResource() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public boolean commit() {
+ System.out.println("Commited");
+ return true;
+ }
+
+ public void rollback() {
+ System.out.println("rollback");
+
+ }
+
+ public Vote prepare() {
+ return Vote.ABORT;
+ }
+
+ public String getProtocol() {
+ return Constants.WS_AT_DURABLE2PC;
+ }
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/test/interop/TestServiceStub.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/TestServiceStub.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/TestServiceStub.java (added)
+++ webservices/kandula/trunk/java/test/interop/TestServiceStub.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2004 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.
+ *
+ */
+package interop;
+
+import java.io.IOException;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+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;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.OutInAxisOperation;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+
+public class TestServiceStub extends org.apache.axis2.client.Stub {
+
+ public static final String AXIS2_HOME = ".";
+
+ // private AxisService service;
+ private ConfigurationContext configurationContext;
+
+ private ServiceContext serviceContext;
+
+ private EndpointReference toEPR;
+
+ private static org.apache.axis2.description.AxisOperation[] operations;
+ {// creating the Service
+ _service = new AxisService("TestService");
+
+ // creating the operations
+ AxisOperation operationDesc;
+ operations = new org.apache.axis2.description.AxisOperation[1];
+
+ operationDesc = new OutInAxisOperation();
+ operationDesc.setName(new javax.xml.namespace.QName("Commit"));
+ operations[0] = operationDesc;
+ _service.addOperation(operationDesc);
+ }
+
+ /**
+ * Constructor
+ */
+ public TestServiceStub(String axis2Home,
+ EndpointReference targetEndpoint) throws java.lang.Exception {
+ this.toEPR = targetEndpoint;
+ // creating the configuration
+ configurationContext = ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(axis2Home, axis2Home
+ + "/axis2.xml");
+ configurationContext.getAxisConfiguration().addService(_service);
+ ServiceGroupContext sgc = new ServiceGroupContext(
+ this.configurationContext, (AxisServiceGroup) _service
+ .getParent());
+ this.serviceContext = new ServiceContext(_service, sgc);
+
+ }
+
+ public void commitOperation() throws IOException, AxisFault {
+
+ Options options = new Options();
+ MessageContext messageContext = new MessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ SOAPEnvelope env = createSOAPEnvelope();
+ messageContext.setEnvelope(env);
+
+ options.setAction("Commit");
+ options.setTo(this.toEPR);
+
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ OperationClient client = operations[0].createClient(serviceContext,
+ options);
+ client.addMessageContext(messageContext);
+ client.execute(true);
+
+ }
+
+ public void rollbackOperation() throws IOException, AxisFault {
+
+ Options options = new Options();
+ MessageContext messageContext = new MessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ SOAPEnvelope env = createSOAPEnvelope();
+ messageContext.setEnvelope(env);
+
+ // _service.engageModule("addressing");
+
+ options.setAction("Rollback");
+ options.setTo(this.toEPR);
+
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ OperationClient client = operations[0].createClient(serviceContext,
+ options);
+ client.addMessageContext(messageContext);
+ client.execute(true);
+ }
+ public void phase2RollbackOperation() throws IOException, AxisFault {
+
+ Options options = new Options();
+ MessageContext messageContext = new MessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ SOAPEnvelope env = createSOAPEnvelope();
+ messageContext.setEnvelope(env);
+
+ // _service.engageModule("addressing");
+
+ options.setAction("Phase2Rollback");
+ options.setTo(this.toEPR);
+
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ OperationClient client = operations[0].createClient(serviceContext,
+ options);
+ client.addMessageContext(messageContext);
+ client.execute(true);
+ }
+ public void readonlyOperation() throws IOException, AxisFault {
+
+ Options options = new Options();
+ MessageContext messageContext = new MessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ SOAPEnvelope env = createSOAPEnvelope();
+ messageContext.setEnvelope(env);
+
+ // _service.engageModule("addressing");
+
+ options.setAction("Readonly");
+ options.setTo(this.toEPR);
+
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ OperationClient client = operations[0].createClient(serviceContext,
+ options);
+ client.addMessageContext(messageContext);
+ client.execute(true);
+ }
+ public void volatileAndDurableOperation() throws IOException, AxisFault {
+
+ Options options = new Options();
+ MessageContext messageContext = new MessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ SOAPEnvelope env = createSOAPEnvelope();
+ messageContext.setEnvelope(env);
+
+ // _service.engageModule("addressing");
+
+ options.setAction("VolatileAndDurable");
+ options.setTo(this.toEPR);
+
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ OperationClient client = operations[0].createClient(serviceContext,
+ options);
+ client.addMessageContext(messageContext);
+ client.execute(true);
+ }
+ public void earlyAbortedOperation() throws IOException, AxisFault {
+
+ Options options = new Options();
+ MessageContext messageContext = new MessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ SOAPEnvelope env = createSOAPEnvelope();
+ messageContext.setEnvelope(env);
+
+ // _service.engageModule("addressing");
+
+ options.setAction("EarlyAborted");
+ options.setTo(this.toEPR);
+
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ OperationClient client = operations[0].createClient(serviceContext,
+ options);
+ client.addMessageContext(messageContext);
+ client.execute(true);
+ }
+
+ private SOAPEnvelope createSOAPEnvelope() {
+
+ SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
+ SOAPEnvelope env = factory.getDefaultEnvelope();
+// SOAPBody body = factory.createSOAPBody();
+// env.addChild(body);
+ OMElement test = factory.createOMElement("test","urn://temp", "tmp");
+ env.getBody().addChild(test);
+ return env;
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/test/interop/VolatileAndDurableTestVolatileResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/VolatileAndDurableTestVolatileResource.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/VolatileAndDurableTestVolatileResource.java (added)
+++ webservices/kandula/trunk/java/test/interop/VolatileAndDurableTestVolatileResource.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 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.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class VolatileAndDurableTestVolatileResource implements KandulaResource {
+
+ /**
+ *
+ */
+ public VolatileAndDurableTestVolatileResource() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public boolean commit() {
+ System.out.println("Commited");
+ return true;
+ }
+
+ public void rollback() {
+ System.out.println("rollback");
+
+ }
+
+ public Vote prepare() {
+ return Vote.READ_ONLY;
+ }
+
+ public String getProtocol() {
+ return Constants.WS_AT_VOLATILE2PC;
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/test/interop/VolatileReadOnlyResource.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/VolatileReadOnlyResource.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/VolatileReadOnlyResource.java (added)
+++ webservices/kandula/trunk/java/test/interop/VolatileReadOnlyResource.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 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.
+ *
+ */
+package interop;
+
+import org.apache.kandula.Constants;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.Vote;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class VolatileReadOnlyResource implements KandulaResource {
+
+ /**
+ *
+ */
+ public VolatileReadOnlyResource() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ public boolean commit() {
+ System.out.println("Commited");
+ return true;
+ }
+
+ public void rollback() {
+ System.out.println("rollback");
+ }
+
+ public Vote prepare() {
+ return Vote.READ_ONLY;
+ }
+
+ public String getProtocol() {
+ return Constants.WS_AT_VOLATILE2PC;
+ }
+
+}
\ No newline at end of file
Added: webservices/kandula/trunk/java/test/interop/testService.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/interop/testService.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/interop/testService.java (added)
+++ webservices/kandula/trunk/java/test/interop/testService.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,204 @@
+/*
+ * Copyright 2004 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.
+ *
+ */
+package interop;
+
+import java.util.Map;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.kandula.Constants;
+import org.apache.kandula.Status;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.CoordinationContext;
+import org.apache.kandula.context.impl.ATParticipantContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+import org.apache.kandula.participant.KandulaResource;
+import org.apache.kandula.participant.ParticipantUtility;
+import org.apache.kandula.storage.StorageFactory;
+import org.apache.kandula.storage.Store;
+import org.apache.kandula.wsat.twopc.CoordinatorPortTypeRawXMLStub;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class testService {
+
+ private MessageContext msgcts;
+
+ public testService() {
+
+ }
+
+ public void setOperationContext(OperationContext oc) throws AxisFault {
+ msgcts = oc.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ }
+
+ public OMElement Commit(OMElement element) {
+ element.build();
+ element.detach();
+ return element;
+ }
+
+ public OMElement Rollback(OMElement element) {
+ element.build();
+ element.detach();
+ return element;
+ }
+
+ public OMElement Phase2Rollback(OMElement element) throws AxisFault {
+ element.build();
+ element.detach();
+ String reqID = (String) msgcts
+ .getProperty(AbstractContext.REQUESTER_ID);
+ Store store = StorageFactory.getInstance().getStore();
+ ATParticipantContext participantContext = (ATParticipantContext) store
+ .get(reqID);
+ CoordinationContext coordinationContext = participantContext
+ .getCoordinationContext();
+
+ ATParticipantContext participantContext2 = new ATParticipantContext();
+ participantContext2.setCoordinationContext(coordinationContext);
+ KandulaResource resource1 = new Phase2RollbackTestVolatileResource();
+ participantContext2.setResource(resource1);
+ store.put(participantContext2.getID(), participantContext2);
+ ParticipantUtility.registerParticipant(participantContext2);
+
+ ATParticipantContext participantContext1 = new ATParticipantContext();
+ participantContext1.setCoordinationContext(coordinationContext);
+ KandulaResource resource = new RollbackTestResource();
+ participantContext1.setResource(resource);
+ store.put(participantContext1.getID(), participantContext1);
+ ParticipantUtility.registerParticipant(participantContext1);
+
+ return element;
+ }
+
+ public OMElement Readonly(OMElement element) throws AxisFault {
+ element.build();
+ element.detach();
+ String reqID = (String) msgcts
+ .getProperty(AbstractContext.REQUESTER_ID);
+ Store store = StorageFactory.getInstance().getStore();
+ ATParticipantContext participantContext = (ATParticipantContext) store
+ .get(reqID);
+ CoordinationContext coordinationContext = participantContext
+ .getCoordinationContext();
+
+ ATParticipantContext participantContext2 = new ATParticipantContext();
+ participantContext2.setCoordinationContext(coordinationContext);
+ KandulaResource resource1 = new DurableReadOnlyResource();
+ participantContext2.setResource(resource1);
+ store.put(participantContext2.getID(), participantContext2);
+ ParticipantUtility.registerParticipant(participantContext2);
+
+ ATParticipantContext participantContext1 = new ATParticipantContext();
+ participantContext1.setCoordinationContext(coordinationContext);
+ KandulaResource resource = new CommitTestResource();
+ participantContext1.setResource(resource);
+ store.put(participantContext1.getID(), participantContext1);
+ ParticipantUtility.registerParticipant(participantContext1);
+
+ return element;
+ }
+
+ public OMElement VolatileAndDurable(OMElement element) throws AxisFault {
+ element.build();
+ element.detach();
+ String reqID = (String) msgcts
+ .getProperty(AbstractContext.REQUESTER_ID);
+ final Store store = StorageFactory.getInstance().getStore();
+ ATParticipantContext participantContext = (ATParticipantContext) store
+ .get(reqID);
+ final CoordinationContext coordinationContext = participantContext
+ .getCoordinationContext();
+
+ final ATParticipantContext participantContext2 = new ATParticipantContext();
+ participantContext2.setCoordinationContext(coordinationContext);
+ KandulaResource resource1 = new VolatileAndDurableTestVolatileResource();
+ participantContext2.setResource(resource1);
+ store.put(participantContext2.getID(), participantContext2);
+ ParticipantUtility.registerParticipant(participantContext2);
+ Thread thread = new Thread(new Runnable() {
+ public void run() {
+ try {
+ ATParticipantContext participantContext1 = new ATParticipantContext();
+ participantContext1
+ .setCoordinationContext(coordinationContext);
+ KandulaResource resource = new CommitTestResource();
+ participantContext1.setResource(resource);
+ store.put(participantContext1.getID(), participantContext1);
+
+ Map referenceParametersmap = participantContext2
+ .getCoordinationEPR().getAllReferenceParameters();
+ String id = ((OMElement) referenceParametersmap
+ .get(Constants.TRANSACTION_ID_PARAMETER)).getText();
+ AbstractContext transaction = (AbstractContext) store
+ .get(id);
+ while (!(transaction.getStatus() == Status.CoordinatorStatus.STATUS_PREPARING_VOLATILE)) {
+ }
+ ParticipantUtility.registerParticipant(participantContext1);
+
+ } catch (AxisFault e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ });
+ thread.start();
+ return element;
+ }
+
+ public OMElement EarlyAborted(OMElement element) throws AxisFault {
+ element.build();
+ element.detach();
+ String reqID = (String) msgcts
+ .getProperty(AbstractContext.REQUESTER_ID);
+ Store store = StorageFactory.getInstance().getStore();
+ ATParticipantContext participantContext = (ATParticipantContext) store
+ .get(reqID);
+ CoordinationContext coordinationContext = participantContext
+ .getCoordinationContext();
+
+ ATParticipantContext participantContext2 = new ATParticipantContext();
+ participantContext2.setCoordinationContext(coordinationContext);
+ KandulaResource resource1 = new CommitTestResource();
+ participantContext2.setResource(resource1);
+ store.put(participantContext2.getID(), participantContext2);
+ ParticipantUtility.registerParticipant(participantContext2);
+
+ ATParticipantContext participantContext1 = new ATParticipantContext();
+ participantContext1.setCoordinationContext(coordinationContext);
+ KandulaResource resource = new VolatileReadOnlyResource();
+ participantContext1.setResource(resource);
+ store.put(participantContext1.getID(), participantContext1);
+ ParticipantUtility.registerParticipant(participantContext1);
+
+ CoordinatorPortTypeRawXMLStub stub;
+ try {
+ stub = new CoordinatorPortTypeRawXMLStub(participantContext1
+ .getCoordinationEPR());
+ stub.abortedOperation();
+ } catch (AbstractKandulaException e) {
+ throw new AxisFault(e);
+ }
+
+ return element;
+ }
+}
\ No newline at end of file
Modified: webservices/kandula/trunk/java/test/org/apache/kandula/context/ActivityContextTest.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/org/apache/kandula/context/ActivityContextTest.java?rev=424679&r1=424678&r2=424679&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 Jul 22 22:49:39 2006
@@ -1,50 +1,50 @@
-/*
- * Copyright 2004 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.
- *
- */
-package org.apache.kandula.context;
-
-import junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class ActivityContextTest extends TestCase {
-
- public void testGetActivityID() {
- // TODO Implement getActivityID().
- }
-
- public void testAddParticipant() {
- // TODO Implement addParticipant().
- }
-
- public void testGetStatus() {
- // TODO Implement getStatus().
- }
-
- public void testSetStatus() {
- // TODO Implement setStatus().
- }
-
- public void testLock() {
- // TODO Implement lock().
- }
-
- public void testUnlock() {
- // TODO Implement unlock().
- }
-
-}
\ No newline at end of file
+/*
+ * Copyright 2004 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.
+ *
+ */
+package org.apache.kandula.context;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class ActivityContextTest extends TestCase {
+
+ public void testGetActivityID() {
+ // TODO Implement getActivityID().
+ }
+
+ public void testAddParticipant() {
+ // TODO Implement addParticipant().
+ }
+
+ public void testGetStatus() {
+ // TODO Implement getStatus().
+ }
+
+ public void testSetStatus() {
+ // TODO Implement setStatus().
+ }
+
+ public void testLock() {
+ // TODO Implement lock().
+ }
+
+ public void testUnlock() {
+ // TODO Implement unlock().
+ }
+
+}
Modified: webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/CoordinatorImplTest.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/CoordinatorImplTest.java?rev=424679&r1=424678&r2=424679&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 Jul 22 22:49:39 2006
@@ -1,89 +1,89 @@
-/*
- * Copyright 2004 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.
- *
- */
-package org.apache.kandula.coordinator;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.kandula.Constants;
-import org.apache.kandula.Status;
-import org.apache.kandula.context.AbstractContext;
-import org.apache.kandula.context.CoordinationContext;
-import org.apache.kandula.context.impl.ATActivityContext;
-import org.apache.kandula.faults.AbstractKandulaException;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class CoordinatorImplTest extends TestCase {
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- /*
- * Class under test for ActivityContext createCoordinationContext(String,
- * long)
- */
- public void testCreateCoordinationContextStringlong()
- throws AbstractKandulaException {
- Coordinator coordinator = new Coordinator();
- AbstractContext context = coordinator.createCoordinationContext(
- Constants.WS_AT, 3000);
- assertTrue(ATActivityContext.class.isInstance(context));
- assertNotNull(context.getCoordinationContext());
- assertTrue(context.getStatus() == Status.CoordinatorStatus.STATUS_ACTIVE);
- }
-
- /*
- * Class under test for ActivityContext
- * createCoordinationContext(CoordinationContext)
- */
- public void testCreateCoordinationContextCoordinationContext()
- throws AbstractKandulaException {
- Coordinator coordinator = new Coordinator();
- CoordinationContext coorContext = CoordinationContext.Factory
- .newContext("uuid:29919219jdk02102021", Constants.WS_AT,
- new EndpointReference(""));
- coorContext.setExpires(3000);
- // coorContext.setRegistrationService()
- AbstractContext context = coordinator
- .createCoordinationContext(coorContext);
- assertTrue(ATActivityContext.class.isInstance(context));
- assertNotNull(context.getCoordinationContext());
- assertTrue(context.getStatus() == Status.CoordinatorStatus.STATUS_ACTIVE);
- assertEquals(context.getCoordinationContext().getCoordinationType(),
- coorContext.getCoordinationType());
- assertEquals(context.getCoordinationContext().getActivityID(),
- coorContext.getActivityID());
- }
-
- public void testRegisterParticipant() {
- // TODO Implement registerParticipant().
- }
-
-}
\ No newline at end of file
+/*
+ * Copyright 2004 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.
+ *
+ */
+package org.apache.kandula.coordinator;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.kandula.Constants;
+import org.apache.kandula.Status;
+import org.apache.kandula.context.AbstractContext;
+import org.apache.kandula.context.CoordinationContext;
+import org.apache.kandula.context.impl.ATActivityContext;
+import org.apache.kandula.faults.AbstractKandulaException;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class CoordinatorImplTest extends TestCase {
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Class under test for ActivityContext createCoordinationContext(String,
+ * long)
+ */
+ public void testCreateCoordinationContextStringlong()
+ throws AbstractKandulaException {
+ Coordinator coordinator = new Coordinator();
+ AbstractContext context = coordinator.createCoordinationContext(
+ Constants.WS_AT, 3000);
+ assertTrue(ATActivityContext.class.isInstance(context));
+ assertNotNull(context.getCoordinationContext());
+ assertTrue(context.getStatus() == Status.CoordinatorStatus.STATUS_ACTIVE);
+ }
+
+ /*
+ * Class under test for ActivityContext
+ * createCoordinationContext(CoordinationContext)
+ */
+ public void testCreateCoordinationContextCoordinationContext()
+ throws AbstractKandulaException {
+ Coordinator coordinator = new Coordinator();
+ CoordinationContext coorContext = CoordinationContext.Factory
+ .newContext("uuid:29919219jdk02102021", Constants.WS_AT,
+ new EndpointReference(""));
+ coorContext.setExpires(3000);
+ // coorContext.setRegistrationService()
+ AbstractContext context = coordinator
+ .createCoordinationContext(coorContext);
+ assertTrue(ATActivityContext.class.isInstance(context));
+ assertNotNull(context.getCoordinationContext());
+ assertTrue(context.getStatus() == Status.CoordinatorStatus.STATUS_ACTIVE);
+ assertEquals(context.getCoordinationContext().getCoordinationType(),
+ coorContext.getCoordinationType());
+ assertEquals(context.getCoordinationContext().getActivityID(),
+ coorContext.getActivityID());
+ }
+
+ public void testRegisterParticipant() {
+ // TODO Implement registerParticipant().
+ }
+
+}
Modified: webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/org/apache/kandula/coordinator/at/ATCoordinatorTest.java?rev=424679&r1=424678&r2=424679&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 Jul 22 22:49:39 2006
@@ -1,50 +1,50 @@
-/*
- * Copyright 2004 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.
- *
- */
-package org.apache.kandula.coordinator.at;
-
-import junit.framework.TestCase;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class ATCoordinatorTest extends TestCase {
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- /**
- * Constructor for ATCoordinatorTest.
- *
- * @param arg0
- */
- public ATCoordinatorTest(String arg0) {
- super(arg0);
- }
-
- public void testCommitOperation() {
- // TODO Implement commitOperation().
- }
-
- public void testRollbackOperation() {
- // TODO Implement rollbackOperation().
- }
-
-}
\ No newline at end of file
+/*
+ * Copyright 2004 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.
+ *
+ */
+package org.apache.kandula.coordinator.at;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class ATCoordinatorTest extends TestCase {
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * Constructor for ATCoordinatorTest.
+ *
+ * @param arg0
+ */
+ public ATCoordinatorTest(String arg0) {
+ super(arg0);
+ }
+
+ public void testCommitOperation() {
+ // TODO Implement commitOperation().
+ }
+
+ public void testRollbackOperation() {
+ // TODO Implement rollbackOperation().
+ }
+
+}
Added: webservices/kandula/trunk/java/test/org/apache/kandula/integration/CompletionCommitTest.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/org/apache/kandula/integration/CompletionCommitTest.java?rev=424679&view=auto
==============================================================================
--- webservices/kandula/trunk/java/test/org/apache/kandula/integration/CompletionCommitTest.java (added)
+++ webservices/kandula/trunk/java/test/org/apache/kandula/integration/CompletionCommitTest.java Sat Jul 22 22:49:39 2006
@@ -0,0 +1,114 @@
+/*
+ * 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.
+ */
+
+package org.apache.kandula.integration;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
+ */
+
+import interop.TestServiceStub;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.kandula.Constants;
+import org.apache.kandula.initiator.TransactionManager;
+
+public class CompletionCommitTest extends TestCase {
+
+ private String repository = "C:/Program Files/Apache Software Foundation/Tomcat 5.0/webapps/axis2/WEB-INF";
+
+ private KandulaDemoServiceStub stub;
+
+ private SimpleHTTPServer server;
+
+ public CompletionCommitTest() throws Exception {
+ super(CompletionCommitTest.class.getName());
+ stub = new KandulaDemoServiceStub(
+ "target/initiator-repository",
+ new EndpointReference(
+ "http://localhost:8082/axis2/services/TestService"));
+ }
+
+ public CompletionCommitTest(String testName) throws Exception {
+ super(testName);
+ stub = new KandulaDemoServiceStub(
+ "target/initiator-repository",
+ new EndpointReference(
+ "http://localhost:8082/axis2/services/TestService"));
+ }
+
+ protected void setUp() throws Exception {
+ File file = new File(repository);
+ File configFile = new File(repository + "/conf/axis2.xml");
+ if (!file.exists()) {
+ throw new Exception("repository directory "
+ + file.getAbsolutePath() + " does not exists");
+ }
+ ConfigurationContext er = ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(file
+ .getAbsolutePath(), configFile.getAbsolutePath());
+
+ server = new SimpleHTTPServer(er, 8081);
+
+ try {
+ server.start();
+ System.out.print("Server started on port " + 8081 + ".....");
+ } finally {
+
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ server.stop();
+ }
+
+ public void testEchoXMLASync() throws Exception {
+ TransactionManager tm = new TransactionManager(
+ Constants.WS_AT,
+ new EndpointReference(
+ "http://localhost:8082/axis2/services/ActivationCoordinator"),
+ "target/initiator-repository",
+ "target/initiator-repository/axis2.xml");
+ tm.begin(false);
+
+ stub.creditOperation();
+ tm.commit();
+ Thread.sleep(5000);
+
+ }
+
+// 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();
+// }
+}
\ No newline at end of file
Modified: webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoService.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoService.java?rev=424679&r1=424678&r2=424679&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 Jul 22 22:49:39 2006
@@ -31,6 +31,18 @@
}
public OMElement creditOperation(OMElement element) {
- return null;
+ element.build();
+ element.detach();
+// System.out.println("done com");
+ return element;
}
+
+
+ public OMElement debitOperation(OMElement element) {
+ element.build();
+ element.detach();
+// System.out.println("done com");
+ return element;
+ }
+
}
Modified: webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoServiceStub.java
URL: http://svn.apache.org/viewvc/webservices/kandula/trunk/java/test/org/apache/kandula/integration/KandulaDemoServiceStub.java?rev=424679&r1=424678&r2=424679&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 Jul 22 22:49:39 2006
@@ -19,6 +19,7 @@
import java.io.IOException;
import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
@@ -53,13 +54,7 @@
private static org.apache.axis2.description.AxisOperation[] operations;
-
- /**
- * Constructor
- */
- public KandulaDemoServiceStub(String axis2Home,
- EndpointReference targetEndpoint) throws java.lang.Exception {
- // creating the Service
+ {// creating the Service
_service = new AxisService("KandulaDemoService");
// creating the operations
@@ -70,6 +65,13 @@
operationDesc.setName(new javax.xml.namespace.QName("creditOperation"));
operations[0] = operationDesc;
_service.addOperation(operationDesc);
+ }
+
+ /**
+ * Constructor
+ */
+ public KandulaDemoServiceStub(String axis2Home,
+ EndpointReference targetEndpoint) throws java.lang.Exception {
this.toEPR = targetEndpoint;
// creating the configuration
configurationContext = ConfigurationContextFactory
@@ -83,7 +85,7 @@
}
- public void creditOperation() throws IOException, AxisFault{
+ public void creditOperation() throws IOException, AxisFault {
Options options = new Options();
MessageContext messageContext = new MessageContext();
@@ -106,11 +108,37 @@
}
+ public void debitOperation() throws IOException, AxisFault {
+
+ Options options = new Options();
+ MessageContext messageContext = new MessageContext();
+ messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION,
+ AddressingConstants.Submission.WSA_NAMESPACE);
+ SOAPEnvelope env = createSOAPEnvelope();
+ messageContext.setEnvelope(env);
+
+ // _service.engageModule("addressing");
+
+ options.setAction("debitOperation");
+ options.setTo(this.toEPR);
+
+ // messageSender
+ // .setSenderTransport(org.apache.axis2.Constants.TRANSPORT_HTTP);
+ OperationClient client = operations[0].createClient(serviceContext,
+ options);
+ client.addMessageContext(messageContext);
+ client.execute(true);
+ }
+
private SOAPEnvelope createSOAPEnvelope() {
SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
SOAPEnvelope env = factory.getDefaultEnvelope();
+// SOAPBody body = factory.createSOAPBody();
+// env.addChild(body);
+ OMElement test = factory.createOMElement("test","urn://temp", "tmp");
+ env.getBody().addChild(test);
return env;
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org