Package com.datastax.driver.core

Examples of com.datastax.driver.core.Row


    @Test
    public void should_dirty_check_assign_new_value_to_list() throws Exception {
        bean.setFriends(asList("qux", "tux"));
        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        List<String> friends = row.getList("friends", String.class);
        assertThat(friends).containsOnly("qux", "tux");
    }
View Full Code Here


    public void should_dirty_check_list_element_add() throws Exception {
        bean.getFriends().add("qux");
        bean.getFriends().addAll(asList("qux", "qux"));
        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        List<String> friends = row.getList("friends", String.class);

        assertThat(friends).hasSize(5);
        assertThat(friends.get(2)).isEqualTo("qux");
        assertThat(friends.get(3)).isEqualTo("qux");
        assertThat(friends.get(4)).isEqualTo("qux");
View Full Code Here

    @Test
    public void should_dirty_check_list_element_clear() throws Exception {
        bean.getFriends().clear();
        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        assertThat(row.isNull("friends")).isTrue();
    }
View Full Code Here

    public void should_dirty_check_list_element_clear_then_append() throws Exception {
        bean.getFriends().clear();
        bean.getFriends().add("qux");
        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        assertThat(row.getList("friends", String.class)).containsExactly("qux");
    }
View Full Code Here

    public void should_dirty_check_list_element_prepend() throws Exception {
        bean.getFriends().add(0, "one");
        bean.getFriends().addAll(0, asList("two", "three"));
        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        List<String> friends = row.getList("friends", String.class);

        assertThat(friends).hasSize(5);
        assertThat(friends.get(0)).isEqualTo("three");
        assertThat(friends.get(1)).isEqualTo("two");
        assertThat(friends.get(2)).isEqualTo("one");
View Full Code Here

        bean.getFriends().add("qux");
        bean.getFriends().remove(0);

        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        List<String> friends = row.getList("friends", String.class);

        assertThat(friends).hasSize(2);
        assertThat(friends.get(0)).isEqualTo("bar");
        assertThat(friends.get(1)).isEqualTo("qux");
    }
View Full Code Here

        bean.getFriends().remove(0);
        bean.getFriends().remove(0);

        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        List<String> friends = row.getList("friends", String.class);

        assertThat(friends).hasSize(1);
        assertThat(friends.get(0)).isEqualTo("qux");
    }
View Full Code Here

        bean.getFriends().remove("foo");
        bean.getFriends().removeAll(asList("bar"));

        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        List<String> friends = row.getList("friends", String.class);

        assertThat(friends).hasSize(4);
        assertThat(friends.get(0)).isEqualTo("qux");
        assertThat(friends.get(1)).isEqualTo("tux");
        assertThat(friends.get(2)).isEqualTo("foo");
View Full Code Here

    public void should_dirty_check_list_element_remove_all() throws Exception {
        bean.getFriends().removeAll(asList("foo", "qux"));

        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        List<String> friends = row.getList("friends", String.class);

        assertThat(friends).hasSize(1);
        assertThat(friends.get(0)).isEqualTo("bar");
    }
View Full Code Here

    public void should_dirty_check_list_element_retain_all() throws Exception {
        bean.getFriends().retainAll(asList("foo", "qux"));

        manager.update(bean);

        Row row = session.execute("select friends from CompleteBean where id=" + bean.getId()).one();
        List<String> friends = row.getList("friends", String.class);

        assertThat(friends).hasSize(1);
        assertThat(friends.get(0)).isEqualTo("foo");
    }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.Row

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.