[jboss-cvs] JBossAS SVN: r101932 - in projects/jboss-jca/trunk: deployers/src/main/java/org/jboss/jca/deployers/fungal and 22 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 5 00:27:19 EST 2010
Author: jesper.pedersen
Date: 2010-03-05 00:27:17 -0500 (Fri, 05 Mar 2010)
New Revision: 101932
Added:
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/TestCaseAbstract.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/MCFTestCase.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryConstructorWrong.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryEqualsAndHashCodeWrong.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryEqualsWrong.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryHashCodeWrong.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryPropertyWrong.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryWrong.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/package.html
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/package.html
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/ra/RATestCase.java
projects/jboss-jca/trunk/validator/src/test/resources/validator/all_right.rar/
projects/jboss-jca/trunk/validator/src/test/resources/validator/all_right.rar/META-INF/
projects/jboss-jca/trunk/validator/src/test/resources/validator/all_right.rar/META-INF/ra.xml
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_constructor_wrong.rar/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_constructor_wrong.rar/META-INF/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_constructor_wrong.rar/META-INF/ra.xml
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_and_hashcode_wrong.rar/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_and_hashcode_wrong.rar/META-INF/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_and_hashcode_wrong.rar/META-INF/ra.xml
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_wrong.rar/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_wrong.rar/META-INF/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_wrong.rar/META-INF/ra.xml
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_hashcode_wrong.rar/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_hashcode_wrong.rar/META-INF/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_hashcode_wrong.rar/META-INF/ra.xml
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_property_wrong.rar/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_property_wrong.rar/META-INF/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_property_wrong.rar/META-INF/ra.xml
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_wrong.rar/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_wrong.rar/META-INF/
projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_wrong.rar/META-INF/ra.xml
Modified:
projects/jboss-jca/trunk/.classpath
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
projects/jboss-jca/trunk/deployers/src/test/resources/ra10dtdout.rar/META-INF/ra.xml
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidatorException.java
projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/ra/TestResourceAdapterConstructorWrong.java
projects/jboss-jca/trunk/validator/src/test/resources/validator/ra_equals_and_hashcode_wrong.rar/META-INF/ra.xml
projects/jboss-jca/trunk/validator/src/test/resources/validator/ra_equals_wrong.rar/META-INF/ra.xml
Log:
[JBJCA-294] Validate as early as possible. Patch by Stefano Maestri
Modified: projects/jboss-jca/trunk/.classpath
===================================================================
--- projects/jboss-jca/trunk/.classpath 2010-03-05 04:37:23 UTC (rev 101931)
+++ projects/jboss-jca/trunk/.classpath 2010-03-05 05:27:17 UTC (rev 101932)
@@ -160,5 +160,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/sjc/jboss-threads.jar"/>
<classpathentry kind="lib" path="lib/test/mockito-all.jar"/>
+ <classpathentry kind="lib" path="lib/standalone/ant.jar"/>
<classpathentry kind="output" path="build/api"/>
</classpath>
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-03-05 04:37:23 UTC (rev 101931)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -331,7 +331,8 @@
if (cmd != null)
{
// ResourceAdapter
- if (cmd.getRa() != null && cmd.getRa().getRaClass() != null)
+ if (cmd.getRa() != null &&
+ (!cmd.is10() || cmd.getRa().getRaClass() != null))
{
partialFailures =
validateArchive(url, Arrays.asList((Validate) new ValidateClass(Key.RESOURCE_ADAPTER,
@@ -372,8 +373,18 @@
{
for (ConnectionDefinitionMetaData cdMeta : cdMetas)
{
- if (cdMeta.getManagedConnectionFactoryClass() != null)
+ partialFailures =
+ validateArchive(url, Arrays
+ .asList((Validate) new ValidateClass(Key.MANAGED_CONNECTION_FACTORY, cdMeta
+ .getManagedConnectionFactoryClass(), cl, cdMeta.getConfigProps())));
+ if (partialFailures != null)
{
+ failures = new HashSet<Failure>();
+ failures.addAll(partialFailures);
+ }
+
+ if (!(getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+ {
ManagedConnectionFactory mcf =
(ManagedConnectionFactory)initAndInject(cdMeta.getManagedConnectionFactoryClass(),
cdMeta.getConfigProps(), cl);
@@ -579,8 +590,16 @@
}
catch (Throwable t)
{
+ if ((getArchiveValidationFailOnWarn() && hasFailuresLevel(failures, Severity.WARNING)) ||
+ (getArchiveValidationFailOnError() && hasFailuresLevel(failures, Severity.ERROR)))
+ throw new DeployException("Deployment " + url.toExternalForm() + " failed",
+ new ValidatorException(printFailuresLog(url.getPath(), new Validator(), failures, null), failures));
+ else
+ {
+ printFailuresLog(url.getPath(), new Validator(), failures, null);
throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
}
+ }
finally
{
SecurityActions.setThreadContextClassLoader(oldTCCL);
Modified: projects/jboss-jca/trunk/deployers/src/test/resources/ra10dtdout.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/resources/ra10dtdout.rar/META-INF/ra.xml 2010-03-05 04:37:23 UTC (rev 101931)
+++ projects/jboss-jca/trunk/deployers/src/test/resources/ra10dtdout.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -12,7 +12,7 @@
<vendor-name>Red Hat Middleware LLC</vendor-name>
<spec-version>1.0</spec-version>
<eis-type>JMS 1.1 Server</eis-type>
- <version>6.0</version>
+ <version>1.0</version>
<resourceadapter>
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidatorException.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidatorException.java 2010-03-05 04:37:23 UTC (rev 101931)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidatorException.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -47,6 +47,18 @@
}
/**
+ * Constructs a new exception with the specified detail message.
+ * @param message The message
+ * @param failures collection of failures
+ * @param cause the cause to be chained
+ */
+ public ValidatorException(String message, Collection<Failure> failures, Throwable cause)
+ {
+ super(message, cause);
+ this.failures = failures;
+ }
+
+ /**
* Get the collection of failures
* @return failures
*/
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/TestCaseAbstract.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/TestCaseAbstract.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/TestCaseAbstract.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.test.validator.rules;
+
+import org.jboss.jca.embedded.EmbeddedJCA;
+import org.jboss.jca.test.validator.rules.ra.TestActivationSpec;
+import org.jboss.jca.test.validator.rules.ra.TestManagedConnection;
+import org.jboss.jca.test.validator.rules.ra.TestResourceAdapterRight;
+import org.jboss.jca.test.validator.rules.ra.TestResourceAdapterWrong;
+
+import java.io.File;
+import java.util.UUID;
+
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * Abstract class used from TestCase for conveninet methods and Lifecycle methods
+ *
+ * @author Stefano Maestri mailto:stefano.maestri at javalinux.it
+ *
+ */
+public abstract class TestCaseAbstract
+{
+
+ /**
+ * Protected embedded JCA used by subclass to deploy
+ */
+ protected static EmbeddedJCA embedded;
+
+ /**
+ * It create the Resource adapter to deploy using shrinkwrap
+ *
+ * @param archiveName name of archive
+ * @return the ResourceAdapter ot deploy
+ * @throws Throwable in case of error
+ */
+ protected ResourceAdapterArchive getArchive(String archiveName) throws Throwable
+ {
+ ResourceAdapterArchive raa = Archives.create(archiveName, ResourceAdapterArchive.class);
+
+ JavaArchive ja = Archives.create(UUID.randomUUID().toString() + ".jar", JavaArchive.class);
+ ja.addClasses(TestActivationSpec.class, TestManagedConnection.class, TestResourceAdapterRight.class,
+ TestResourceAdapterWrong.class);
+
+ raa.addLibrary(ja);
+ raa.addManifestResource("validator/" + archiveName + "/META-INF/ra.xml", "ra.xml");
+
+ return raa;
+ }
+
+ /**
+ * Delete a temporary directory and all its content
+ *
+ * @param path directory to delete
+ * @return true if it is effectively delete, false in negative case.
+ */
+ protected boolean deleteDirectory(File path)
+ {
+ if (path.exists())
+ {
+ File[] files = path.listFiles();
+ for (int i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory())
+ {
+ deleteDirectory(files[i]);
+ }
+ else
+ {
+ files[i].delete();
+ }
+ }
+ }
+ return (path.delete());
+ }
+
+ /**
+ *
+ * Lifecycle method creating the {@link EmbeddedJCA} and starting it up
+ *
+ * @throws Throwable in case of setup errors
+ *
+ */
+ @BeforeClass
+ public static void beforeClass() throws Throwable
+ {
+ // Create and set an embedded JCA instance
+ embedded = new EmbeddedJCA();
+
+ // Startup
+ embedded.startup();
+ }
+
+ /**
+ *
+ * Lifecycle method shutting down the {@link EmbeddedJCA}
+ *
+ * @throws Throwable in case of shutdown errors
+ *
+ */
+ @AfterClass
+ public static void afterClass() throws Throwable
+ {
+ // Shutdown embedded
+ embedded.shutdown();
+
+ // Set embedded to null
+ embedded = null;
+ }
+
+}
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/MCFTestCase.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/MCFTestCase.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/MCFTestCase.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,383 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.test.validator.rules.mcf;
+
+import org.jboss.jca.fungal.deployers.DeployException;
+import org.jboss.jca.test.validator.rules.TestCaseAbstract;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.ValidatorException;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.hasItem;
+
+/**
+ * TestCase stressing RA related validation rules
+ *
+ * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
+ *
+ */
+public class MCFTestCase extends TestCaseAbstract
+{
+
+ /**
+ * stress the MCF rule.
+ *
+ * @throws Throwable and expect a ValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithWrongMCF() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("mcf_wrong.rar");
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR,
+ "6.5.3.2",
+ "The class must implement the javax.resource.spi.ManagedConnectionFactory interface.",
+ TestManagedConnectionFactoryWrong.class
+ .getName());
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+
+ }
+
+
+ /**
+ * stress the MCFEquals rule.
+ *
+ * @throws Throwable and expect a ValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithWrongEqualsMCF() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("mcf_equals_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR,
+ "6.5.3.2",
+ "A ManagedConnectionFactory must implement a \"public boolean equals(Object)\" method.",
+ TestManagedConnectionFactoryEqualsWrong.class.getName());
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+ }
+
+ /**
+ * stress the MCFEquals rule.
+ *
+ * @throws Throwable and expect a ValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithWrongHashCodeMCF() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("mcf_hashcode_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR,
+ "6.5.3.2",
+ "A ManagedConnectionFactory must implement a \"public int hashCode()\" method.",
+ TestManagedConnectionFactoryHashCodeWrong.class.getName());
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+ }
+
+ /**
+ * stress the MCFEquals rule and MCFHashCode rule, demonstrating also how DeployValidatorException can chains
+ * more than one failure
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithFailuresChaininCaseOfWrongEqualsAndHashCodeMCF() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("mcf_equals_and_hashcode_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRAOne =
+ new Failure(Severity.ERROR,
+ "6.5.3.2",
+ "A ManagedConnectionFactory must implement a \"public boolean equals(Object)\" method.",
+ TestManagedConnectionFactoryEqualsAndHashCodeWrong.class.getName());
+ final Failure failureRATwo =
+ new Failure(Severity.ERROR,
+ "6.5.3.2",
+ "A ManagedConnectionFactory must implement a \"public int hashCode()\" method.",
+ TestManagedConnectionFactoryEqualsAndHashCodeWrong.class.getName());
+
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRAOne)));
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRATwo)));
+ assertThat(dve.getFailures().size(), is(2));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+ }
+
+ /**
+ * stress the MCFConstructor rule.
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithWrongConstructorRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("mcf_constructor_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR, "19.3", "A ManagedConnectionFactory must have a default constructor", null);
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+ }
+
+ /**
+ * stress the MCFConfigProperties rule.
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test
+ public void deployerShouldPrintIntoLogFileWithWrongPropertyRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("mcf_property_wrong.rar");
+ System.setProperty("jboss.jca.home", ".");
+ File directory = new File("./log");
+ directory.mkdir();
+ BufferedReader input = null;
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ assertThat(directory.listFiles().length, is(1));
+ assertThat(directory.listFiles()[0].getName(), is("mcf_property_wrong.rar.log"));
+ input = new BufferedReader(new FileReader(directory.listFiles()[0]));
+ assertThat(input.readLine(), is("Severity: WARNING"));
+ assertThat(input.readLine(), is("Section: 20.7"));
+ assertThat(input.readLine(), is("Description: Invalid config-property-type for ManagedConnectionFactory."));
+ assertThat(input.readLine(), is("Code: Class: "
+ + "org.jboss.jca.test.validator.rules.mcf.TestManagedConnectionFactoryPropertyWrong "
+ + "Property: StringRAR Type: void"));
+
+ assertThat(input.readLine(), is((String) null));
+ }
+ finally
+ {
+ if (input != null)
+ {
+ input.close();
+ }
+ deleteDirectory(directory);
+ }
+ embedded.undeploy(archive);
+ }
+
+ /**
+ * Deploy a correct RA not violating any rule.
+ *
+ * @throws Throwable and doesn't expect any Exception
+ *
+ */
+ @Test
+ public void deployerShouldNotThrowDeployExceptionWithRightRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("all_right.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ //then
+ //No Exception
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+
+ }
+
+}
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryConstructorWrong.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryConstructorWrong.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryConstructorWrong.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.validator.rules.mcf;
+
+import org.jboss.jca.test.validator.rules.base.BaseManagedConnectionFactory;
+
+
+/**
+ * TestManagedConnectionFactory
+ * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnectionFactoryConstructorWrong extends BaseManagedConnectionFactory
+{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor to hide default constructor
+ * @param foo unused parameter
+ */
+ public TestManagedConnectionFactoryConstructorWrong(String foo)
+ {
+
+ }
+}
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryEqualsAndHashCodeWrong.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryEqualsAndHashCodeWrong.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryEqualsAndHashCodeWrong.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.validator.rules.mcf;
+
+import org.jboss.jca.test.validator.rules.base.BaseCciConnectionFactory;
+import org.jboss.jca.test.validator.rules.base.BaseConnectionManager;
+
+import java.io.PrintWriter;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+import javax.security.auth.Subject;
+
+import org.jboss.logging.Logger;
+
+/**
+ * BaseManagedConnectionFactory
+ *
+ * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnectionFactoryEqualsAndHashCodeWrong implements ManagedConnectionFactory, ResourceAdapterAssociation
+{
+ private static final long serialVersionUID = 1L;
+
+ private static Logger log = Logger.getLogger(TestManagedConnectionFactoryEqualsAndHashCodeWrong.class);
+
+ private ResourceAdapter ra;
+
+ private PrintWriter logwriter;
+
+ /**
+ * Constructor
+ */
+ public TestManagedConnectionFactoryEqualsAndHashCodeWrong()
+ {
+ ra = null;
+ logwriter = null;
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @param cxManager ConnectionManager to be associated with created EIS connection factory instance
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createConnectionFactory");
+ return new BaseCciConnectionFactory();
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory() throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createConnectionFactory");
+ return createConnectionFactory(new BaseConnectionManager());
+ }
+
+ /**
+ * Creates a new physical connection to the underlying EIS resource manager.
+ *
+ * @param subject Caller's security information
+ * @param cxRequestInfo Additional resource adapter specific connection request information
+ * @throws ResourceException generic exception
+ * @return ManagedConnection instance
+ */
+ public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
+ throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createManagedConnection");
+ return null;
+ }
+
+ /**
+ * Returns a matched connection from the candidate set of connections.
+ * @param connectionSet candidate connection set
+ * @param subject caller's security information
+ * @param cxRequestInfo additional resource adapter specific connection request information
+ *
+ * @throws ResourceException generic exception
+ * @return ManagedConnection if resource adapter finds an acceptable match otherwise null
+ **/
+ public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call matchManagedConnections");
+ return null;
+ }
+
+ /**
+ * Get the log writer for this ManagedConnectionFactory instance.
+ * @return PrintWriter
+ * @throws ResourceException generic exception
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ log.debug("call getLogWriter");
+ return logwriter;
+ }
+
+ /**
+ * Set the log writer for this ManagedConnectionFactory instance.</p>
+ *
+ * @param out PrintWriter - an out stream for error logging and tracing
+ * @throws ResourceException generic exception
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ log.debug("call setLogWriter");
+ logwriter = out;
+ }
+
+ /**
+ * Get the resource adapter
+ * @return The handle
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ log.debug("call getResourceAdapter");
+ return ra;
+ }
+
+ /**
+ * Set the resource adapter
+ * @param ra The handle
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ log.debug("call setResourceAdapter(" + ra + ")");
+ this.ra = ra;
+ }
+
+}
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryEqualsWrong.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryEqualsWrong.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryEqualsWrong.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,188 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.validator.rules.mcf;
+
+import org.jboss.jca.test.validator.rules.base.BaseCciConnectionFactory;
+import org.jboss.jca.test.validator.rules.base.BaseConnectionManager;
+
+import java.io.PrintWriter;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+import javax.security.auth.Subject;
+
+import org.jboss.logging.Logger;
+
+/**
+ * BaseManagedConnectionFactory
+ *
+ * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnectionFactoryEqualsWrong implements ManagedConnectionFactory, ResourceAdapterAssociation
+{
+ private static final long serialVersionUID = 1L;
+
+ private static Logger log = Logger.getLogger(TestManagedConnectionFactoryEqualsWrong.class);
+
+ private ResourceAdapter ra;
+
+ private PrintWriter logwriter;
+
+ /**
+ * Constructor
+ */
+ public TestManagedConnectionFactoryEqualsWrong()
+ {
+ ra = null;
+ logwriter = null;
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @param cxManager ConnectionManager to be associated with created EIS connection factory instance
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createConnectionFactory");
+ return new BaseCciConnectionFactory();
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory() throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createConnectionFactory");
+ return createConnectionFactory(new BaseConnectionManager());
+ }
+
+ /**
+ * Creates a new physical connection to the underlying EIS resource manager.
+ *
+ * @param subject Caller's security information
+ * @param cxRequestInfo Additional resource adapter specific connection request information
+ * @throws ResourceException generic exception
+ * @return ManagedConnection instance
+ */
+ public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
+ throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createManagedConnection");
+ return null;
+ }
+
+ /**
+ * Returns a matched connection from the candidate set of connections.
+ * @param connectionSet candidate connection set
+ * @param subject caller's security information
+ * @param cxRequestInfo additional resource adapter specific connection request information
+ *
+ * @throws ResourceException generic exception
+ * @return ManagedConnection if resource adapter finds an acceptable match otherwise null
+ **/
+ public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call matchManagedConnections");
+ return null;
+ }
+
+ /**
+ * Get the log writer for this ManagedConnectionFactory instance.
+ * @return PrintWriter
+ * @throws ResourceException generic exception
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ log.debug("call getLogWriter");
+ return logwriter;
+ }
+
+ /**
+ * Set the log writer for this ManagedConnectionFactory instance.</p>
+ *
+ * @param out PrintWriter - an out stream for error logging and tracing
+ * @throws ResourceException generic exception
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ log.debug("call setLogWriter");
+ logwriter = out;
+ }
+
+ /**
+ * Get the resource adapter
+ * @return The handle
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ log.debug("call getResourceAdapter");
+ return ra;
+ }
+
+ /**
+ * Set the resource adapter
+ * @param ra The handle
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ log.debug("call setResourceAdapter(" + ra + ")");
+ this.ra = ra;
+ }
+
+ /**
+ * Hash code
+ * @return The hash
+ */
+ @Override
+ public int hashCode()
+ {
+ return 42;
+ }
+
+
+}
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryHashCodeWrong.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryHashCodeWrong.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryHashCodeWrong.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,192 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.validator.rules.mcf;
+
+import org.jboss.jca.test.validator.rules.base.BaseCciConnectionFactory;
+import org.jboss.jca.test.validator.rules.base.BaseConnectionManager;
+
+import java.io.PrintWriter;
+import java.util.Set;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+import javax.security.auth.Subject;
+
+import org.jboss.logging.Logger;
+
+/**
+ * BaseManagedConnectionFactory
+ *
+ * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnectionFactoryHashCodeWrong implements ManagedConnectionFactory, ResourceAdapterAssociation
+{
+ private static final long serialVersionUID = 1L;
+
+ private static Logger log = Logger.getLogger(TestManagedConnectionFactoryHashCodeWrong.class);
+
+ private ResourceAdapter ra;
+
+ private PrintWriter logwriter;
+
+ /**
+ * Constructor
+ */
+ public TestManagedConnectionFactoryHashCodeWrong()
+ {
+ ra = null;
+ logwriter = null;
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @param cxManager ConnectionManager to be associated with created EIS connection factory instance
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createConnectionFactory");
+ return new BaseCciConnectionFactory();
+ }
+
+ /**
+ * Creates a Connection Factory instance.
+ *
+ * @return EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+ * @throws ResourceException Generic exception
+ */
+ public Object createConnectionFactory() throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createConnectionFactory");
+ return createConnectionFactory(new BaseConnectionManager());
+ }
+
+ /**
+ * Creates a new physical connection to the underlying EIS resource manager.
+ *
+ * @param subject Caller's security information
+ * @param cxRequestInfo Additional resource adapter specific connection request information
+ * @throws ResourceException generic exception
+ * @return ManagedConnection instance
+ */
+ public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
+ throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call createManagedConnection");
+ return null;
+ }
+
+ /**
+ * Returns a matched connection from the candidate set of connections.
+ * @param connectionSet candidate connection set
+ * @param subject caller's security information
+ * @param cxRequestInfo additional resource adapter specific connection request information
+ *
+ * @throws ResourceException generic exception
+ * @return ManagedConnection if resource adapter finds an acceptable match otherwise null
+ **/
+ public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ if (ra == null)
+ throw new IllegalStateException("RA is null");
+
+ log.debug("call matchManagedConnections");
+ return null;
+ }
+
+ /**
+ * Get the log writer for this ManagedConnectionFactory instance.
+ * @return PrintWriter
+ * @throws ResourceException generic exception
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ log.debug("call getLogWriter");
+ return logwriter;
+ }
+
+ /**
+ * Set the log writer for this ManagedConnectionFactory instance.</p>
+ *
+ * @param out PrintWriter - an out stream for error logging and tracing
+ * @throws ResourceException generic exception
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ log.debug("call setLogWriter");
+ logwriter = out;
+ }
+
+ /**
+ * Get the resource adapter
+ * @return The handle
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ log.debug("call getResourceAdapter");
+ return ra;
+ }
+
+ /**
+ * Set the resource adapter
+ * @param ra The handle
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ log.debug("call setResourceAdapter(" + ra + ")");
+ this.ra = ra;
+ }
+
+ /**
+ * Equals
+ * @param other The other object
+ * @return True if equal; otherwise false
+ */
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+
+ return getClass().equals(other.getClass());
+ }
+
+
+}
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryPropertyWrong.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryPropertyWrong.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryPropertyWrong.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.validator.rules.mcf;
+
+import org.jboss.jca.test.validator.rules.base.BaseManagedConnectionFactory;
+
+/**
+ * TestManagedConnectionFactory
+ * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnectionFactoryPropertyWrong extends BaseManagedConnectionFactory
+{
+
+ private static final long serialVersionUID = 1L;
+
+ private String stringRar;
+
+ /**
+ *
+ * @param s The value
+ */
+ public void setStringRAR(String s)
+ {
+ this.stringRar = s;
+ }
+
+ /**
+ *
+ */
+ public void getStringRAR()
+ {
+ //return stringRar;
+ }
+
+}
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryWrong.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryWrong.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/TestManagedConnectionFactoryWrong.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+package org.jboss.jca.test.validator.rules.mcf;
+
+
+/**
+ * TestManagedConnectionFactory
+ * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
+ * @version $Revision: $
+ */
+public class TestManagedConnectionFactoryWrong
+{
+ private static final long serialVersionUID = 1L;
+
+}
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/package.html
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/package.html (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/mcf/package.html 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,3 @@
+<body>
+Test cases about mcf deployers validator.
+</body>
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/package.html
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/package.html (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/package.html 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,3 @@
+<body>
+Test cases about deployers validator.
+</body>
Added: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/ra/RATestCase.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/ra/RATestCase.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/ra/RATestCase.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,433 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.test.validator.rules.ra;
+
+import org.jboss.jca.fungal.deployers.DeployException;
+import org.jboss.jca.test.validator.rules.TestCaseAbstract;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.ValidatorException;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive;
+
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+import static org.junit.matchers.JUnitMatchers.hasItem;
+
+/**
+ * TestCase stressing RA related validation rules
+ *
+ * @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
+ *
+ */
+public class RATestCase extends TestCaseAbstract
+{
+
+ // --------------------------------------------------------------------------------||
+ // Class Members ------------------------------------------------------------------||
+ // --------------------------------------------------------------------------------||
+
+ /**
+ * stress the RA rule.
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithWrongRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("ra_wrong.rar");
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR, "5.3.1", "A ResourceAdapter must implement " + "the javax.resource.spi."
+ + "ResourceAdapter interface.", TestResourceAdapterWrong.class.getName());
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+
+ }
+
+ /**
+ * stress the RAHashCode rule.
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithWrongHashCodeRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("ra_hashcode_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR,
+ "19.4.2",
+ "A ResourceAdapter must implement a \"public int hashCode()\" method.",
+ TestResourceAdapterHashCodeWrong.class.getName());
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success//success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+
+ }
+
+ /**
+ * stress the RANull rule.
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithNullRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("ra_null_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR, "5.3.1", "A ResourceAdapter must be a non-null instance.", null);
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+
+ }
+
+ /**
+ * stress the RAEquals rule.
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithWrongEqualsRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("ra_equals_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR,
+ "19.4.2",
+ "A ResourceAdapter must implement a \"public boolean equals(Object)\" method.",
+ TestResourceAdapterEqualsWrong.class.getName());
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+ }
+
+ /**
+ * stress the RAEquals rule and RAHashCode rule, demonstrating also how DeployValidatorException can chains
+ * more than one failure
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithFailuresChaininCaseOfWrongEqualsAndHashCodeRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("ra_equals_and_hashcode_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRAOne =
+ new Failure(Severity.ERROR,
+ "19.4.2",
+ "A ResourceAdapter must implement a \"public boolean equals(Object)\" method.",
+ TestResourceAdapterEqualsAndHashCodeWrong.class.getName());
+ final Failure failureRATwo =
+ new Failure(Severity.ERROR,
+ "19.4.2",
+ "A ResourceAdapter must implement a \"public int hashCode()\" method.",
+ TestResourceAdapterEqualsAndHashCodeWrong.class.getName());
+
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRAOne)));
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRATwo)));
+ assertThat(dve.getFailures().size(), is(2));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+ }
+
+ /**
+ * stress the RAConstructor rule.
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test(expected = ValidatorException.class)
+ public void deployerShouldThrowDeployExceptionWithWrongConstructorRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("ra_constructor_wrong.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ }
+ catch (DeployException de)
+ {
+ //then
+ ValidatorException dve = null;
+ if (de.getCause() != null && de.getCause() instanceof ValidatorException)
+ {
+ dve = (ValidatorException) de.getCause();
+ }
+ else
+ {
+ //fail
+ de.printStackTrace();
+ throw de;
+ }
+
+ final Failure failureRA =
+ new Failure(Severity.ERROR, "19.3", "A ResourceAdapter must have a default constructor", null);
+ assertThat(dve.getFailures(), notNullValue());
+ assertThat(dve.getFailures(), hasItem(equalTo(failureRA)));
+ assertThat(dve.getFailures().size(), is(1));
+ //success
+ throw dve;
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+ //no exception = fail!
+ fail();
+ }
+
+ /**
+ * stress the RAConfigProperties rule.
+ *
+ * @throws Throwable and expect a DeployValidatorException
+ *
+ */
+ @Test
+ public void deployerShouldPrintIntoLogFileWithWrongPropertyRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("ra_property_wrong.rar");
+ System.setProperty("jboss.jca.home", ".");
+ File directory = new File("./log");
+ directory.mkdir();
+ BufferedReader input = null;
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ assertThat(directory.listFiles().length, is(1));
+ assertThat(directory.listFiles()[0].getName(), is("ra_property_wrong.rar.log"));
+ input = new BufferedReader(new FileReader(directory.listFiles()[0]));
+ assertThat(input.readLine(), is("Severity: WARNING"));
+ assertThat(input.readLine(), is("Section: 20.7"));
+ assertThat(input.readLine(), is("Description: Invalid config-property-type for ResourceAdapter."));
+ assertThat(input.readLine(), is("Code: Class: "
+ + "org.jboss.jca.test.validator.rules.ra.TestResourceAdapterPropertyWrong "
+ + "Property: StringRAR Type: void"));
+
+ assertThat(input.readLine(), is((String) null));
+ }
+ finally
+ {
+ if (input != null)
+ {
+ input.close();
+ }
+ deleteDirectory(directory);
+ }
+ embedded.undeploy(archive);
+ }
+
+ /**
+ * Deploy a correct RA not violating any rule.
+ *
+ * @throws Throwable and doesn't expect any Exception
+ *
+ */
+ @Test
+ public void deployerShouldNotThrowDeployExceptionWithRightRA() throws Throwable
+ {
+ //given
+ ResourceAdapterArchive archive = getArchive("all_right.rar");
+
+ try
+ {
+ //when
+ embedded.deploy(archive);
+ //then
+ //No Exception
+ }
+ finally
+ {
+ embedded.undeploy(archive);
+ }
+
+ }
+
+}
Modified: projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/ra/TestResourceAdapterConstructorWrong.java
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/ra/TestResourceAdapterConstructorWrong.java 2010-03-05 04:37:23 UTC (rev 101931)
+++ projects/jboss-jca/trunk/validator/src/test/java/org/jboss/jca/test/validator/rules/ra/TestResourceAdapterConstructorWrong.java 2010-03-05 05:27:17 UTC (rev 101932)
@@ -23,6 +23,7 @@
import org.jboss.jca.test.validator.rules.base.BaseResourceAdapter;
+
/**
* TestResourceAdapter
* @author <a href="mailto:stefano.maestri at javalinux.it">Stefano Maestri</a>
Added: projects/jboss-jca/trunk/validator/src/test/resources/validator/all_right.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/all_right.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/all_right.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.validator.rules.ra.TestResourceAdapterRight</resourceadapter-class>
+ <config-property>
+ <config-property-name>StringRAR</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>StringFromRARProperties</config-property-value>
+ </config-property>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.ra.TestManagedConnectionFactory</managedconnectionfactory-class>
+
+ <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.ra.TestManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
Added: projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_constructor_wrong.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_constructor_wrong.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_constructor_wrong.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.validator.rules.ra.TestResourceAdapterRight</resourceadapter-class>
+ <config-property>
+ <config-property-name>StringRAR</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>StringFromRARProperties</config-property-value>
+ </config-property>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.mcf.TestManagedConnectionFactoryConstructorWrong</managedconnectionfactory-class>
+
+ <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.base.BaseManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
Added: projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_and_hashcode_wrong.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_and_hashcode_wrong.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_and_hashcode_wrong.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.validator.rules.ra.TestResourceAdapterRight</resourceadapter-class>
+ <config-property>
+ <config-property-name>StringRAR</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>StringFromRARProperties</config-property-value>
+ </config-property>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.mcf.TestManagedConnectionFactoryEqualsAndHashCodeWrong</managedconnectionfactory-class>
+
+ <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.base.BaseManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
Added: projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_wrong.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_wrong.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_equals_wrong.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.validator.rules.ra.TestResourceAdapterRight</resourceadapter-class>
+ <config-property>
+ <config-property-name>StringRAR</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>StringFromRARProperties</config-property-value>
+ </config-property>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.mcf.TestManagedConnectionFactoryEqualsWrong</managedconnectionfactory-class>
+
+ <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.base.BaseManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
Added: projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_hashcode_wrong.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_hashcode_wrong.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_hashcode_wrong.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.validator.rules.ra.TestResourceAdapterRight</resourceadapter-class>
+ <config-property>
+ <config-property-name>StringRAR</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>StringFromRARProperties</config-property-value>
+ </config-property>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.mcf.TestManagedConnectionFactoryHashCodeWrong</managedconnectionfactory-class>
+
+ <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.base.BaseManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
Added: projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_property_wrong.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_property_wrong.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_property_wrong.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.validator.rules.ra.TestResourceAdapterPropertyWrong</resourceadapter-class>
+
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.mcf.TestManagedConnectionFactoryPropertyWrong</managedconnectionfactory-class>
+ <config-property>
+ <config-property-name>StringRAR</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>StringFromRARProperties</config-property-value>
+ </config-property>
+
+ <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.ra.TestManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
Added: projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_wrong.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_wrong.rar/META-INF/ra.xml (rev 0)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/mcf_wrong.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id $ -->
+
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <vendor-name>Red Hat Middleware LLC</vendor-name>
+ <eis-type>Test RA</eis-type>
+ <resourceadapter-version>0.1</resourceadapter-version>
+
+ <resourceadapter>
+ <resourceadapter-class>org.jboss.jca.test.validator.rules.ra.TestResourceAdapterRight</resourceadapter-class>
+ <config-property>
+ <config-property-name>StringRAR</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ <config-property-value>StringFromRARProperties</config-property-value>
+ </config-property>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.mcf.TestManagedConnectionFactoryWrong</managedconnectionfactory-class>
+
+ <connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.base.BaseManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
+ <connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
+ </connection-definition>
+ <transaction-support>LocalTransaction</transaction-support>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
Modified: projects/jboss-jca/trunk/validator/src/test/resources/validator/ra_equals_and_hashcode_wrong.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/ra_equals_and_hashcode_wrong.rar/META-INF/ra.xml 2010-03-05 04:37:23 UTC (rev 101931)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/ra_equals_and_hashcode_wrong.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -17,10 +17,10 @@
<outbound-resourceadapter>
<connection-definition>
- <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.base.TestManagedConnectionFactory</managedconnectionfactory-class>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.ra.TestManagedConnectionFactory</managedconnectionfactory-class>
<connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
- <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.base.TestManagedConnection</connectionfactory-impl-class>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.ra.ManagedConnectionFactory</connectionfactory-impl-class>
<connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
<connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
</connection-definition>
Modified: projects/jboss-jca/trunk/validator/src/test/resources/validator/ra_equals_wrong.rar/META-INF/ra.xml
===================================================================
--- projects/jboss-jca/trunk/validator/src/test/resources/validator/ra_equals_wrong.rar/META-INF/ra.xml 2010-03-05 04:37:23 UTC (rev 101931)
+++ projects/jboss-jca/trunk/validator/src/test/resources/validator/ra_equals_wrong.rar/META-INF/ra.xml 2010-03-05 05:27:17 UTC (rev 101932)
@@ -17,11 +17,11 @@
<outbound-resourceadapter>
<connection-definition>
- <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.base.TestManagedConnectionFactory</managedconnectionfactory-class>
+ <managedconnectionfactory-class>org.jboss.jca.test.validator.rules.ra.TestManagedConnectionFactory</managedconnectionfactory-class>
<connectionfactory-interface>javax.resource.spi.ManagedConnection</connectionfactory-interface>
- <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.base.TestManagedConnection</connectionfactory-impl-class>
- <connection-interface>org.jboss.jca.test.validator.rules.base.TestConnectionInterface</connection-interface>
+ <connectionfactory-impl-class>org.jboss.jca.test.validator.rules.ra.TestManagedConnection</connectionfactory-impl-class>
+ <connection-interface>org.jboss.jca.test.validator.rules.base.ManagedConnectionFactory</connection-interface>
<connection-impl-class>org.jboss.jca.test.validator.rules.base.TestConnection</connection-impl-class>
</connection-definition>
<transaction-support>LocalTransaction</transaction-support>
More information about the jboss-cvs-commits
mailing list