-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DEBUG: figure out why TCK test failing on CI only
- Loading branch information
1 parent
7a0814a
commit 01764c3
Showing
4 changed files
with
156 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
...a/org/hibernate/validator/tckrunner/securitymanager/debug/BootstrapConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/** | ||
* Jakarta Bean Validation TCK | ||
* <p> | ||
* License: Apache License, Version 2.0 | ||
* See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. | ||
*/ | ||
package org.hibernate.validator.tckrunner.securitymanager.debug; | ||
|
||
import static org.hibernate.beanvalidation.tck.util.TestUtil.asSet; | ||
import static org.testng.Assert.assertEquals; | ||
import static org.testng.Assert.assertNotNull; | ||
|
||
import java.io.File; | ||
import java.net.URL; | ||
import java.util.Arrays; | ||
import java.util.EnumSet; | ||
|
||
import org.hibernate.beanvalidation.tck.tests.AbstractTCKTest; | ||
import org.hibernate.beanvalidation.tck.util.TestUtil; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
|
||
import com.beust.jcommander.JCommander; | ||
import jakarta.validation.BootstrapConfiguration; | ||
import jakarta.validation.executable.ExecutableType; | ||
import org.assertj.core.api.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* @author Gunnar Morling | ||
*/ | ||
public class BootstrapConfigurationTest extends AbstractTCKTest { | ||
|
||
@Deployment | ||
public static WebArchive createTestArchive() { | ||
URL[] libs = new URL[] { | ||
Assert.class.getProtectionDomain() | ||
.getCodeSource() | ||
.getLocation(), | ||
JCommander.class.getProtectionDomain() | ||
.getCodeSource() | ||
.getLocation() | ||
}; | ||
for ( URL lib : libs ) { | ||
System.err.println( lib ); | ||
File file = new File( lib.getFile() ); | ||
System.err.println( "file.exists() = " + file.exists() ); | ||
System.err.println( "file.isFile() = " + file.isFile() ); | ||
System.err.println( "file.listFiles() = " + Arrays.toString( file.listFiles() ) ); | ||
} | ||
|
||
return webArchiveBuilder() | ||
.withTestClass( BootstrapConfigurationTest.class ) | ||
.withValidationXml( "validation-BootstrapConfigurationTest.xml" ) | ||
.build(); | ||
} | ||
|
||
@Test | ||
public void testGetBootstrapConfiguration() { | ||
BootstrapConfiguration bootstrapConfiguration = TestUtil.getConfigurationUnderTest() | ||
.getBootstrapConfiguration(); | ||
|
||
assertNotNull( bootstrapConfiguration ); | ||
|
||
assertNotNull( bootstrapConfiguration.getConstraintMappingResourcePaths() ); | ||
assertEquals( | ||
bootstrapConfiguration.getConstraintMappingResourcePaths(), | ||
asSet( "mapping1", "mapping2" ) | ||
); | ||
|
||
assertEquals( | ||
bootstrapConfiguration.getConstraintValidatorFactoryClassName(), | ||
"com.acme.ConstraintValidatorFactory" | ||
); | ||
assertEquals( | ||
bootstrapConfiguration.getDefaultProviderClassName(), | ||
"com.acme.ValidationProvider" | ||
); | ||
assertEquals( | ||
bootstrapConfiguration.getMessageInterpolatorClassName(), | ||
"com.acme.MessageInterpolator" | ||
); | ||
assertEquals( | ||
bootstrapConfiguration.getParameterNameProviderClassName(), | ||
"com.acme.ParameterNameProvider" | ||
); | ||
|
||
assertNotNull( bootstrapConfiguration.getProperties() ); | ||
assertEquals( bootstrapConfiguration.getProperties().size(), 2 ); | ||
assertEquals( bootstrapConfiguration.getProperties().get( "com.acme.Foo" ), "Bar" ); | ||
assertEquals( bootstrapConfiguration.getProperties().get( "com.acme.Baz" ), "Qux" ); | ||
|
||
assertEquals( | ||
bootstrapConfiguration.getTraversableResolverClassName(), | ||
"com.acme.TraversableResolver" | ||
); | ||
|
||
assertNotNull( bootstrapConfiguration.getDefaultValidatedExecutableTypes() ); | ||
assertEquals( | ||
bootstrapConfiguration.getDefaultValidatedExecutableTypes(), | ||
EnumSet.of( ExecutableType.CONSTRUCTORS, ExecutableType.NON_GETTER_METHODS ) | ||
); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...rnate/validator/tckrunner/securitymanager/debug/validation-BootstrapConfigurationTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Jakarta Bean Validation TCK | ||
License: Apache License, Version 2.0 | ||
See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>. | ||
--> | ||
<validation-config | ||
xmlns="https://jakarta.ee/xml/ns/validation/configuration" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://jakarta.ee/xml/ns/validation/configuration validation-configuration-3.0.xsd" | ||
version="3.0"> | ||
|
||
<default-provider>com.acme.ValidationProvider</default-provider> | ||
<message-interpolator>com.acme.MessageInterpolator</message-interpolator> | ||
<traversable-resolver>com.acme.TraversableResolver</traversable-resolver> | ||
<constraint-validator-factory>com.acme.ConstraintValidatorFactory</constraint-validator-factory> | ||
<parameter-name-provider>com.acme.ParameterNameProvider</parameter-name-provider> | ||
<constraint-mapping>mapping1</constraint-mapping> | ||
<constraint-mapping>mapping2</constraint-mapping> | ||
<property name="com.acme.Foo">Bar</property> | ||
<property name="com.acme.Baz">Qux</property> | ||
</validation-config> |