Package javax.validation

Examples of javax.validation.BootstrapConfiguration


    return createInstance( messageInterpolatorClass );
  }

  private TraversableResolver createTraversableResolver(Configuration config) {
    BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
    String traversableResolverFqcn = bootstrapConfiguration.getTraversableResolverClassName();

    if ( traversableResolverFqcn == null ) {
      return config.getDefaultTraversableResolver();
    }
View Full Code Here


    return createInstance( traversableResolverClass );
  }

  private ParameterNameProvider createParameterNameProvider(Configuration config) {
    BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
    String parameterNameProviderFqcn = bootstrapConfiguration.getParameterNameProviderClassName();

    if ( parameterNameProviderFqcn == null ) {
      return config.getDefaultParameterNameProvider();
    }
View Full Code Here

    return createInstance( parameterNameProviderClass );
  }

  private ConstraintValidatorFactory createConstraintValidatorFactory(Configuration config) {
    BootstrapConfiguration configSource = config.getBootstrapConfiguration();
    String constraintValidatorFactoryFqcn = configSource.getConstraintValidatorFactoryClassName();

    if ( constraintValidatorFactoryFqcn == null ) {
      // use default
      return createInstance( InjectingConstraintValidatorFactory.class );
    }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "5.5.3", id = "f")
  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 )
    );
  }
View Full Code Here

  @SpecAssertions({
      @SpecAssertion(section = "5.5.3", id = "f"),
      @SpecAssertion(section = "5.5.6", id = "l")
  })
  public void testGetDefaultValidatedExecutableTypesReturnsSetWithAllOptionsIfALLAndNONEAreContained() {
    BootstrapConfiguration bootstrapConfiguration = TestUtil.getConfigurationUnderTest()
        .getBootstrapConfiguration();

    assertNotNull( bootstrapConfiguration );
    assertEquals(
        bootstrapConfiguration.getDefaultValidatedExecutableTypes(),
        EnumSet.of(
            ExecutableType.CONSTRUCTORS,
            ExecutableType.GETTER_METHODS,
            ExecutableType.NON_GETTER_METHODS
        )
View Full Code Here

  }

  @Test(expectedExceptions = ValidationException.class)
  @SpecAssertion(section = "5.5.3", id = "f")
  public void testEmptyExecutableTypesCauseValidationException() {
    BootstrapConfiguration bootstrapConfiguration = TestUtil.getConfigurationUnderTest()
        .getBootstrapConfiguration();

    bootstrapConfiguration.getDefaultValidatedExecutableTypes();
  }
View Full Code Here

  }

  @Test
  @SpecAssertion(section = "5.5.3", id = "f")
  public void testGetBootstrapConfigurationNoValidationXml() {
    BootstrapConfiguration bootstrapConfiguration = TestUtil.getConfigurationUnderTest()
        .getBootstrapConfiguration();

    assertNotNull( bootstrapConfiguration );

    assertNotNull( bootstrapConfiguration.getConstraintMappingResourcePaths() );
    assertTrue( bootstrapConfiguration.getConstraintMappingResourcePaths().isEmpty() );

    assertNull( bootstrapConfiguration.getConstraintValidatorFactoryClassName() );
    assertNull( bootstrapConfiguration.getDefaultProviderClassName() );
    assertNull( bootstrapConfiguration.getMessageInterpolatorClassName() );
    assertNull( bootstrapConfiguration.getParameterNameProviderClassName() );

    assertNotNull( bootstrapConfiguration.getDefaultValidatedExecutableTypes() );
    assertEquals(
        bootstrapConfiguration.getDefaultValidatedExecutableTypes(),
        EnumSet.of( ExecutableType.CONSTRUCTORS, ExecutableType.NON_GETTER_METHODS )
    );

    assertNotNull( bootstrapConfiguration.getProperties() );
    assertTrue( bootstrapConfiguration.getProperties().isEmpty() );

    assertNull( bootstrapConfiguration.getTraversableResolverClassName() );
  }
View Full Code Here

  @SpecAssertions({
      @SpecAssertion(section = "5.5.3", id = "f"),
      @SpecAssertion(section = "5.5.6", id = "l")
  })
  public void testGetDefaultValidatedExecutableTypesReturnsSetWithAllOptionsIfALLIsContained() {
    BootstrapConfiguration bootstrapConfiguration = TestUtil.getConfigurationUnderTest()
        .getBootstrapConfiguration();

    assertNotNull( bootstrapConfiguration );
    assertEquals(
        bootstrapConfiguration.getDefaultValidatedExecutableTypes(),
        EnumSet.of(
            ExecutableType.CONSTRUCTORS,
            ExecutableType.GETTER_METHODS,
            ExecutableType.NON_GETTER_METHODS
        )
View Full Code Here

  @SpecAssertions({
      @SpecAssertion(section = "5.5.3", id = "f"),
      @SpecAssertion(section = "5.5.6", id = "l")
  })
  public void testGetDefaultValidatedExecutableTypesReturnsEmptySetIfNONEIsContained() {
    BootstrapConfiguration bootstrapConfiguration = TestUtil.getConfigurationUnderTest()
        .getBootstrapConfiguration();

    assertNotNull( bootstrapConfiguration );

    assertEquals( bootstrapConfiguration.getDefaultValidatedExecutableTypes(), EnumSet.noneOf( ExecutableType.class ) );
  }
View Full Code Here

  @SpecAssertions({
      @SpecAssertion(section = "5.5.3", id = "f"),
      @SpecAssertion(section = "5.5.6", id = "l")
  })
  public void testGetDefaultValidatedExecutableTypesReturnsSetWithConfiguredValues() {
    BootstrapConfiguration bootstrapConfiguration = TestUtil.getConfigurationUnderTest()
        .getBootstrapConfiguration();

    assertNotNull( bootstrapConfiguration );
    assertEquals(
        bootstrapConfiguration.getDefaultValidatedExecutableTypes(),
        EnumSet.of( ExecutableType.CONSTRUCTORS, ExecutableType.NON_GETTER_METHODS )
    );
  }
View Full Code Here

TOP

Related Classes of javax.validation.BootstrapConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.