Package info.archinnov.achilles.test.parser.entity

Examples of info.archinnov.achilles.test.parser.entity.EmbeddedKey


    }

    @Test
    public void should_set_compound_key_to_entity() throws Exception {
        //Given
        EmbeddedKey embeddedKey = new EmbeddedKey();
        PropertyMetaRowExtractor rowExtractor = mock(PropertyMetaRowExtractor.class);
        when(pm.forRowExtraction()).thenReturn(rowExtractor);
        when(pm.structure().isEmbeddedId()).thenReturn(true);
        when(rowExtractor.extractCompoundPrimaryKeyFromRow(row, entityMeta, MANAGED)).thenReturn(embeddedKey);
View Full Code Here


    }

    @Test
    public void should_map_row_to_entity_with_primary_key() throws Exception {
        ClusteredEntity entity = new ClusteredEntity();
        EmbeddedKey embeddedKey = new EmbeddedKey();
        PropertyMeta idMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);

        when(idMeta.structure().isEmbeddedId()).thenReturn(true);

        Map<String, PropertyMeta> propertiesMap = new HashMap<>();
View Full Code Here

  }

  @Test
  public void should_validate_clustered_id() throws Exception {
    CompleteBean bean = CompleteBeanTestBuilder.builder().id(12L).buid();
    EmbeddedKey clusteredId = new EmbeddedKey(11L, "name");

    when(entityMeta.forOperations().getPrimaryKey(bean)).thenReturn(clusteredId);
        when(proxifier.getRealObject(bean)).thenReturn(bean);
    when(idMeta.structure().isEmbeddedId()).thenReturn(true);
    when(idMeta.forTranscoding().encodeToComponents(clusteredId,true)).thenReturn(Arrays.<Object> asList(11L, "name"));
View Full Code Here

    public void should_bind_for_insert_with_compound_key() throws Exception {
        long userId = RandomUtils.nextLong(0,Long.MAX_VALUE);
        String name = "name";
        String address = "30 WallStreet";
        int age = 30;
        EmbeddedKey primaryKey = new EmbeddedKey(userId, name);

        PropertyMeta addressMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);
        PropertyMeta ageMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);

        when(overrider.getWriteLevel(context)).thenReturn(ALL);
View Full Code Here

    @Test
    public void should_bind_with_only_pk_in_where_clause() throws Exception {
        long userId = RandomUtils.nextLong(0,Long.MAX_VALUE);
        String name = "name";
        EmbeddedKey primaryKey = new EmbeddedKey(userId, name);

        when(overrider.getWriteLevel(context)).thenReturn(ALL);
        when(context.getPrimaryKey()).thenReturn(primaryKey);
        when(idMeta.structure().isEmbeddedId()).thenReturn(true);
        when(idMeta.forTranscoding().encodeToComponents(primaryKey, true)).thenReturn(Arrays.<Object>asList(userId, name));
View Full Code Here

    assertThat(invoker.getPrimaryKey(null, idMeta)).isNull();
  }

  @Test
  public void should_instanciate_entity_from_class() throws Exception {
    EmbeddedKey actual = invoker.instantiate(EmbeddedKey.class);
    assertThat(actual).isNotNull();
    assertThat(actual.getUserId()).isNull();
    assertThat(actual.getName()).isNull();
  }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.test.parser.entity.EmbeddedKey

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.