Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleaned up with supported features

  • Loading branch information...
commit 3f629d53cecea0f3287c1cc90a340e93a49fdcac 1 parent d10c977
@tomjenkinson tomjenkinson authored
Showing with 41 additions and 318 deletions.
  1. +1 −1  ...tie/integration1/ejb/src/main/java/org/jboss/narayana/blacktie/quickstarts/integration1/ejb/CreditBean.java
  2. +1 −1  ...ktie/integration1/ejb/src/main/java/org/jboss/narayana/blacktie/quickstarts/integration1/ejb/DebitBean.java
  3. +1 −1  .../src/main/java/org/jboss/narayana/blacktie/quickstarts/integration1/xatmi_adapter/CreditAdapterService.java
  4. +1 −1  ...r/src/main/java/org/jboss/narayana/blacktie/quickstarts/integration1/xatmi_adapter/DebitAdapterService.java
  5. +0 −62 blacktie/jatmibroker-xatmi/java-server/pom.xml
  6. +0 −45 blacktie/jatmibroker-xatmi/java-server/src/main/java/org/jboss/narayana/blacktie/jatmibroker/BarService.java
  7. +0 −21 ...ibroker-xatmi/java-server/src/main/java/org/jboss/narayana/blacktie/jatmibroker/BlackTieServerLauncher.java
  8. +0 −43 .../jatmibroker-xatmi/java-server/src/main/java/org/jboss/narayana/blacktie/jatmibroker/client/JavaClient.java
  9. +0 −30 blacktie/jatmibroker-xatmi/java-server/src/main/resources/btconfig.xml
  10. +0 −53 blacktie/jatmibroker-xatmi/java-server/src/main/resources/log4j.xml
  11. +0 −16 ...atmibroker-xatmi/mdb-xatmi-service/src/main/java/org/jboss/narayana/blacktie/quickstart/ejb/eg1/BTBean.java
  12. +1 −1  ...atmi/mdb-xatmi-service/src/main/java/org/jboss/narayana/blacktie/quickstart/mdb/EchoServiceTestService.java
  13. +5 −5 ...mi/mdb-xatmi-service/src/main/java/org/jboss/narayana/blacktie/quickstart/mdb/TxEchoServiceTestService.java
  14. +7 −16 ...acktie/jatmibroker/ejb/connector/ejb/{AbstractBlacktieServiceTestCase.java → EchoServiceTestCase.java}
  15. +24 −22 ...vice/src/test/java/org/jboss/narayana/blacktie/jatmibroker/ejb/connector/ejb/TxBlacktieServiceTestCase.java
