Skip to content

Commit

Permalink
DEBUG: figure out why TCK test failing on CI only
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-bekhta committed Apr 19, 2024
1 parent 7a0814a commit e232f02
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@
<version.org.openjfx>22.0.1</version.org.openjfx>

<!-- Test dependencies -->
<version.org.jboss.arquillian>1.8.0.Final</version.org.jboss.arquillian>
<version.org.testng>7.10.1</version.org.testng>
<version.org.jboss.arquillian>1.7.0.Alpha10</version.org.jboss.arquillian>
<version.org.testng>6.14.3</version.org.testng>
<!-- it must be the exact same version than the one used in the Bean Validation TCK -->
<version.org.assertj.assertj-core>3.8.0</version.org.assertj.assertj-core>
<version.junit>4.13.2</version.junit>
Expand All @@ -178,7 +178,7 @@
<version.org.apache.groovy>4.0.21</version.org.apache.groovy>
<version.com.google.guava>33.1.0-jre</version.com.google.guava>
<version.org.springframework.spring-expression>6.1.6</version.org.springframework.spring-expression>
<version.org.jboss.arquillian.container.arquillian-weld-embedded>4.0.0.Final</version.org.jboss.arquillian.container.arquillian-weld-embedded>
<version.org.jboss.arquillian.container.arquillian-weld-embedded>3.0.2.Final</version.org.jboss.arquillian.container.arquillian-weld-embedded>
<version.com.fasterxml.jackson.core.jackson-databind>2.17.0</version.com.fasterxml.jackson.core.jackson-databind>
<version.com.fasterxml.jackson.core.jackson-annotations>2.17.0</version.com.fasterxml.jackson.core.jackson-annotations>
<version.net.bytebuddy.byte-buddy>1.14.13</version.net.bytebuddy.byte-buddy>
Expand Down
33 changes: 23 additions & 10 deletions tck-runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,27 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${tck.suite.file}</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<validation.provider>${validation.provider}</validation.provider>
</systemPropertyVariables>
</configuration>
<executions>
<!-- <execution>-->
<!-- <id>tck</id>-->
<!-- <configuration>-->
<!-- <suiteXmlFiles>-->
<!-- <suiteXmlFile>${tck.suite.file}</suiteXmlFile>-->
<!-- </suiteXmlFiles>-->
<!-- <systemPropertyVariables>-->
<!-- <validation.provider>${validation.provider}</validation.provider>-->
<!-- </systemPropertyVariables>-->
<!-- </configuration>-->
<!-- </execution>-->
<execution>
<id>local</id>
<configuration>
<systemPropertyVariables>
<validation.provider>${validation.provider}</validation.provider>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -198,9 +211,9 @@
</activation>
<properties>
<!-- Use Local for testing without security manager -->
<arquillian.protocol>LocalSecurityManagerTesting</arquillian.protocol>
<arquillian.protocol>Local</arquillian.protocol>
<!-- Remove for testing without security manager -->
<surefire.jvm.args.additional>-DincludeJavaFXTests=true -Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/test.policy -Duser.language=en -Duser.country=US</surefire.jvm.args.additional>
<!-- <surefire.jvm.args.additional>-DincludeJavaFXTests=true -Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/test.policy -Duser.language=en -Duser.country=US</surefire.jvm.args.additional>-->
<!-- Uncomment the following line to obtain the access log of the security manager -->
<!--<surefire.jvm.args.additional>-DincludeJavaFXTests=true -Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/test.policy -Djava.security.debug=access -Duser.language=en -Duser.country=US</surefire.jvm.args.additional>-->
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* 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>.
*/
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.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 jakarta.validation.BootstrapConfiguration;
import jakarta.validation.executable.ExecutableType;
import org.testng.annotations.Test;

/**
* @author Gunnar Morling
*/
public class BootstrapConfigurationTest extends AbstractTCKTest {

@Deployment
public static WebArchive createTestArchive() {
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 )
);
}
}
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>

0 comments on commit e232f02

Please sign in to comment.