Package org.hibernate.ogm.options.container.impl

Examples of org.hibernate.ogm.options.container.impl.OptionsContainer


    mongoOptions
      .entity( MyEntity.class )
        .property( "content", ElementType.FIELD )
        .readPreference( ReadPreferenceType.NEAREST );

    OptionsContainer options = getSource().getPropertyOptions( MyEntity.class, "content" );
    assertThat( options.getUnique( ReadPreferenceOption.class ) ).isEqualTo( ReadPreference.nearest() );
  }
View Full Code Here


    source = new AnnotationOptionValueSource();
  }

  @Test
  public void testAssociationStorageMappingOptionOnField() throws Exception {
    OptionsContainer fieldOptions = source.getPropertyOptions( EntityAnnotatedOnField.class, "field" );
    assertThat( fieldOptions.getUnique( AssociationStorageOption.class ) ).isEqualTo( AssociationStorageType.IN_ENTITY );
  }
View Full Code Here

    assertThat( fieldOptions.getUnique( AssociationStorageOption.class ) ).isEqualTo( AssociationStorageType.IN_ENTITY );
  }

  @Test
  public void testAssociationStorageMappingOptionOnMethod() throws Exception {
    OptionsContainer methodOptions = source.getPropertyOptions( EntityAnnotatedOnMethod.class, "method" );
    assertThat( methodOptions.getUnique( AssociationStorageOption.class ) ).isEqualTo( AssociationStorageType.ASSOCIATION_DOCUMENT );
  }
View Full Code Here

    new MongoDB().getConfigurationBuilder( configurationContext )
      .entity( ExampleForMongoDBMapping.class )
        .property( "content", ElementType.FIELD )
          .associationStorage( AssociationStorageType.ASSOCIATION_DOCUMENT );

    OptionsContainer options = new ProgrammaticOptionValueSource( context ).getPropertyOptions( ExampleForMongoDBMapping.class, "content" );
    assertThat( options.getUnique( AssociationStorageOption.class ) ).isEqualTo( AssociationStorageType.ASSOCIATION_DOCUMENT );
  }
View Full Code Here

    source = new AnnotationOptionValueSource();
  }

  @Test
  public void testAnnotatedEntity() throws Exception {
    OptionsContainer entityOptions = source.getEntityOptions( Example.class );
    assertThat( entityOptions.getUnique( NameExampleOption.class ) ).isEqualTo( "Batman" );
  }
View Full Code Here

    assertThat( entityOptions.getUnique( NameExampleOption.class ) ).isEqualTo( "Batman" );
  }

  @Test
  public void testAnnotationGivenOnPropertyCanBeRetrievedFromOptionsContext() {
    OptionsContainer propertyOptions = source.getPropertyOptions( Example.class, "exampleProperty" );
    assertThat( propertyOptions.getUnique( EmbedExampleOption.class ) ).isEqualTo( "Test" );
  }
View Full Code Here

    assertThat( propertyOptions.getUnique( EmbedExampleOption.class ) ).isEqualTo( "Test" );
  }

  @Test
  public void testAnnotationGivenOnBooleanPropertyCanBeRetrievedFromOptionsContext() {
    OptionsContainer propertyOptions = source.getPropertyOptions( Example.class, "helpful" );
    assertThat( propertyOptions.getUnique( EmbedExampleOption.class ) ).isEqualTo( "Another Test" );
  }
View Full Code Here

    assertThat( propertyOptions.getUnique( EmbedExampleOption.class ) ).isEqualTo( "Another Test" );
  }

  @Test
  public void testAnnotationGivenOnPrivateFieldCanBeRetrievedFromOptionsContext() {
    OptionsContainer propertyOptions = source.getPropertyOptions( Example.class, "anotherProperty" );
    assertThat( propertyOptions.getUnique( EmbedExampleOption.class ) ).isEqualTo( "Yet Another Test" );
  }
View Full Code Here

  public void shouldBeAbleToAddEntityOption() throws Exception {
    configuration
      .entity( ContextExample.class )
        .force( true );

    OptionsContainer optionsContainer = getSource().getEntityOptions( ContextExample.class );
    assertThat( optionsContainer.getUnique( ForceExampleOption.class ) ).isTrue();
  }
View Full Code Here

    configuration
      .entity( Refrigerator.class )
        .force( true )
        .name( "test" );

    OptionsContainer refrigatorOptions = getSource().getEntityOptions( Refrigerator.class );

    assertThat( refrigatorOptions.getUnique( ForceExampleOption.class ) ).isTrue();
    assertThat( refrigatorOptions.getUnique( NameExampleOption.class ) ).isEqualTo( "test" );
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.options.container.impl.OptionsContainer

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.