View
2  .../integration1/ejb/src/main/java/org/jboss/narayana/blacktie/quickstarts/integration1/ejb/CreditBean.java
@@ -43,7 +43,7 @@
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public String credit(long acct_no, short amount) {
log.info("Credit called: acct_no: " + acct_no + " amount: " + amount);
- return "CREDITTED";
+ return "CREDITTED\0";
}
}
View
2  ...e/integration1/ejb/src/main/java/org/jboss/narayana/blacktie/quickstarts/integration1/ejb/DebitBean.java
@@ -43,6 +43,6 @@
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public String debit(long acct_no, short amount) {
log.info("Debit called: acct_no: " + acct_no + " amount: " + amount);
- return "DEBITTED";
+ return "DEBITTED\0";
}
}
View
2  ...c/main/java/org/jboss/narayana/blacktie/quickstarts/integration1/xatmi_adapter/CreditAdapterService.java
@@ -63,7 +63,7 @@ public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, Configu
}
log.trace("Returning: " + resp);
- X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null, resp.length() + 1);
+ X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
buffer.setByteArray(resp.getBytes());
return new Response(Connection.TPSUCCESS, 0, buffer, 0);
}
View
2  ...rc/main/java/org/jboss/narayana/blacktie/quickstarts/integration1/xatmi_adapter/DebitAdapterService.java
@@ -63,7 +63,7 @@ public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, Configu
log.error("Got a naming error: " + e.getMessage(), e);
}
log.trace("Returning: " + resp);
- X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null, resp.length() + 1);
+ X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
buffer.setByteArray(resp.getBytes());
return new Response(Connection.TPSUCCESS, 0, buffer, 0);
}
View
62 blacktie/jatmibroker-xatmi/java-server/pom.xml
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- JBoss, Home of Professional Open Source Copyright 2008, Red Hat
- Middleware LLC, and others contributors as indicated by the @authors
- tag. All rights reserved. See the copyright.txt in the distribution
- for a full listing of individual contributors. This copyrighted
- material is made available to anyone wishing to use, modify, copy, or
- redistribute it subject to the terms and conditions of the GNU Lesser
- General Public License, v. 2.1. This program is distributed in the
- hope that it will be useful, but WITHOUT A WARRANTY; without even the
- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the GNU Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License, v.2.1 along with this distribution; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.narayana.blacktie</groupId>
- <artifactId>blacktie-quickstarts-java-server</artifactId>
- <version>5.0.0.M2-SNAPSHOT</version>
- <packaging>jar</packaging>
- <description>A BlackTie component</description>
- <name>Blacktie Java Server Quickstart</name>
- <repositories>
- <repository>
- <id>jboss-public-repository-group</id>
- <name>JBoss Public Repository Group</name>
- <url>http://repository.jboss.org/nexus/content/groups/public/</url>
- <layout>default</layout>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- </repositories>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>none</forkMode>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.jboss.narayana.blacktie</groupId>
- <artifactId>blacktie-jatmibroker-xatmi</artifactId>
- <version>5.0.0.M2-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
View
45 ...ktie/jatmibroker-xatmi/java-server/src/main/java/org/jboss/narayana/blacktie/jatmibroker/BarService.java
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-package org.jboss.narayana.blacktie.jatmibroker;
-
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.Connection;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionException;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.Response;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.Service;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.TPSVCINFO;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET;
-
-public class BarService implements Service {
- private static final Logger log = LogManager.getLogger(BarService.class);
-
- public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
- int sendlen;
-
- log.info("bar called - svc: %s data %s len: %d flags: %d" + svcinfo.getName() + " " + svcinfo.getBuffer() + " "
- + svcinfo.getLen() + " " + svcinfo.getFlags());
-
- sendlen = 15;
- X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null, sendlen);
- buffer.setByteArray("BAR SAYS HELLO".getBytes());
-
- return new Response(Connection.TPSUCCESS, 0, buffer, 0);
- }
-}
View
21 ...oker-xatmi/java-server/src/main/java/org/jboss/narayana/blacktie/jatmibroker/BlackTieServerLauncher.java
@@ -1,21 +0,0 @@
-package org.jboss.narayana.blacktie.jatmibroker;
-
-import org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionException;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.server.BlackTieServer;
-
-public class BlackTieServerLauncher {
-
- /**
- * @param args
- * @throws ConnectionException
- * @throws ConfigurationException
- * @throws InterruptedException
- */
- public static void main(String[] args) throws ConfigurationException, ConnectionException, InterruptedException {
- BlackTieServer server = new BlackTieServer("javaser");
- server.tpadvertise("JAVASERV", BarService.class.getName());
- server.block();
- }
-
-}
View
43 ...tmibroker-xatmi/java-server/src/main/java/org/jboss/narayana/blacktie/jatmibroker/client/JavaClient.java
@@ -1,43 +0,0 @@
-package org.jboss.narayana.blacktie.jatmibroker.client;
-
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.Connection;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionFactory;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.Response;
-import org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET;
-
-public class JavaClient {
- private static final Logger log = LogManager.getLogger(JavaClient.class);
-
- public static void main(String[] args) throws Exception {
- log.info("JavaClient");
- ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
- Connection connection = connectionFactory.getConnection();
- X_OCTET sbuf = (X_OCTET) connection.tpalloc("X_OCTET", null, 29);
- sbuf.setByteArray("THIS IS YOUR CLIENT SPEAKING".getBytes());
- log.info("Calling tpcall with input: %s" + new String(sbuf.getByteArray()));
- int cd = connection.tpacall("JAVASERV", sbuf, 0);
- Response retbuf = connection.tpgetrply(cd, 0);
- log.info("Called tpcall with length: %d output: %s" + retbuf.getBuffer().getLen() + " "
- + new String(((X_OCTET) retbuf.getBuffer()).getByteArray()));
- connection.close();
- }
-}
View
30 blacktie/jatmibroker-xatmi/java-server/src/main/resources/btconfig.xml
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!-- JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
- LLC, and others contributors as indicated by the @authors tag. All rights
- reserved. See the copyright.txt in the distribution for a full listing of
- individual contributors. This copyrighted material is made available to anyone
- wishing to use, modify, copy, or redistribute it subject to the terms and
- conditions of the GNU Lesser General Public License, v. 2.1. This program
- is distributed in the hope that it will be useful, but WITHOUT A WARRANTY;
- without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the GNU Lesser General Public License for more details. You
- should have received a copy of the GNU Lesser General Public License, v.2.1
- along with this distribution; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -->
-<ENVIRONMENT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://www.jboss.org/blacktie">
- <DOMAIN>fooapp</DOMAIN>
- <SERVERS>
- <SERVER name='javaser'>
- <SERVICE_NAMES>
- <SERVICE name='JAVASERV' externally-managed-destination='true'
- size="1" />
- </SERVICE_NAMES>
- </SERVER>
- </SERVERS>
- <ORB
- OPT="-ORBInitRef NameService=corbaloc::${JBOSSAS_IP_ADDR}:3528/NameService -ORBListenEndpoints iiop://${JBOSSAS_IP_ADDR}:0"
- TRANS_FACTORY_ID="TransactionManagerService.OTS" />
- <MQ HOST="${JBOSSAS_IP_ADDR}" PORT="61613" USER="guest" PASSWORD="password"
- RECEIVE_TIMEOUT="10" TIME_TO_LIVE="40" />
-</ENVIRONMENT>
View
53 blacktie/jatmibroker-xatmi/java-server/src/main/resources/log4j.xml
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
- <!--
- JBoss, Home of Professional Open Source Copyright 2008, Red Hat, Inc.,
- and others contributors as indicated by the @authors tag. All rights
- reserved. See the copyright.txt in the distribution for a full listing
- of individual contributors. This copyrighted material is made
- available to anyone wishing to use, modify, copy, or redistribute it
- subject to the terms and conditions of the GNU Lesser General Public
- License, v. 2.1. This program is distributed in the hope that it will
- be useful, but WITHOUT A WARRANTY; without even the implied warranty
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details. You should have
- received a copy of the GNU Lesser General Public License, v.2.1 along
- with this distribution; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
-<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
- threshold="all">
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <param name="target" value="System.out" />
- <param name="Threshold" value="INFO" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %9x %-5p (%-25.25c{2}:%-4L) - %m%n" />
- </layout>
- </appender>
-
- <appender name="ROLLING" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="blacktie.log" />
- <param name="Threshold" value="ALL" />
- <param name="MaxFileSize" value="10000KB" />
- <param name="MaxBackupIndex" value="10" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %9x %-5p (%-25.25c{2}:%-4L) - %m%n" />
- </layout>
- </appender>
-
- <logger name="org.jboss.narayana.blacktie">
- <level value="ALL"/>
- </logger>
-
- <root>
- <priority value="DEBUG" />
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="ROLLING" />
- </root>
-
-</log4j:configuration>
-
View
16 ...ibroker-xatmi/mdb-xatmi-service/src/main/java/org/jboss/narayana/blacktie/quickstart/ejb/eg1/BTBean.java
@@ -7,14 +7,6 @@
@Stateless
public class BTBean {
- @TransactionAttribute(TransactionAttributeType.REQUIRED)
- public void txRequired() {
- }
-
- @TransactionAttribute(TransactionAttributeType.SUPPORTS)
- public void txSupports() {
- }
-
@TransactionAttribute(TransactionAttributeType.MANDATORY)
public void txMandatory() {
}
@@ -22,12 +14,4 @@ public void txMandatory() {
@TransactionAttribute(TransactionAttributeType.NEVER)
public void txNever() {
}
-
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- public void txRequiresNew() {
- }
-
- @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
- public void txNotSupported() {
- }
}
View
2  ...i/mdb-xatmi-service/src/main/java/org/jboss/narayana/blacktie/quickstart/mdb/EchoServiceTestService.java
@@ -40,7 +40,7 @@ public EchoServiceTestService() throws ConfigurationException {
public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, ConfigurationException {
X_OCTET rcvd = (X_OCTET) svcinfo.getBuffer();
- X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null, rcvd.getByteArray().length);
+ X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
buffer.setByteArray(rcvd.getByteArray());
return new Response(Connection.TPSUCCESS, 0, buffer, 0);
}
View
10 ...mdb-xatmi-service/src/main/java/org/jboss/narayana/blacktie/quickstart/mdb/TxEchoServiceTestService.java
@@ -43,7 +43,7 @@
private static final Logger log = LogManager.getLogger(TxEchoServiceTestService.class);
@Inject
- private BTBean firstBTBean;
+ private BTBean btBean;
public TxEchoServiceTestService() throws ConfigurationException {
super("TxEchoServiceTestService");
@@ -59,7 +59,7 @@ public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, Configu
if (args.contains("tx=true")) {
try {
- firstBTBean.txNever();
+ btBean.txNever();
log.info("Error should have got a Not Supported Exception");
resp = "Error should have got a Not Supported Exception";
} catch (javax.ejb.EJBException e) {
@@ -68,7 +68,7 @@ public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, Configu
}
} else if (args.contains("tx=false")) {
try {
- firstBTBean.txMandatory();
+ btBean.txMandatory();
log.info("Error should have got an EJBTransactionRequiredException exception");
resp = "Error should have got an EJBTransactionRequiredException exception";
} catch (javax.ejb.EJBTransactionRequiredException e) {
@@ -78,7 +78,7 @@ public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, Configu
} else if (args.contains("tx=create")) {
try {
byte[] echo = args.getBytes();
- X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null, echo.length);
+ X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null);
buffer.setByteArray(echo);
log.info("Invoking TxCreateService...");
@@ -111,7 +111,7 @@ public Response tpservice(TPSVCINFO svcinfo) throws ConnectionException, Configu
} else {
resp = "unknown operation";
}
- X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null, resp.length());
+ X_OCTET buffer = (X_OCTET) svcinfo.getConnection().tpalloc("X_OCTET", null);
buffer.setByteArray(resp.getBytes());
return new Response(Connection.TPSUCCESS, 0, buffer, 0);
}
View
23 ...onnector/ejb/AbstractBlacktieServiceTestCase.java → ...broker/ejb/connector/ejb/EchoServiceTestCase.java
@@ -28,28 +28,19 @@
import org.jboss.narayana.blacktie.jatmibroker.xatmi.Response;
import org.jboss.narayana.blacktie.jatmibroker.xatmi.X_OCTET;
-public class AbstractBlacktieServiceTestCase extends TestCase {
- private static final Logger log = LogManager.getLogger(AbstractBlacktieServiceTestCase.class);
- private Connection connection;
-
- public void setUp() throws ConnectionException, ConfigurationException {
- log.info("AbstractBlacktieServiceTestCase::setUp");
- ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
- connection = connectionFactory.getConnection();
- }
-
- public void tearDown() throws ConnectionException, ConfigurationException {
- log.info("AbstractBlacktieServiceTestCase::tearDown");
- connection.close();
- }
+public class EchoServiceTestCase extends TestCase {
+ private static final Logger log = LogManager.getLogger(EchoServiceTestCase.class);
public void test() throws ConnectionException, ConfigurationException {
- log.info("AbstractBlacktieServiceTestCase::test");
- X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null, 4);
+ log.info("EchoServiceTestCase::test");
+ ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
+ Connection connection = connectionFactory.getConnection();
+ X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null);
buffer.setByteArray("echo".getBytes());
Response response = connection.tpcall("EchoService", buffer, 0);
String responseData = new String(((X_OCTET) response.getBuffer()).getByteArray());
assertEquals("echo", responseData);
+ connection.close();
}
}
View
46 ...e/src/test/java/org/jboss/narayana/blacktie/jatmibroker/ejb/connector/ejb/TxBlacktieServiceTestCase.java
@@ -36,24 +36,14 @@
public class TxBlacktieServiceTestCase extends TestCase {
private static final Logger log = LogManager.getLogger(TxBlacktieServiceTestCase.class);
- private Connection connection;
- public void setUp() throws ConnectionException, ConfigurationException {
- log.info("TxBlacktieServiceTestCase::setUp");
- ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
- connection = connectionFactory.getConnection();
- }
-
- public void tearDown() throws ConnectionException, ConfigurationException {
- log.info("TxBlacktieServiceTestCase::tearDown");
- connection.close();
- }
-
- public void test1() throws ConnectionException, TransactionException, ConfigurationException, NotFound, CannotProceed, InvalidName,
+ public void testNeverWithTransaction() throws ConnectionException, TransactionException, ConfigurationException, NotFound, CannotProceed, InvalidName,
org.omg.CORBA.ORBPackage.InvalidName, AdapterInactive {
log.info("TxBlacktieServiceTestCase::test1");
+ ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
+ Connection connection = connectionFactory.getConnection();
byte[] args = "test=test1,tx=true".getBytes();
- X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null, args.length);
+ X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null);
buffer.setByteArray(args);
TransactionImpl transaction = new TransactionImpl(5000);
@@ -61,35 +51,44 @@ public void test1() throws ConnectionException, TransactionException, Configurat
String responseData = new String(((X_OCTET) response.getBuffer()).getByteArray());
transaction.commit();
assertEquals("test=test1,tx=true", responseData);
+ connection.close();
}
- public void test2() throws ConnectionException, ConfigurationException {
+ public void testNeverWithoutTransaction() throws ConnectionException, ConfigurationException {
log.info("TxBlacktieServiceTestCase::test2");
+ ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
+ Connection connection = connectionFactory.getConnection();
byte[] args = "test=test2,tx=true".getBytes();
- X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null, args.length);
+ X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null);
buffer.setByteArray(args);
Response response = connection.tpcall("TxEchoService", buffer, 0);
String responseData = new String(((X_OCTET) response.getBuffer()).getByteArray());
assertNotSame("test=test2,tx=true", responseData);
+ connection.close();
}
- public void test3() throws ConnectionException, ConfigurationException {
+ public void testMandatoryWithoutTransaction() throws ConnectionException, ConfigurationException {
log.info("TxBlacktieServiceTestCase::test3");
+ ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
+ Connection connection = connectionFactory.getConnection();
byte[] args = "test=test3,tx=false".getBytes();
- X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null, args.length);
+ X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null);
buffer.setByteArray(args);
Response response = connection.tpcall("TxEchoService", buffer, 0);
String responseData = new String(((X_OCTET) response.getBuffer()).getByteArray());
assertEquals("test=test3,tx=false", responseData);
+ connection.close();
}
- public void test4() throws ConnectionException, TransactionException, ConfigurationException, NotFound, CannotProceed, InvalidName,
+ public void testMandatoryWithTransaction() throws ConnectionException, TransactionException, ConfigurationException, NotFound, CannotProceed, InvalidName,
org.omg.CORBA.ORBPackage.InvalidName, AdapterInactive {
log.info("TxBlacktieServiceTestCase::test4");
+ ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
+ Connection connection = connectionFactory.getConnection();
byte[] args = "test=test4,tx=false".getBytes();
- X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null, args.length);
+ X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null);
buffer.setByteArray(args);
TransactionImpl transaction = new TransactionImpl(5000);
@@ -97,15 +96,18 @@ public void test4() throws ConnectionException, TransactionException, Configurat
String responseData = new String(((X_OCTET) response.getBuffer()).getByteArray());
transaction.commit();
assertNotSame("test=test4,tx=false", responseData);
+ connection.close();
}
/*
* Test that the AS can create a transaction and propagate it too another blacktie service.
*/
- public void test5() throws ConnectionException, ConfigurationException {
+ public void testCreateTransaction() throws ConnectionException, ConfigurationException {
log.info("TxBlacktieServiceTestCase::test5");
+ ConnectionFactory connectionFactory = ConnectionFactory.getConnectionFactory();
+ Connection connection = connectionFactory.getConnection();
byte[] args = "test=test5,tx=create".getBytes();
- X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null, args.length);
+ X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null);
buffer.setByteArray(args);
Response response = connection.tpcall("TxEchoService", buffer, 0);
Please sign in to comment.
Something went wrong with that request. Please try again.