[jboss-cvs] JBossAS SVN: r110809 - in projects/jboss-jca/trunk: rhq and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 1 15:44:34 EST 2011
Author: jesper.pedersen
Date: 2011-03-01 15:44:34 -0500 (Tue, 01 Mar 2011)
New Revision: 110809
Added:
projects/jboss-jca/trunk/rhq/src/test/java/org/jboss/jca/rhq/test/XATestCase.java
projects/jboss-jca/trunk/rhq/src/test/resources/logging.properties
Modified:
projects/jboss-jca/trunk/build.xml
projects/jboss-jca/trunk/rhq/build.xml
Log:
[JBJCA-500] Build system and sample XA test case
Modified: projects/jboss-jca/trunk/build.xml
===================================================================
--- projects/jboss-jca/trunk/build.xml 2011-03-01 20:22:11 UTC (rev 110808)
+++ projects/jboss-jca/trunk/build.xml 2011-03-01 20:44:34 UTC (rev 110809)
@@ -308,16 +308,7 @@
<ant dir="sjc" inheritRefs="true" target="jars"/>
<ant dir="codegenerator" inheritRefs="true" target="jars"/>
<ant dir="adapters" inheritRefs="true" target="jars"/>
- </target>
-
- <!-- =================================
- Target: rhq
- ================================= -->
- <target name="rhq" depends="jars, prepare-test">
<ant dir="rhq" inheritRefs="true" target="jars"/>
- <ant dir="rhq" inheritRefs="true" target="prepare-test"/>
- <ant dir="rhq" inheritRefs="true" target="test-jars"/>
- <ant dir="rhq" inheritRefs="true" target="plugin"/>
</target>
<!-- =================================
@@ -334,6 +325,7 @@
<ant dir="sjc" inheritRefs="true" target="docs"/>
<ant dir="codegenerator" inheritRefs="true" target="docs"/>
<ant dir="adapters" inheritRefs="true" target="docs"/>
+ <ant dir="rhq" inheritRefs="true" target="docs"/>
</target>
<!-- =================================
@@ -355,6 +347,7 @@
<ant dir="validator" inheritRefs="true" target="prepare-test"/>
<ant dir="codegenerator" inheritRefs="true" target="prepare-test"/>
<ant dir="adapters" inheritRefs="true" target="prepare-test"/>
+ <ant dir="rhq" inheritRefs="true" target="prepare-test"/>
</target>
<!-- =================================
@@ -367,6 +360,7 @@
<ant dir="deployers" inheritRefs="true" target="test"/>
<ant dir="validator" inheritRefs="true" target="test"/>
<ant dir="adapters" inheritRefs="true" target="test"/>
+ <ant dir="rhq" inheritRefs="true" target="test"/>
</target>
<!-- =================================
Modified: projects/jboss-jca/trunk/rhq/build.xml
===================================================================
--- projects/jboss-jca/trunk/rhq/build.xml 2011-03-01 20:22:11 UTC (rev 110808)
+++ projects/jboss-jca/trunk/rhq/build.xml 2011-03-01 20:44:34 UTC (rev 110809)
@@ -49,18 +49,7 @@
Target: jars
================================= -->
<target name="jars" depends="compile">
- <mkdir dir="${build.rhq.dir}/jars" />
-
- <!-- rhq -->
- <mkdir dir="${build.rhq.dir}/jars/rhq" />
-
- <copy todir="${build.rhq.dir}/jars/rhq">
- <fileset dir="${build.rhq.dir}/impl"
- includes="**"/>
- </copy>
-
<jar destfile="${target.dir}/${name}-rhq.jar"
- basedir="${build.rhq.dir}/jars/rhq"
index="true"
indexMetaInf="true"
update="true"
@@ -71,6 +60,8 @@
<attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
<attribute name="Implementation-Vendor-Id" value="org.jboss"/>
</manifest>
+ <fileset dir="${build.rhq.dir}/impl"/>
+ <fileset dir="src/main/resources"/>
</jar>
</target>
@@ -129,6 +120,7 @@
<fileset dir="${lib.dir}/common" includes="*.jar" />
<fileset dir="${lib.dir}/embedded" includes="*.jar" />
<fileset dir="${lib.dir}/arquillian" includes="*.jar" />
+ <fileset dir="${lib.dir}/rhq" includes="*.jar" />
<fileset dir="${lib.dir}/sjc" includes="*.jar" />
<fileset dir="${lib.dir}/test" includes="*.jar" />
</classpath>
@@ -180,6 +172,7 @@
<fileset dir="${lib.dir}/common" includes="*.jar" />
<fileset dir="${lib.dir}/embedded" includes="*.jar" />
<fileset dir="${lib.dir}/arquillian" includes="*.jar" />
+ <fileset dir="${lib.dir}/rhq" includes="*.jar" />
<fileset dir="${lib.dir}/sjc" includes="*.jar" />
<fileset dir="${lib.dir}/test" includes="*.jar" />
</classpath>
@@ -200,8 +193,6 @@
<target name="prepare-test">
<mkdir dir="${build.rhq.dir}" />
<mkdir dir="${build.rhq.dir}/test" />
- <mkdir dir="${build.rhq.dir}/test/lib" />
- <property name="rhq.lib.plugin.dir" value="${build.rhq.dir}/test/lib" />
<javac srcdir="src/test"
destdir="${build.rhq.dir}/test"
@@ -213,82 +204,32 @@
</javac>
<copy todir="${build.rhq.dir}/test">
- <fileset dir="src/test/resources"/>
+ <fileset dir="src/test/resources"
+ includes="*.properties"/>
</copy>
- <jar destfile="${target.dir}/${name}-rhq-test.jar"
+ <jar destfile="${build.rhq.dir}/test/${name}-rhq-test.jar"
basedir="${build.rhq.dir}/test"
index="true"
indexMetaInf="true"
update="true"
- level="9">
+ level="9"
+ includes="org/**">
<manifest>
- <attribute name="Implementation-Title" value="IronJacamar RHQ"/>
+ <attribute name="Implementation-Title" value="IronJacamar RHQ Test"/>
<attribute name="Implementation-Version" value="${major}.${minor}.${patch}.${type}"/>
<attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
<attribute name="Implementation-Vendor-Id" value="org.jboss"/>
</manifest>
</jar>
- </target>
-
- <!-- =================================
- Target: test-jars
- ================================= -->
- <target name="test-jars">
- <jar destfile="${build.rhq.dir}/xa.rar">
+ <!-- xa.rar -->
+ <jar destfile="${build.rhq.dir}/test/xa.rar">
<fileset dir="${build.rhq.dir}/test"
- includes="org/jboss/jca/rhq/rar/xa/**/*.class"/>
+ includes="org/jboss/jca/rhq/rar/xa/**"/>
<fileset dir="src/test/resources/xa.rar"/>
</jar>
- </target>
- <!-- =================================
- Target: plugin
- ================================= -->
- <target name="plugin">
- <mkdir dir="${build.rhq.dir}" />
- <mkdir dir="${build.rhq.dir}/plugin" />
- <mkdir dir="${build.rhq.dir}/plugin/lib" />
- <property name="rhq.lib.plugin.dir" value="${build.rhq.dir}/plugin/lib" />
-
- <copy todir="${build.rhq.dir}/plugin">
- <fileset dir="src/test/resources" includes="*.properties *.xml"/>
- <fileset dir="src/main/resources/"
- includes="**/*"/>
- <fileset dir="${build.rhq.dir}/"
- includes="*.rar"/>
- </copy>
-
-
- <copy todir="${rhq.lib.plugin.dir}">
- <fileset dir="${lib.dir}/common/" includes="**"/>
- <fileset dir="${lib.dir}/arquillian/" includes="**"/>
- <fileset dir="${lib.dir}/embedded/" includes="**"/>
- <fileset dir="${lib.dir}/sjc/" includes="**"/>
- <fileset dir="${lib.dir}/test/" includes="h2.jar"/>
- <fileset dir="${lib.dir}/tools/" includes="apiviz.jar jdepend.jar"/>
- <fileset dir="${lib.dir}/rhq/" excludes="rhq*"/>
-
- <fileset dir="${target.dir}"
- includes="ironjacamar*"
- excludes="ironjacamar-rhq-plugin* ironjacamar-codegen* ironjacamar-web*"/>
- </copy>
-
- <jar destfile="${target.dir}/${name}-rhq-plugin.jar"
- basedir="${build.rhq.dir}/plugin"
- index="true"
- indexMetaInf="true"
- update="true"
- level="9">
- <manifest>
- <attribute name="Implementation-Title" value="IronJacamar RHQ"/>
- <attribute name="Implementation-Version" value="${major}.${minor}.${patch}.${type}"/>
- <attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
- <attribute name="Implementation-Vendor-Id" value="org.jboss"/>
- </manifest>
- </jar>
-
</target>
<!-- =================================
@@ -324,7 +265,7 @@
additionalparam="-author -version"
classpath="${build.rhq.dir}"
classpathref="sjc.lib.path.id"
- bottom="Copyright © 2008 Red Hat Middleware LLC (http://www.jboss.com/)">
+ bottom="Copyright © 2011 Red Hat Middleware LLC (http://www.jboss.com/)">
<link offline="true" href="http://java.sun.com/j2se/5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
</javadoc>
<copy todir="${build.rhq.dir}/docs" overwrite="true">
Added: projects/jboss-jca/trunk/rhq/src/test/java/org/jboss/jca/rhq/test/XATestCase.java
===================================================================
--- projects/jboss-jca/trunk/rhq/src/test/java/org/jboss/jca/rhq/test/XATestCase.java (rev 0)
+++ projects/jboss-jca/trunk/rhq/src/test/java/org/jboss/jca/rhq/test/XATestCase.java 2011-03-01 20:44:34 UTC (rev 110809)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.rhq.test;
+
+import org.jboss.jca.core.api.management.ManagementRepository;
+import org.jboss.jca.embedded.Embedded;
+import org.jboss.jca.embedded.EmbeddedFactory;
+
+import java.io.File;
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import org.rhq.core.clientapi.server.discovery.InventoryReport;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.pc.PluginContainerConfiguration;
+import org.rhq.core.pc.inventory.InventoryManager;
+import org.rhq.core.pc.plugin.FileSystemPluginFinder;
+
+import static org.junit.Assert.*;
+
+/**
+ * RHQ plugin test cases for an XA resource adapter
+ *
+ * @author Jesper Pedersen <jesper.pedersen at jboss.org>
+ */
+public class XATestCase
+{
+ /** The logger */
+ private static Logger log = Logger.getLogger(XATestCase.class);
+
+ /** Embedded */
+ private static Embedded embedded;
+
+ /**
+ * Basic
+ * @exception Throwable Thrown if case of an error
+ */
+ @Test
+ public void testBasic() throws Throwable
+ {
+ URL deployment = null;
+ try
+ {
+ ManagementRepository manRepo = embedded.lookup("ManagementRepository", ManagementRepository.class);
+ assertNotNull(manRepo);
+ assertNotNull(manRepo.getConnectors());
+ assertEquals(0, manRepo.getConnectors().size());
+
+ deployment = XATestCase.class.getClassLoader().getResource("xa.rar");
+ embedded.deploy(deployment);
+
+ assertEquals(1, manRepo.getConnectors().size());
+
+ File pluginDir = new File(System.getProperty("archives.dir"));
+
+ PluginContainerConfiguration pcConfig = new PluginContainerConfiguration();
+ pcConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
+ pcConfig.setPluginDirectory(pluginDir);
+ pcConfig.setInsideAgent(false);
+
+ PluginContainer pc = PluginContainer.getInstance();
+
+ pc.setConfiguration(pcConfig);
+ pc.initialize();
+
+ InventoryManager im = pc.getInventoryManager();
+
+ InventoryReport report = im.executeServerScanImmediately();
+ }
+ finally
+ {
+ if (deployment != null)
+ embedded.undeploy(deployment);
+ }
+ }
+
+ /**
+ * Lifecycle start, before the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @BeforeClass
+ public static void beforeClass() throws Throwable
+ {
+ // Create and set an embedded JCA instance
+ embedded = EmbeddedFactory.create();
+ // Startup
+ embedded.startup();
+ }
+
+ /**
+ * Lifecycle stop, after the suite is executed
+ * @throws Throwable throwable exception
+ */
+ @AfterClass
+ public static void afterClass() throws Throwable
+ {
+ // Shutdown embedded
+ embedded.shutdown();
+
+ // Set embedded to null
+ embedded = null;
+ }
+}
Added: projects/jboss-jca/trunk/rhq/src/test/resources/logging.properties
===================================================================
--- projects/jboss-jca/trunk/rhq/src/test/resources/logging.properties (rev 0)
+++ projects/jboss-jca/trunk/rhq/src/test/resources/logging.properties 2011-03-01 20:44:34 UTC (rev 110809)
@@ -0,0 +1,62 @@
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2009, Red Hat Middleware LLC, and individual contributors
+# as indicated by the @author tags. See the copyright.txt file in the
+# distribution for a full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY 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 along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+### $Id: $ ###
+
+# Additional logger names to configure (root logger is always configured)
+loggers=org.jboss.jca,org.jboss,org.jnp,com.arjuna
+
+# Root logger level
+logger.level=${iron.jacamar.log.level:INFO}
+logger.handlers=CONSOLE, FILE
+
+# org.jboss.jca
+logger.org.jboss.jca.level=TRACE
+
+# org.jboss
+logger.org.jboss.level=INFO
+
+# org.jnp
+logger.org.jnp.level=INFO
+
+# com.arjuna
+logger.com.arjuna.level=INFO
+
+# Console handler configuration
+handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
+handler.CONSOLE.properties=autoFlush
+handler.CONSOLE.level=${iron.jacamar.log.console.level:INFO}
+handler.CONSOLE.autoFlush=true
+handler.CONSOLE.formatter=PATTERN
+
+# File handler configuration
+handler.FILE=org.jboss.logmanager.handlers.FileHandler
+handler.FILE.level=${iron.jacamar.log.file.level:TRACE}
+handler.FILE.properties=autoFlush,fileName
+handler.FILE.autoFlush=true
+handler.FILE.fileName=${test.dir}/rhq/test.log
+handler.FILE.formatter=PATTERN
+
+# Formatter pattern configuration
+formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
+formatter.PATTERN.properties=pattern
+formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n
More information about the jboss-cvs-commits
mailing list