Package info.archinnov.achilles.test.integration.entity

Examples of info.archinnov.achilles.test.integration.entity.ClusteredEntityWithOnlyStaticColumns


    @Test
    public void should_lazy_load_all_static_columns() throws Exception {
        //Given
        Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        ClusteredEntityWithOnlyStaticColumns location = new ClusteredEntityWithOnlyStaticColumns(new ClusteredOnlyStaticColumnsKey(partitionKey, "location"), "Paris", "rue de la paix");

        manager.insert(location);

        //When
        ClusteredEntityWithOnlyStaticColumns proxy = manager.getProxy(ClusteredEntityWithOnlyStaticColumns.class, location.getId());
        assertThat(proxy.getCity()).isEqualTo("Paris");
        assertThat(proxy.getStreet()).isEqualTo("rue de la paix");

        proxy.setCity("Lyon");
        proxy.setStreet("rue Lamartine");
        manager.update(proxy);

        //Then
        final ClusteredEntityWithOnlyStaticColumns updated = manager.find(ClusteredEntityWithOnlyStaticColumns.class, location.getId());
        assertThat(updated.getCity()).isEqualTo("Lyon");
        assertThat(updated.getStreet()).isEqualTo("rue Lamartine");
    }
View Full Code Here


    @Test
    public void should_delete_all_static_columns() throws Exception {
        //Given
        Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        ClusteredEntityWithOnlyStaticColumns location = new ClusteredEntityWithOnlyStaticColumns(new ClusteredOnlyStaticColumnsKey(partitionKey, "location"), "Paris", "rue de la paix");

        final ClusteredEntityWithOnlyStaticColumns managed = manager.insert(location);

        //When
        manager.delete(managed);

        //Then
        final ClusteredEntityWithOnlyStaticColumns found = manager.find(ClusteredEntityWithOnlyStaticColumns.class, location.getId());

        //When
        assertThat(found).isNull();
    }
View Full Code Here

    /////////////////////// ONLY STATIC SIMPLE COLUMNS ////////////////////////////////
    @Test
    public void should_query_all_static_columns() throws Exception {
        Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        ClusteredEntityWithOnlyStaticColumns location = new ClusteredEntityWithOnlyStaticColumns(new ClusteredOnlyStaticColumnsKey(partitionKey, "location"), "Paris", "rue de la paix");

        manager.insert(location);

        List<ClusteredEntityWithOnlyStaticColumns> found = manager.sliceQuery(ClusteredEntityWithOnlyStaticColumns.class)
                .forSelect()
                .withPartitionComponents(partitionKey)
                .get(100);

        assertThat(found).hasSize(1);
        final ClusteredEntityWithOnlyStaticColumns foundLocation = found.get(0);

        assertThat(foundLocation.getCity()).isEqualTo("Paris");
        assertThat(foundLocation.getStreet()).isEqualTo("rue de la paix");
    }
View Full Code Here

    @Test
    public void should_update_all_static_columns() throws Exception {
        //Given
        Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        ClusteredEntityWithOnlyStaticColumns location = new ClusteredEntityWithOnlyStaticColumns(new ClusteredOnlyStaticColumnsKey(partitionKey, "location"), "Paris", "rue de la paix");

        final ClusteredEntityWithOnlyStaticColumns managed = manager.insert(location);

        //When
        managed.setCity("Lyon");
        managed.setStreet("rue Lamartine");
        manager.update(managed);

        //Then
        final ClusteredEntityWithOnlyStaticColumns updated = manager.find(ClusteredEntityWithOnlyStaticColumns.class, location.getId());
        assertThat(updated.getCity()).isEqualTo("Lyon");
        assertThat(updated.getStreet()).isEqualTo("rue Lamartine");
    }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.test.integration.entity.ClusteredEntityWithOnlyStaticColumns

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.