Skip to content

Commit

Permalink
HV-1925 Update WildFly testing to 27
Browse files Browse the repository at this point in the history
And remove the remaining javax references in WildFly ITs.
Also use a properly formed beans.xml as new versions of CDI need that to
have the bean discovery mode set to all.
  • Loading branch information
gsmet committed Aug 9, 2022
1 parent 77705d2 commit 454b836
Show file tree
Hide file tree
Showing 35 changed files with 106 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CROSS_PARAMETER_CONSTRAINT_VALIDATOR_HAS_INVALID_TYPE=Validator for cross-parame
CROSS_PARAMETER_CONSTRAINT_MULTIPLE_VALIDATORS=The constraint @{0} defines multiple cross-parameter validators. Only one is allowed.
CROSS_PARAMETER_VALIDATION_APPLIES_TO_REQUIRED=Constraints with generic as well as cross-parameter validators must define an attribute validationAppliesTo(), but constraint @{0} does not.
CROSS_PARAMETER_VALIDATION_APPLIES_TO_MUST_HAVE_IMPLICIT_DEFAULT_VALUE=Default value of the attribute validationAppliesTo() of the constraint @{0} must be ConstraintTarget\u0023IMPLICIT.
CROSS_PARAMETER_VALIDATION_APPLIES_TO_MUST_HAVE_CONSTRAINT_TARGET_RETURN_TYPE=Return type of the attribute validationAppliesTo() of the constraint @{0} must be javax.validation.ConstraintTarget.
CROSS_PARAMETER_VALIDATION_APPLIES_TO_MUST_HAVE_CONSTRAINT_TARGET_RETURN_TYPE=Return type of the attribute validationAppliesTo() of the constraint @{0} must be jakarta.validation.ConstraintTarget.
CROSS_PARAMETER_VALIDATION_ON_PARAMETERLESS_METHOD=Cross-parameter constraint @{0} is illegally placed on a parameterless method or constructor.
INVALID_SIZE_LENGTH_ANNOTATION_PARAMETERS=Invalid annotation parameters. Both min and max should be greater than or equal to 0 and max should be greater than or equal to min ( min >= 0, max >= 0 and min <= max ).
INVALID_PATTERN_ANNOTATION_PARAMETERS=Invalid annotation parameters. Regular expression given as parameter is invalid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ public String getId() {

@Override
public String toString() {
return "ValidatorBean [id=" + getId() + "]";
return "ValidatorBean [id=" + getId() + ", qualifiers=" + getQualifiers() + "]";
}
}
2 changes: 1 addition & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>hibernate-validator-modules</artifactId>
<classifier>wildfly-preview-${version.wildfly}-patch</classifier>
<classifier>wildfly-${version.wildfly}-patch</classifier>
<type>zip</type>
</dependency>
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class BeanPropertiesElContext extends StandardELContext {
public BeanPropertiesElContext(ExpressionFactory expressionFactory) {
super( expressionFactory );

// In javax.el.ELContext, the ExpressionFactory is extracted from the context map. If it is not found, it
// In jakarta.el.ELContext, the ExpressionFactory is extracted from the context map. If it is not found, it
// defaults to ELUtil.getExpressionFactory() which, if we provided the ExpressionFactory to the
// ResourceBundleMessageInterpolator, might not be the same. Thus, we inject the ExpressionFactory in the
// context.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class VariablesELContext extends StandardELContext {
public VariablesELContext(ExpressionFactory expressionFactory) {
super( expressionFactory );

// In javax.el.ELContext, the ExpressionFactory is extracted from the context map. If it is not found, it
// In jakarta.el.ELContext, the ExpressionFactory is extracted from the context map. If it is not found, it
// defaults to ELUtil.getExpressionFactory() which, if we provided the ExpressionFactory to the
// ResourceBundleMessageInterpolator, might not be the same. Thus, we inject the ExpressionFactory in the
// context.
Expand Down
12 changes: 6 additions & 6 deletions integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<description>Hibernate Validator WildFly integration tests.</description>

<properties>
<wildfly.target-dir>${project.build.directory}/wildfly-preview-${version.wildfly}</wildfly.target-dir>
<wildfly.target-dir>${project.build.directory}/wildfly-${version.wildfly}</wildfly.target-dir>
<wildfly.modules-dir>${wildfly.target-dir}/modules/system/layers/base</wildfly.modules-dir>
<!--
<wildfly-secondary.target-dir>${project.build.directory}/wildfly-${version.wildfly.secondary}</wildfly-secondary.target-dir>
Expand Down Expand Up @@ -157,7 +157,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>hibernate-validator-modules</artifactId>
<classifier>wildfly-preview-${version.wildfly}-patch</classifier>
<classifier>wildfly-${version.wildfly}-patch</classifier>
<type>zip</type>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -225,7 +225,7 @@
<!-- WildFly current -->
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-preview-dist</artifactId>
<artifactId>wildfly-dist</artifactId>
<version>${version.wildfly}</version>
<type>tar.gz</type>
<overWrite>false</overWrite>
Expand All @@ -247,7 +247,7 @@
<groupId>${project.groupId}</groupId>
<artifactId>hibernate-validator-modules</artifactId>
<version>${project.version}</version>
<classifier>wildfly-preview-${version.wildfly}-patch</classifier>
<classifier>wildfly-${version.wildfly}-patch</classifier>
<type>zip</type>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
Expand Down Expand Up @@ -315,10 +315,10 @@
</goals>
<configuration>
<offline>true</offline>
<jbossHome>${project.build.directory}/wildfly-preview-${version.wildfly}/</jbossHome>
<jbossHome>${project.build.directory}/wildfly-${version.wildfly}/</jbossHome>
<fail-on-error>false</fail-on-error>
<commands>
<command>patch apply ${project.build.directory}/hibernate-validator-modules-${project.version}-wildfly-preview-${version.wildfly}-patch.zip</command>
<command>patch apply ${project.build.directory}/hibernate-validator-modules-${project.version}-wildfly-${version.wildfly}-patch.zip</command>
</commands>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.jboss.arquillian.testng.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
Expand All @@ -19,6 +20,11 @@
*/
public abstract class AbstractArquillianIT extends Arquillian {

protected static StringAsset BEANS_XML = new StringAsset( "<beans xmlns=\"https://jakarta.ee/xml/ns/jakartaee\" " +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
"xsi:schemaLocation=\"https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd\"\n" +
"bean-discovery-mode=\"all\"></beans>" );

public static WebArchive buildTestArchive(String warFileName) {
PomEquippedResolveStage pom = Maven.resolver().loadPomFromFile( "pom.xml" );
return ShrinkWrap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,20 @@

import static org.assertj.core.api.Assertions.assertThat;

import javax.inject.Inject;
import jakarta.validation.ConstraintValidatorFactory;
import jakarta.validation.ValidatorFactory;

import org.hibernate.validator.cdi.HibernateValidator;
import org.hibernate.validator.integration.AbstractArquillianIT;
import org.hibernate.validator.integration.cdi.constraint.Pingable;
import org.hibernate.validator.integration.cdi.constraint.PingableValidator;
import org.hibernate.validator.integration.cdi.service.PingService;
import org.hibernate.validator.integration.cdi.service.PingServiceImpl;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;

import jakarta.inject.Inject;
import jakarta.validation.ConstraintValidatorFactory;
import jakarta.validation.ValidatorFactory;

/**
* @author Hardy Ferentschik
*/
Expand All @@ -42,7 +41,7 @@ public static WebArchive createTestArchive() throws Exception {
PingServiceImpl.class,
PingableValidator.class
)
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
.addAsWebInfResource( BEANS_XML, "beans.xml" );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@

import static org.assertj.core.api.Assertions.assertThat;

import jakarta.enterprise.inject.spi.BeanManager;
import javax.inject.Inject;
import jakarta.validation.ValidatorFactory;

import org.hibernate.validator.integration.AbstractArquillianIT;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;

import jakarta.enterprise.inject.spi.BeanManager;
import jakarta.inject.Inject;
import jakarta.validation.ValidatorFactory;

/**
* @author Hardy Ferentschik
*/
Expand All @@ -33,7 +32,7 @@ public class DefaultInjectionUnitIT extends AbstractArquillianIT {
@Deployment
public static WebArchive createTestArchive() throws Exception {
return buildTestArchive( WAR_FILE_NAME )
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
.addAsWebInfResource( BEANS_XML, "beans.xml" );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@

import java.io.Serializable;

import jakarta.enterprise.context.SessionScoped;
import javax.inject.Inject;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;

import org.hibernate.validator.cdi.HibernateValidator;
import org.hibernate.validator.integration.AbstractArquillianIT;
import org.hibernate.validator.testutil.TestForIssue;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;

import jakarta.enterprise.context.SessionScoped;
import jakarta.inject.Inject;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;

/**
* @author Hardy Ferentschik
*/
Expand All @@ -43,7 +42,7 @@ public class QualifiedInjectionUnitIT extends AbstractArquillianIT {
@Deployment
public static WebArchive createTestArchive() throws Exception {
return buildTestArchive( WAR_FILE_NAME )
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
.addAsWebInfResource( BEANS_XML, "beans.xml" );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import java.time.Clock;

import javax.inject.Inject;
import jakarta.inject.Inject;
import jakarta.validation.ClockProvider;

import org.hibernate.validator.integration.cdi.service.PingService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@

import static org.assertj.core.api.Assertions.assertThat;

import javax.inject.Inject;
import jakarta.validation.ValidatorFactory;

import org.hibernate.validator.cdi.HibernateValidator;
import org.hibernate.validator.integration.AbstractArquillianIT;
import org.hibernate.validator.integration.cdi.service.PingService;
import org.hibernate.validator.integration.cdi.service.PingServiceImpl;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;

import jakarta.inject.Inject;
import jakarta.validation.ValidatorFactory;

/**
* @author Hardy Ferentschik
*/
Expand All @@ -43,7 +42,7 @@ public static WebArchive createTestArchive() throws Exception {
ClockProviderWithInjection.class
)
.addAsResource( "validation-custom-config.xml", "META-INF/validation.xml" )
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
.addAsWebInfResource( BEANS_XML, "beans.xml" );
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.validator.integration.cdi.configuration;

import javax.inject.Inject;
import jakarta.inject.Inject;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package org.hibernate.validator.integration.cdi.configuration;

import java.util.Locale;
import javax.inject.Inject;
import jakarta.inject.Inject;
import jakarta.validation.MessageInterpolator;

import org.hibernate.validator.integration.cdi.service.PingService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import jakarta.inject.Inject;
import jakarta.validation.ParameterNameProvider;

import org.hibernate.validator.integration.cdi.service.PingService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package org.hibernate.validator.integration.cdi.configuration;

import java.lang.annotation.ElementType;
import javax.inject.Inject;
import jakarta.inject.Inject;
import jakarta.validation.Path;
import jakarta.validation.TraversableResolver;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
package org.hibernate.validator.integration.cdi.constraint;

import javax.inject.Inject;
import jakarta.inject.Inject;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@
import java.util.HashSet;
import java.util.Set;

import javax.inject.Inject;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;

import org.hibernate.validator.integration.AbstractArquillianIT;
import org.hibernate.validator.integration.util.IntegrationTestUtil;
import org.hibernate.validator.testutil.TestForIssue;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.testng.annotations.Test;

import jakarta.inject.Inject;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;

/**
* @author Hardy Ferentschik
*/
Expand All @@ -46,7 +45,7 @@ public static WebArchive createTestArchive() throws Exception {
IntegrationTestUtil.createOxBerryConstraintDefinitionContributorJar()
.as( JavaArchive.class )
)
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
.addAsWebInfResource( BEANS_XML, "beans.xml" );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@

import java.util.Set;

import javax.inject.Inject;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;
import jakarta.validation.constraints.NotNull;

import org.hibernate.validator.integration.AbstractArquillianIT;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.testng.annotations.Test;

import jakarta.inject.Inject;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;
import jakarta.validation.constraints.NotNull;

/**
* Asserts constraints mappings contributed via {@code validation.xml} are applied.
*
Expand All @@ -36,7 +35,7 @@ public static Archive<?> createTestArchive() {
return buildTestArchive( WAR_FILE_NAME )
.addClasses( Broomstick.class, MyConstraintMappingContributor.class )
.addAsResource( "constraint-mapping-contributor-validation.xml", "META-INF/validation.xml" )
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
.addAsWebInfResource( BEANS_XML, "beans.xml" );
}

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@

import static org.assertj.core.api.Assertions.assertThat;

import javax.inject.Inject;

import org.hibernate.validator.integration.AbstractArquillianIT;
import org.hibernate.validator.integration.util.IntegrationTestUtil;
import org.hibernate.validator.integration.util.MyValidator;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.testng.annotations.Test;

import jakarta.inject.Inject;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;

Expand All @@ -37,10 +35,10 @@ public static Archive<?> createTestArchive() {
return buildTestArchive( WAR_FILE_NAME )
.addAsLibrary( IntegrationTestUtil.createCustomBeanValidationProviderJar()
.as( JavaArchive.class )
.addAsManifestResource( EmptyAsset.INSTANCE, "beans.xml" ) )
.addAsManifestResource( BEANS_XML, "beans.xml" ) )
.addAsResource( "log4j.properties" )
.addAsResource( "validation-custom-provider.xml", "META-INF/validation.xml" )
.addAsWebInfResource( EmptyAsset.INSTANCE, "beans.xml" );
.addAsWebInfResource( BEANS_XML, "beans.xml" );
}

@Inject
Expand Down
Loading

0 comments on commit 454b836

Please sign in to comment.