Skip to content

Commit

Permalink
SWITCHYARD-930 Problems when using JCAMixIn in the application testing
Browse files Browse the repository at this point in the history
* fix jboss-logging conflict
* fix to retrieve HornetQ version from HornetQ class but not from environment variable
  • Loading branch information
igarashitm authored and Keith Babo committed Jul 2, 2013
1 parent 9da8125 commit b008131
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ bin/
*.iws
.DS_Store
jca/transaction.log
transaction.log.*
itests/transaction.log
6 changes: 6 additions & 0 deletions jca/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
<dependency>
<groupId>org.jboss.ironjacamar</groupId>
<artifactId>ironjacamar-core-api</artifactId>
<exclusions>
<exclusion>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
Expand Down
14 changes: 14 additions & 0 deletions test/mixins/jca/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
<dependency>
<groupId>org.jboss.ironjacamar</groupId>
<artifactId>ironjacamar-core-api</artifactId>
<exclusions>
<exclusion>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.ironjacamar</groupId>
Expand Down Expand Up @@ -80,6 +86,14 @@
<groupId>org.jboss.spec.javax.resource</groupId>
<artifactId>jboss-connector-api_1.6_spec</artifactId>
</dependency>
<dependency>
<groupId>org.hornetq</groupId>
<artifactId>hornetq-core-client</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
import junit.framework.Assert;

import org.apache.log4j.Logger;
import org.jboss.as.connector.ConnectorServices;
import org.hornetq.core.version.Version;
import org.hornetq.utils.VersionLoader;
import org.jboss.as.connector.util.ConnectorServices;
import org.jboss.jca.core.spi.rar.ResourceAdapterRepository;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
Expand Down Expand Up @@ -64,8 +66,6 @@ public class JCAMixIn extends AbstractTestMixIn implements TransactionMixInParti
private static final String MOCK_DEFAULT_MCF_CLASS = "org.switchyard.test.mixins.jca.MockManagedConnectionFactory";
private static final String MOCK_RESOURCE_ADAPTER_XML = "jcamixin-mock-ra.xml";
private static final String HORNETQ_RESOURCE_ADAPTER_XML = "jcamixin-hornetq-ra.xml";
private static final String ENV_HORNETQ_VERSION = "HORNETQ_VERSION";
private static final String ENV_NETTY_VERSION = "NETTY_VERSION";

private Logger _logger = Logger.getLogger(JCAMixIn.class);
private SwitchYardIronJacamarHandler _ironJacamar;
Expand Down Expand Up @@ -205,12 +205,19 @@ private void deployMockResourceAdapter(String raName, Map<String, String> connDe
}

private void deployHornetQResourceAdapter(String raName, Map<String, String> connDefs) {
String hqVersion = System.getenv(ENV_HORNETQ_VERSION);
String nettyVersion = System.getenv(ENV_NETTY_VERSION);
Version version = VersionLoader.getVersion();
String hqVersion = version.getMajorVersion()
+ "." + version.getMinorVersion()
+ "." + version.getMicroVersion()
+ "." + version.getVersionSuffix();
String nettyVersion = org.jboss.netty.util.Version.ID;
if (nettyVersion.indexOf('-') != -1) {
nettyVersion = nettyVersion.substring(0, nettyVersion.indexOf('-'));
}

ResourceAdapterArchive raa =
ShrinkWrap.create(ResourceAdapterArchive.class, stripDotRarSuffix(raName == null ? "hornetq-ra.rar" : raName) + ".rar");
raa.addAsLibrary(ShrinkwrapUtil.getArchive("org.jboss.netty", "netty", nettyVersion, JavaArchive.class, "jar"));
raa.addAsLibrary(ShrinkwrapUtil.getArchive("io.netty", "netty", nettyVersion, JavaArchive.class, "jar"));
raa.addAsLibrary(ShrinkwrapUtil.getArchive("org.hornetq", "hornetq-ra", hqVersion, JavaArchive.class, "jar"));
raa.addAsLibrary(ShrinkwrapUtil.getArchive("org.hornetq", "hornetq-core-client", hqVersion, JavaArchive.class, "jar"));
raa.addAsLibrary(ShrinkwrapUtil.getArchive("org.hornetq", "hornetq-jms-client", hqVersion, JavaArchive.class, "jar"));
Expand Down

0 comments on commit b008131

Please sign in to comment.