.
- */
-package org.hibernate.validator.osgi.integrationtest;
-
-import static org.hibernate.validator.osgi.integrationtest.PaxExamOptions.JAVA_9;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.CoreOptions.when;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
-
-import java.io.File;
-import java.net.URI;
-import java.util.Locale;
-
-import javax.inject.Inject;
-
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption;
-import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-
-/**
- * Integration test for Bean Validation and Hibernate Validator under OSGi.
- *
- * This test makes sure that the Karaf features provided by this project are installable.
- *
- * Note that if a feature is not installable, the test gets stuck for a while but it is a
- * good indication that something is wrong.
- *
- * @author Toni Menzel (toni@rebaze.com)
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class KarafFeaturesAreInstallableTest {
-
- @Inject
- private FeaturesService featuresService;
-
- private static final boolean DEBUG = false;
-
- @Configuration
- public Option[] config() {
- MavenArtifactUrlReference hibernateValidatorFeature = maven()
- .groupId( "org.hibernate.validator" )
- .artifactId( "hibernate-validator-osgi-karaf-features" )
- .classifier( "features" )
- .type( "xml" )
- .versionAsInProject();
-
- String mavenLocalRepository = System.getProperty( "maven.settings.localRepository" );
- String mavenCentralRepository = System.getProperty( "maven.mavencentral.repo.url" );
-
- return options(
- when( DEBUG ).useOptions( debugConfiguration( "5005", true ) ),
- when( JavaVersionUtil.getMajorVersion() >= 9 ).useOptions( JAVA_9.options() ),
- karafDistributionConfiguration()
- .frameworkUrl(
- maven()
- .groupId( "org.apache.karaf" )
- .artifactId( "apache-karaf" )
- .type( "tar.gz" )
- .versionAsInProject()
- )
- .unpackDirectory( new File( "target/exam" ) )
- .useDeployFolder( false ),
- configureConsole()
- .ignoreLocalConsole()
- .ignoreRemoteShell(),
- when( DEBUG ).useOptions( keepRuntimeFolder() ),
- logLevel( LogLevelOption.LogLevel.INFO ),
- // avoiding additional boot features; specifically "enterprise" which already comes with a HV feature
- // "system" is the absolute minimum, but enough for our purposes
- editConfigurationFilePut(
- "etc/org.apache.karaf.features.cfg",
- "featuresBoot",
- "system"
- ),
- /*
- * Use the same local Maven repository as the build job.
- * This allows to retrieve the just-installed artifacts in case
- * the local repo was overridden from the command line.
- *
- * See https://ops4j1.jira.com/wiki/spaces/paxurl/pages/3833866/Mvn+Protocol for more information
- * on the configuration below.
- */
- editConfigurationFilePut(
- "etc/org.ops4j.pax.url.mvn.cfg",
- "org.ops4j.pax.url.mvn.defaultRepositories",
- "file://" + mavenLocalRepository
- + "@snapshots"
- + "@id=local-repo-from-maven-settings"
- ),
- editConfigurationFilePut(
- "etc/org.ops4j.pax.url.mvn.cfg",
- "org.ops4j.pax.url.mvn.localRepository",
- mavenLocalRepository
- ),
- editConfigurationFilePut( // Erase the defaults: Maven Central uses HTTP by default...
- "etc/org.ops4j.pax.url.mvn.cfg",
- "org.ops4j.pax.url.mvn.repositories",
- mavenCentralRepository + "@id=central"
- ),
- systemProperty( "validatorRepositoryUrl" ).value( hibernateValidatorFeature.getURL() )
- );
- }
-
- @BeforeClass
- public static void setLocaleToEnglish() {
- Locale.setDefault( Locale.ENGLISH );
- }
-
- @Test
- public void canInstallFeatureHibernateValidator() throws Exception {
- featuresService.addRepository( new URI( System.getProperty( "validatorRepositoryUrl" ) ) );
- canInstallFeature( "hibernate-validator" );
- }
-
- @Test
- public void canInstallFeatureHibernateValidatorJodaTime() throws Exception {
- featuresService.addRepository( new URI( System.getProperty( "validatorRepositoryUrl" ) ) );
- canInstallFeature( "hibernate-validator-joda-time" );
- }
-
- @Test
- public void canInstallFeatureHibernateValidatorJavaxMoney() throws Exception {
- featuresService.addRepository( new URI( System.getProperty( "validatorRepositoryUrl" ) ) );
- canInstallFeature( "hibernate-validator-javax-money" );
- }
-
- @Test
- public void canInstallFeatureHibernateValidatorGroovy() throws Exception {
- featuresService.addRepository( new URI( System.getProperty( "validatorRepositoryUrl" ) ) );
- canInstallFeature( "hibernate-validator-groovy" );
- }
-
- @Test
- public void canInstallFeatureHibernateValidatorParanamer() throws Exception {
- featuresService.addRepository( new URI( System.getProperty( "validatorRepositoryUrl" ) ) );
- canInstallFeature( "hibernate-validator-paranamer" );
- }
-
- public void canInstallFeature(String featureName) throws Exception {
- Feature feature = featuresService.getFeature( featureName );
- assertNotNull( "Feature " + featureName + " is not available from features list", feature );
- featuresService.installFeature( featureName );
- assertTrue( "Feature " + featureName + " isn't installed, though available from features list", featuresService.isInstalled( feature ) );
- }
-}
diff --git a/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/OsgiIntegrationTest.java b/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/OsgiIntegrationTest.java
deleted file mode 100644
index 0f08d9211c..0000000000
--- a/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/OsgiIntegrationTest.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Hibernate Validator, declare and validate application constraints
- *
- * License: Apache License, Version 2.0
- * See the license.txt file in the root directory or .
- */
-package org.hibernate.validator.osgi.integrationtest;
-
-import static org.hibernate.validator.osgi.integrationtest.PaxExamOptions.JAVA_9;
-import static org.junit.Assert.assertEquals;
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.when;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
-
-import java.io.File;
-import java.time.LocalDate;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import jakarta.el.ELManager;
-import jakarta.el.ExpressionFactory;
-import javax.money.spi.Bootstrap;
-import javax.script.ScriptEngineFactory;
-import jakarta.validation.ConstraintViolation;
-import jakarta.validation.Validation;
-import jakarta.validation.ValidationProviderResolver;
-import jakarta.validation.Validator;
-import jakarta.validation.spi.ValidationProvider;
-
-import org.codehaus.groovy.jsr223.GroovyScriptEngineFactory;
-import org.hibernate.validator.HibernateValidator;
-import org.hibernate.validator.HibernateValidatorConfiguration;
-import org.hibernate.validator.constraints.ScriptAssert;
-import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator;
-import org.hibernate.validator.osgi.scripting.MultiClassLoaderScriptEvaluatorFactory;
-import org.hibernate.validator.osgi.scripting.OsgiScriptEvaluatorFactory;
-import org.hibernate.validator.resourceloading.PlatformResourceBundleLocator;
-import org.javamoney.moneta.Money;
-import org.javamoney.moneta.spi.MonetaryConfig;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption;
-import org.ops4j.pax.exam.options.MavenUrlReference;
-import org.osgi.framework.FrameworkUtil;
-
-import com.example.Customer;
-import com.example.Event;
-import com.example.ExampleConstraintValidatorFactory;
-import com.example.Order;
-import com.example.RetailOrder;
-import com.example.constraintvalidator.Bean;
-import com.example.constraintvalidator.MustMatch;
-import com.example.money.ExternalClassLoaderJavaxMoneyServiceProvider;
-import com.example.money.JavaxMoneyOrder;
-
-/**
- * Integration test for Bean Validation and Hibernate Validator under OSGi.
- *
- * Note that the example classes used by this test are located in the {@code com.example} package to avoid that they are
- * handled as parts of Hibernate Validator during class loading.
- *
- * @author Gunnar Morling
- */
-@RunWith(PaxExam.class)
-public class OsgiIntegrationTest {
-
- private static final boolean DEBUG = false;
-
- @Configuration
- public Option[] config() {
- MavenUrlReference hibernateValidatorFeature = maven()
- .groupId( "org.hibernate.validator" )
- .artifactId( "hibernate-validator-osgi-karaf-features" )
- .classifier( "features" )
- .type( "xml" )
- .versionAsInProject();
-
- String mavenLocalRepository = System.getProperty( "maven.settings.localRepository" );
- String mavenCentralRepository = System.getProperty( "maven.mavencentral.repo.url" );
-
- return options(
- when( DEBUG ).useOptions( debugConfiguration( "5005", true ) ),
- when( JavaVersionUtil.getMajorVersion() >= 9 ).useOptions( JAVA_9.options() ),
- karafDistributionConfiguration()
- .frameworkUrl(
- maven()
- .groupId( "org.apache.karaf" )
- .artifactId( "apache-karaf" )
- .type( "tar.gz" )
- .versionAsInProject()
- )
- .unpackDirectory( new File( "target/exam" ) )
- .useDeployFolder( false ),
- configureConsole()
- .ignoreLocalConsole()
- .ignoreRemoteShell(),
- when( DEBUG ).useOptions( keepRuntimeFolder() ),
- logLevel( LogLevelOption.LogLevel.INFO ),
- // avoiding additional boot features; specifically "enterprise" which already comes with a HV feature
- // "system" is the absolute minimum, but enough for our purposes
- editConfigurationFilePut(
- "etc/org.apache.karaf.features.cfg",
- "featuresBoot",
- "system"
- ),
- /*
- * Use the same local Maven repository as the build job.
- * This allows to retrieve the just-installed artifacts in case
- * the local repo was overridden from the command line.
- *
- * See https://ops4j1.jira.com/wiki/spaces/paxurl/pages/3833866/Mvn+Protocol for more information
- * on the configuration below.
- */
- editConfigurationFilePut(
- "etc/org.ops4j.pax.url.mvn.cfg",
- "org.ops4j.pax.url.mvn.defaultRepositories",
- "file://" + mavenLocalRepository
- + "@snapshots"
- + "@id=local-repo-from-maven-settings"
- ),
- editConfigurationFilePut(
- "etc/org.ops4j.pax.url.mvn.cfg",
- "org.ops4j.pax.url.mvn.localRepository",
- mavenLocalRepository
- ),
- editConfigurationFilePut( // Erase the defaults: Maven Central uses HTTP by default...
- "etc/org.ops4j.pax.url.mvn.cfg",
- "org.ops4j.pax.url.mvn.repositories",
- mavenCentralRepository + "@id=central"
- ),
- features( hibernateValidatorFeature, "hibernate-validator", "hibernate-validator-joda-time",
- "hibernate-validator-javax-money", "hibernate-validator-groovy" )
- );
- }
-
- @BeforeClass
- public static void setLocaleToEnglish() {
- Locale.setDefault( Locale.ENGLISH );
- }
-
- @Test
- public void canObtainValidatorFactoryAndPerformValidationWithDefaultMessageInterpolator() {
- Set> constraintViolations = Validation.byDefaultProvider()
- .providerResolver( new MyValidationProviderResolver() )
- .configure()
- .ignoreXmlConfiguration()
- .buildValidatorFactory()
- .getValidator()
- .validate( new Customer() );
-
- Set actualMessages = constraintViolations.stream()
- .map( ConstraintViolation::getMessage )
- .collect( Collectors.toSet() );
-
- Set expectedMessages = new HashSet<>();
- expectedMessages.add( "must be greater than or equal to 1" );
- expectedMessages.add( "must be greater than or equal to 1.00" );
-
- assertEquals( expectedMessages, actualMessages );
- }
-
- @Test
- public void canUseExpressionLanguageInConstraintMessageWithExternallyConfiguredExpressionFactory() {
- ExpressionFactory expressionFactory = buildExpressionFactory();
-
- Set> constraintViolations = Validation.byProvider( HibernateValidator.class )
- .configure()
- .ignoreXmlConfiguration()
- .externalClassLoader( getClass().getClassLoader() )
- .messageInterpolator( new ResourceBundleMessageInterpolator(
- new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ),
- true,
- expressionFactory )
- )
- .buildValidatorFactory()
- .getValidator()
- .validate( new Customer() );
-
- Set actualMessages = constraintViolations.stream()
- .map( ConstraintViolation::getMessage )
- .collect( Collectors.toSet() );
-
- Set expectedMessages = new HashSet<>();
- expectedMessages.add( "must be greater than or equal to 1" );
- expectedMessages.add( "must be greater than or equal to 1.00" );
-
- assertEquals( expectedMessages, actualMessages );
- }
-
- @Test
- public void canConfigureCustomConstraintValidatorFactoryViaValidationXml() {
- ExampleConstraintValidatorFactory.invocationCounter.set( 0 );
-
- HibernateValidatorConfiguration configuration = Validation.byProvider( HibernateValidator.class )
- .configure()
- .externalClassLoader( getClass().getClassLoader() );
-
- String constraintValidatorFactoryClassName = configuration.getBootstrapConfiguration()
- .getConstraintValidatorFactoryClassName();
-
- assertEquals(
- "META-INF/validation.xml could not be read",
- ExampleConstraintValidatorFactory.class.getName(),
- constraintValidatorFactoryClassName
- );
-
- configuration.buildValidatorFactory()
- .getValidator()
- .validate( new Customer() );
-
- assertEquals( 1, ExampleConstraintValidatorFactory.invocationCounter.get() );
- }
-
- @Test
- public void canConfigureConstraintViaXmlMapping() {
- Validator validator = Validation.byProvider( HibernateValidator.class )
- .configure()
- .externalClassLoader( getClass().getClassLoader() )
- .buildValidatorFactory()
- .getValidator();
-
- Set> customerViolations = validator.validate( new Customer() );
-
- assertEquals( 1, customerViolations.size() );
- assertEquals( "must be greater than or equal to 2", customerViolations.iterator().next().getMessage() );
-
- // custom constraint configured in XML
- Set> orderViolations = validator.validate( new Order() );
-
- assertEquals( 1, orderViolations.size() );
- assertEquals( "Invalid", orderViolations.iterator().next().getMessage() );
- }
-
- @Test
- public void canObtainValuesFromValidationMessages() {
- Set> constraintViolations = Validation.byProvider( HibernateValidator.class )
- .configure()
- .externalClassLoader( getClass().getClassLoader() )
- .buildValidatorFactory()
- .getValidator()
- .validate( new RetailOrder() );
-
- assertEquals( 1, constraintViolations.size() );
- assertEquals( "Not a valid retail order name", constraintViolations.iterator().next().getMessage() );
- }
-
- @Test
- public void canUseJavaxMoneyConstraints() {
- Bootstrap.init( new ExternalClassLoaderJavaxMoneyServiceProvider( MonetaryConfig.class.getClassLoader() ) );
-
- Validator validator = Validation.byProvider( HibernateValidator.class )
- .configure()
- .externalClassLoader( getClass().getClassLoader() )
- .buildValidatorFactory()
- .getValidator();
-
- Set> constraintViolations = validator.validate( new JavaxMoneyOrder( "Order 1", Money.of( 0, "EUR" ) ) );
-
- assertEquals( 1, constraintViolations.size() );
- assertEquals( "must be greater than or equal to 100", constraintViolations.iterator().next().getMessage() );
-
- constraintViolations = validator.validate( new JavaxMoneyOrder( "Order 1", Money.of( 120, "USD" ) ) );
-
- assertEquals( 1, constraintViolations.size() );
- assertEquals( "invalid currency (must be one of [EUR])", constraintViolations.iterator().next().getMessage() );
- }
-
- @Test
- public void constraintDefinitionsCanBeConfiguredViaServiceLoader() {
- Validator validator = Validation.byProvider( HibernateValidator.class )
- .configure()
- .externalClassLoader( getClass().getClassLoader() )
- .buildValidatorFactory()
- .getValidator();
-
- Set> constraintViolations = validator.validate( new Bean() );
- assertEquals( 1, constraintViolations.size() );
- assertEquals( MustMatch.class, constraintViolations.iterator().next().getConstraintDescriptor().getAnnotation().annotationType() );
- }
-
- @Test
- public void canUseScriptAssertConstraintWithMultiClassLoaderScriptEvaluatorFactory() {
- //tag::scriptEvaluatorFactoryMultiClassLoaderScriptEvaluatorFactory[]
- Validator validator = Validation.byProvider( HibernateValidator.class )
- .configure()
- .scriptEvaluatorFactory(
- new MultiClassLoaderScriptEvaluatorFactory( GroovyScriptEngineFactory.class.getClassLoader() )
- )
- .buildValidatorFactory()
- .getValidator();
- //end::scriptEvaluatorFactoryMultiClassLoaderScriptEvaluatorFactory[]
-
- canUseScriptAssertConstraint( validator );
- }
-
- @Test
- public void canUseScriptAssertConstraintWithOsgiScriptEvaluatorFactory() {
- //tag::scriptEvaluatorFactoryOsgiScriptEvaluatorFactory[]
- Validator validator = Validation.byProvider( HibernateValidator.class )
- .configure()
- .scriptEvaluatorFactory(
- new OsgiScriptEvaluatorFactory( FrameworkUtil.getBundle( this.getClass() ).getBundleContext() )
- )
- .buildValidatorFactory()
- .getValidator();
- //end::scriptEvaluatorFactoryOsgiScriptEvaluatorFactory[]
-
- canUseScriptAssertConstraint( validator );
- }
-
- private void canUseScriptAssertConstraint(Validator validator) {
- Set> constraintViolations = validator.validate( new Event( LocalDate.of( 2017, 8, 8 ), LocalDate.of( 2016, 8, 8 ) ) );
- assertEquals( 1, constraintViolations.size() );
- assertEquals( "start of event cannot be after the end", constraintViolations.iterator().next().getMessage() );
- assertEquals( ScriptAssert.class, constraintViolations.iterator().next().getConstraintDescriptor().getAnnotation().annotationType() );
- }
-
- @Test
- public void canUseVariousScriptingLanguagesInScripAssertConstraint() {
- Validator validator = Validation.byProvider( HibernateValidator.class )
- .configure()
- .externalClassLoader( getClass().getClassLoader() )
- .scriptEvaluatorFactory(
- new MultiClassLoaderScriptEvaluatorFactory(
- GroovyScriptEngineFactory.class.getClassLoader(),
- ScriptEngineFactory.class.getClassLoader() // for JS
- )
- ).buildValidatorFactory()
- .getValidator();
-
- Set> constraintViolations = validator.validate( new Event.EventLocation() );
- assertEquals( 0, constraintViolations.size() );
- }
-
- private ExpressionFactory buildExpressionFactory() {
- ClassLoader oldTccl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
-
- try {
- return ELManager.getExpressionFactory();
- }
- finally {
- Thread.currentThread().setContextClassLoader( oldTccl );
- }
- }
-
- public static class MyValidationProviderResolver implements ValidationProviderResolver {
-
- @Override
- public List> getValidationProviders() {
- return Collections.>singletonList( new HibernateValidator() );
- }
- }
-}
diff --git a/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/PaxExamOptions.java b/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/PaxExamOptions.java
deleted file mode 100644
index cf8166b46d..0000000000
--- a/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/integrationtest/PaxExamOptions.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Hibernate Validator, declare and validate application constraints
- *
- * License: Apache License, Version 2.0
- * See the license.txt file in the root directory or .
- */
-package org.hibernate.validator.osgi.integrationtest;
-
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.options.DefaultCompositeOption;
-
-public enum PaxExamOptions {
- JAVA_9(
- CoreOptions.vmOptions(
- "--add-opens",
- "java.base/java.security=ALL-UNNAMED",
- "--add-opens",
- "java.base/java.net=ALL-UNNAMED",
- "--add-opens",
- "java.base/java.lang=ALL-UNNAMED",
- "--add-opens",
- "java.base/java.util=ALL-UNNAMED",
- "--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED",
- "--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED",
- "--add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime=ALL-UNNAMED",
- "--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED",
- "--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED",
- "--add-exports=java.xml.ws/com.sun.xml.internal.messaging.saaj.soap.impl=ALL-UNNAMED",
- "--add-modules",
- "java.xml.ws.annotation,java.corba,java.transaction,java.xml.bind,java.xml.ws,jdk.xml.bind" )
- );
-
- private final Option options;
-
- PaxExamOptions(Option... options) {
- this.options = new DefaultCompositeOption( options );
- }
-
- public Option options() {
- return options;
- }
-}
diff --git a/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/scripting/OsgiScriptEvaluatorFactory.java b/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/scripting/OsgiScriptEvaluatorFactory.java
deleted file mode 100644
index c5d594a1f7..0000000000
--- a/osgi/integrationtest/src/test/java/org/hibernate/validator/osgi/scripting/OsgiScriptEvaluatorFactory.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Hibernate Validator, declare and validate application constraints
- *
- * License: Apache License, Version 2.0
- * See the license.txt file in the root directory or .
- */
-package org.hibernate.validator.osgi.scripting;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import javax.script.ScriptEngineFactory;
-import javax.script.ScriptEngineManager;
-import jakarta.validation.ValidationException;
-
-import org.hibernate.validator.spi.scripting.AbstractCachingScriptEvaluatorFactory;
-import org.hibernate.validator.spi.scripting.ScriptEngineScriptEvaluator;
-import org.hibernate.validator.spi.scripting.ScriptEvaluator;
-import org.hibernate.validator.spi.scripting.ScriptEvaluatorFactory;
-import org.hibernate.validator.spi.scripting.ScriptEvaluatorNotFoundException;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * {@link ScriptEvaluatorFactory} suitable for OSGi environments. It is created
- * based on the {@code BundleContext} which is used to iterate through {@code Bundle}s and find all {@link ScriptEngineFactory}
- * candidates.
- *
- * @author Marko Bekhta
- */
-public class OsgiScriptEvaluatorFactory extends AbstractCachingScriptEvaluatorFactory {
-
- private final List scriptEngineManagers;
-
- public OsgiScriptEvaluatorFactory(BundleContext context) {
- this.scriptEngineManagers = Collections.unmodifiableList( findManagers( context ) );
- }
-
- @Override
- protected ScriptEvaluator createNewScriptEvaluator(String languageName) throws ScriptEvaluatorNotFoundException {
- return scriptEngineManagers.stream()
- .map( manager -> manager.getEngineByName( languageName ) )
- .filter( Objects::nonNull )
- .map( engine -> new ScriptEngineScriptEvaluator( engine ) )
- .findFirst()
- .orElseThrow( () -> new ValidationException( String.format( "Unable to find script evaluator for '%s'.", languageName ) ) );
- }
-
- private List findManagers(BundleContext context) {
- return findFactoryCandidates( context ).stream()
- .map( className -> {
- try {
- return new ScriptEngineManager( Class.forName( className ).getClassLoader() );
- }
- catch (ClassNotFoundException e) {
- throw new ValidationException( "Unable to instantiate '" + className + "' based engine factory manager.", e );
- }
- } ).collect( Collectors.toList() );
- }
-
- /**
- * Iterates through all bundles to get the available {@link ScriptEngineFactory} classes
- *
- * @return the names of the available ScriptEngineFactory classes
- *
- * @throws IOException
- */
- private List findFactoryCandidates(BundleContext context) {
- return Arrays.stream( context.getBundles() )
- .filter( Objects::nonNull )
- .filter( bundle -> !"system.bundle".equals( bundle.getSymbolicName() ) )
- .flatMap( this::toStreamOfResourcesURL )
- .filter( Objects::nonNull )
- .flatMap( url -> toListOfFactoryCandidates( url ).stream() )
- .collect( Collectors.toList() );
- }
-
- private Stream toStreamOfResourcesURL(Bundle bundle) {
- Enumeration entries = bundle.findEntries(
- "META-INF/services",
- "javax.script.ScriptEngineFactory",
- false
- );
- return entries != null ? Collections.list( entries ).stream() : Stream.empty();
- }
-
- private List toListOfFactoryCandidates(URL url) {
- try ( BufferedReader reader = new BufferedReader( new InputStreamReader( url.openStream(), "UTF-8" ) ) ) {
- return reader.lines()
- .map( String::trim )
- .filter( line -> !line.isEmpty() )
- .filter( line -> !line.startsWith( "#" ) )
- .collect( Collectors.toList() );
- }
- catch (IOException e) {
- throw new ValidationException( "Unable to read the ScriptEngineFactory resource file", e );
- }
- }
-}
diff --git a/osgi/integrationtest/src/test/resources/META-INF/constraint-mappings.xml b/osgi/integrationtest/src/test/resources/META-INF/constraint-mappings.xml
deleted file mode 100644
index 9901963ba8..0000000000
--- a/osgi/integrationtest/src/test/resources/META-INF/constraint-mappings.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- com.example
-
-
-
-
- 2
-
-
-
-
-
-
-
-
-
-
-
-
- com.example.constraint.ValidNameValidator
-
-
-
diff --git a/osgi/integrationtest/src/test/resources/META-INF/services/jakarta.validation.ConstraintValidator b/osgi/integrationtest/src/test/resources/META-INF/services/jakarta.validation.ConstraintValidator
deleted file mode 100644
index 9c096b8fe2..0000000000
--- a/osgi/integrationtest/src/test/resources/META-INF/services/jakarta.validation.ConstraintValidator
+++ /dev/null
@@ -1 +0,0 @@
-com.example.constraintvalidator.MustMatchValidator
diff --git a/osgi/integrationtest/src/test/resources/META-INF/validation.xml b/osgi/integrationtest/src/test/resources/META-INF/validation.xml
deleted file mode 100644
index 920c3d2189..0000000000
--- a/osgi/integrationtest/src/test/resources/META-INF/validation.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
- com.example.ExampleConstraintValidatorFactory
-
-
- META-INF/constraint-mappings.xml
-
diff --git a/osgi/integrationtest/src/test/resources/ValidationMessages.properties b/osgi/integrationtest/src/test/resources/ValidationMessages.properties
deleted file mode 100644
index 41e6c5dbe3..0000000000
--- a/osgi/integrationtest/src/test/resources/ValidationMessages.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Hibernate Validator, declare and validate application constraints
-#
-# License: Apache License, Version 2.0
-# See the license.txt file in the root directory or .
-#
-com.example.RetailOrder.name.message=Not a valid retail order name
diff --git a/osgi/integrationtest/src/test/resources/log4j.properties b/osgi/integrationtest/src/test/resources/log4j.properties
deleted file mode 100644
index 6e6c7c0720..0000000000
--- a/osgi/integrationtest/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-### direct log messages to stdout ###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### set log levels - for more verbose logging change 'info' to 'debug' ###
-log4j.rootLogger=debug, stdout
diff --git a/osgi/karaf-features/pom.xml b/osgi/karaf-features/pom.xml
deleted file mode 100644
index c8f5e3c91a..0000000000
--- a/osgi/karaf-features/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.hibernate.validator
- hibernate-validator-osgi
- 8.0.0-SNAPSHOT
-
-
- hibernate-validator-osgi-karaf-features
- pom
-
- Hibernate Validator Karaf Features
- Hibernate Validator features for Apache Karaf
-
-
- ../..
-
-
-
-
-
- org.apache.maven.plugins
- maven-resources-plugin
-
-
- features
- generate-resources
-
- copy-resources
-
-
-
-
- src/main/features
- true
-
-
- target/features
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
-
-
- attach-artifacts
- package
-
- attach-artifact
-
-
-
-
- target/features/features.xml
- xml
- features
-
-
-
-
-
-
-
- maven-checkstyle-plugin
-
-
- de.thetaphi
- forbiddenapis
-
-
-
-
diff --git a/osgi/karaf-features/src/main/features/features.xml b/osgi/karaf-features/src/main/features/features.xml
deleted file mode 100644
index ece1dc5284..0000000000
--- a/osgi/karaf-features/src/main/features/features.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
- mvn:org.hibernate.validator/hibernate-validator/${project.version}
- mvn:jakarta.validation/jakarta.validation-api/${version.jakarta.validation-api}
-
- mvn:org.jboss.logging/jboss-logging/${version.org.jboss.logging.jboss-logging}
- mvn:com.fasterxml/classmate/${version.com.fasterxml.classmate}
- mvn:jakarta.el/jakarta.el-api/${version.jakarta.el-api}
- mvn:org.glassfish.expressly/expressly/${version.org.glassfish.expressly}
-
-
- hibernate-validator
- mvn:joda-time/joda-time/${version.joda-time}
-
-
- hibernate-validator
- mvn:javax.money/money-api/${version.javax.money}
- mvn:org.javamoney/moneta/${version.org.javamoney.moneta}
-
-
- hibernate-validator
- mvn:org.codehaus.groovy/groovy-all/${version.org.codehaus.groovy}
-
-
- wrap
- hibernate-validator
- wrap:mvn:com.thoughtworks.paranamer/paranamer/${version.com.thoughtworks.paranamer}
-
-
diff --git a/osgi/pom.xml b/osgi/pom.xml
deleted file mode 100644
index 9a323b4251..0000000000
--- a/osgi/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.hibernate.validator
- hibernate-validator-parent
- 8.0.0-SNAPSHOT
-
-
- hibernate-validator-osgi
- pom
-
- Hibernate Validator OSGi Modules
- Hibernate Validator OSGi modules aggregator
-
-
- ..
-
-
-
- karaf-features
- integrationtest
-
-
-
-
- testWithJdk8
-
-
- java-version.test.release
- 8
-
-
-
-
- felixtest
-
-
-
-
diff --git a/pom.xml b/pom.xml
index 22ac33c52c..1a458c9199 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
pom
Hibernate Validator Aggregator
- http://hibernate.org/validator
+ https://hibernate.org/validator
Aggregator of the Hibernate Validator modules.
@@ -211,7 +211,6 @@
4.2.0
4.12.0
2.5.4
- 6.0.0
5.2020.2
2.3.1
@@ -462,11 +461,6 @@
byte-buddy
${version.net.bytebuddy.byte-buddy}