Package com.datastax.driver.core.querybuilder.Update

Examples of com.datastax.driver.core.querybuilder.Update.Conditions


    @Test
    public void should_generate_update_for_remove_list_element_with_bind_marker() throws Exception {
        //Given
        changeSet.listChanges.add("a");
        final Conditions update = update();
        when(pm.forStatementGeneration().generateUpdateForRemoveListElements(update)).thenReturn(update.with(discardAll("property", bindMarker("property"))));

        //When
        changeSet.generateUpdateForRemoveListElements(update);

        //Then
View Full Code Here


    @Test
    public void should_generate_update_for_set_element_at_index() throws Exception {
        //Given
        changeSet.listChangeAtIndex = new ElementAtIndex(1, "a");
        final Conditions update = update();
        when(pm.forTranscoding().<List<Object>>encodeToCassandra(Arrays.asList("a"))).thenReturn(Arrays.<Object>asList("a"));
        when(pm.forStatementGeneration().generateUpdateForSetAtIndexElement(update, 1, "a")).thenReturn(update.with(setIdx("property", 1, bindMarker())));

        //When
        Object[] vals = changeSet.generateUpdateForSetAtIndexElement(update).right;

        //Then
View Full Code Here

    @Test
    public void should_generate_update_for_remove_element_at_index() throws Exception {
        //Given
        changeSet.listChangeAtIndex = new ElementAtIndex(1, "a");
        final Conditions update = update();
        when(pm.forTranscoding().<List<Object>>encodeToCassandra(Arrays.asList("a"))).thenReturn(Arrays.<Object>asList("a"));
        when(pm.forStatementGeneration().generateUpdateForSetAtIndexElement(update, 1, "a")).thenReturn(update.with(setIdx("property", 1, null)));

        //When
        Object[] vals = changeSet.generateUpdateForRemovedAtIndexElement(update).right;

        //Then
View Full Code Here

    @Test
    public void should_generate_update_for_added_entries() throws Exception {
        //Given
        changeSet.mapChanges.put(1, "a");
        final Conditions update = update();
        when(pm.forStatementGeneration().generateUpdateForAddedEntries(update)).thenReturn(update.with(putAll("property", bindMarker())));

        //When
        changeSet.generateUpdateForAddedEntries(update);

        //Then
View Full Code Here

    @Test
    public void should_generate_update_for_added_entries_with_bind_marker() throws Exception {
        //Given
        changeSet.mapChanges.put(1, "a");
        final Conditions update = update();
        when(pm.forStatementGeneration().generateUpdateForAddedEntries(update)).thenReturn(update.with(putAll("property", bindMarker("property"))));

        //When
        changeSet.generateUpdateForAddedEntries(update);

        //Then
View Full Code Here

    @Test
    public void should_generate_update_for_removed_key() throws Exception {
        //Given
        changeSet.mapChanges.put(1, "a");
        final Conditions update = update();
        when(pm.forStatementGeneration().generateUpdateForRemovedKey(update)).thenReturn(update.with(put("property", 1, null)));

        //When
        changeSet.generateUpdateForRemovedKey(update);

        //Then
View Full Code Here

    @Test
    public void should_generate_update_for_removed_key_with_bind_marker() throws Exception {
        //Given
        changeSet.mapChanges.put(1, "a");
        final Conditions update = update();
        when(pm.forStatementGeneration().generateUpdateForRemovedKey(update)).thenReturn(update.with(put("property", bindMarker("key"), bindMarker("nullValue"))));

        //When
        changeSet.generateUpdateForRemovedKey(update);

        //Then
View Full Code Here


    @Test
    public void should_generate_update_for_remove_all() throws Exception {
        //When
        final Conditions update = update();
        when(pm.forStatementGeneration().generateUpdateForRemoveAll(update)).thenReturn(update.with(set("property", null)));

        changeSet.generateUpdateForRemoveAll(update);

        //Then
        assertThat(conditions.getQueryString()).isEqualTo("UPDATE table SET property=null;");
View Full Code Here

    }

    @Test
    public void should_generate_update_for_remove_all_with_bind_marker() throws Exception {
        //When
        final Conditions update = update();
        when(pm.forStatementGeneration().generateUpdateForRemoveAll(update)).thenReturn(update.with(set("property", bindMarker("property"))));

        changeSet.generateUpdateForRemoveAll(update);

        //Then
        assertThat(conditions.getQueryString()).isEqualTo("UPDATE table SET property=:property;");
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.querybuilder.Update.Conditions

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.