Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JBJCA-1435] javax.resource.spi.Connector annotation validation fix #741

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

boris-unckel
Copy link
Contributor

@boris-unckel
Copy link
Contributor Author

@tadamski I have seen you had to revert your previous fix. This one is slightly different. Could you please review and approve?

@boris-unckel boris-unckel marked this pull request as draft November 16, 2021 16:12
@boris-unckel
Copy link
Contributor Author

Too fast, getting the IllegalStateException:

[ERROR] org.jboss.jca.deployers.test.unit.connector16.Ra16inoutmultiannoTestCase  Time elapsed: 0.739 s  <<< ERROR!
org.jboss.arquillian.container.spi.client.container.DeploymentException: Could not deploy the application: Deployment file:/home/borisunckel/javaprojects/jboss/ironjacamar/deployers/tests/target/ra16inoutmultianno.rar failed
	at org.jboss.jca.arquillian.embedded.EmbeddedJCAContainer.deploy(EmbeddedJCAContainer.java:178)
....
Caused by: com.github.fungal.spi.deployers.DeployException: Deployment file:/home/borisunckel/javaprojects/jboss/ironjacamar/deployers/tests/target/ra16inoutmultianno.rar failed
	at org.jboss.jca.deployers.fungal.RADeployer.deploy(RADeployer.java:211)
	at com.github.fungal.impl.MainDeployerImpl.deploy(MainDeployerImpl.java:144)
	at com.github.fungal.impl.MainDeployerImpl.deploy(MainDeployerImpl.java:82)
	at org.jboss.jca.embedded.EmbeddedJCA.deploy(EmbeddedJCA.java:292)
	at org.jboss.jca.arquillian.embedded.EmbeddedJCAContainer.deploy(EmbeddedJCAContainer.java:174)
	... 89 more
Caused by: java.lang.IllegalStateException: IJ010052: No @Connector defined
	at org.jboss.jca.common.annotations.Annotations.processConnector(Annotations.java:287)
	at org.jboss.jca.common.annotations.Annotations.process(Annotations.java:214)
	at org.jboss.jca.common.annotations.Annotations.merge(Annotations.java:139)
	at org.jboss.jca.deployers.fungal.RADeployer.deploy(RADeployer.java:165)
	... 93 more

@boris-unckel
Copy link
Contributor Author

@tadamski I have double checked https://issues.redhat.com/browse/JBJCA-240

in spec: (18.4)
If more than one JavaBean is annotated with the Connector annotation, the
application server must use the JavaBean class specified in the deployment
descriptor through the resourceadapter-class element. It is an error to provide
a resource adapter module with more than one JavaBean class annotated with the
Connector annotation and not providing a deployment descriptor.

The logic with this PR is :
Exactly one annotation: Return the connector with the annotation
Zero or more than one: Check if config is null or empty, if yes throw Ex
Last step: if connector is null, create one with config (checked before).

But now simple tests for the factory fail :-(

ERROR] Failures: 
[ERROR]   Ra16inoutmultiannoTestCase.testBasic:86
[ERROR] Errors: 
[ERROR]   AnnotationsComplexTestCase>AnnotationsTestBase.proceed:118 » Validate IJ010052...
[ERROR]   ConnectionDefinitionsTestCase>AnnotationsTestBase.proceed:112 » Validate IJ010...
[ERROR]   DefaultAdminObjectTestCase>AnnotationsTestBase.proceed:118 » Validate IJ010052...
[ERROR]   DefaultAdminObjectWithExcludedInterfacesTestCase>AnnotationsTestBase.proceed:118 » Validate
[ERROR]   SimpleConnectorTestCase>AnnotationsTestBase.proceed:118 » Validate IJ010052: N...

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.754 s <<< FAILURE! - in org.jboss.jca.deployers.test.unit.connector16.Ra16inoutmultiannoTestCase
testBasic(org.jboss.jca.deployers.test.unit.connector16.Ra16inoutmultiannoTestCase)  Time elapsed: 0.01 s  <<< FAILURE!
java.lang.AssertionError
        at org.junit.Assert.fail(Assert.java:86)
        at org.junit.Assert.assertTrue(Assert.java:41)
        at org.junit.Assert.assertNotNull(Assert.java:712)
        at org.junit.Assert.assertNotNull(Assert.java:722)
        at org.jboss.jca.deployers.test.unit.connector16.Ra16inoutmultiannoTestCase.testBasic(Ra16inoutmultiannoTestCase.java:86)

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.16 s <<< FAILURE! - in org.jboss.jca.deployers.test.unit.anno.AnnotationsComplexTestCase
proceed(org.jboss.jca.deployers.test.unit.anno.AnnotationsComplexTestCase)  Time elapsed: 0.101 s  <<< ERROR!
org.jboss.jca.common.api.validator.ValidateException: IJ010052: No @Connector defined
        at org.jboss.jca.common.annotations.Annotations.processConnector(Annotations.java:266)
        at org.jboss.jca.common.annotations.Annotations.process(Annotations.java:214)
        at org.jboss.jca.deployers.test.unit.anno.AnnotationsTestBase.proceed(AnnotationsTestBase.java:118)

It seems a "empty" connector shall be allowed (opposite to the validator now working):
https://github.com/ironjacamar/ironjacamar/blob/1.5.3.Final/deployers/tests/src/test/java/org/jboss/jca/deployers/test/unit/anno/AnnotationsTestBase.java#L118

@boris-unckel
Copy link
Contributor Author

I have found the relevant part here: https://download.eclipse.org/jakartaee/connectors/2.0/connectors-spec-2.0.html#merging-annotations-and-deployment-descriptor
How is config overrules annotations done today? Empty connector with config later applied?

@tadamski
Copy link
Contributor

@boris-unckel thanks! I will look at this again hopefully within a week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants