Package com.datastax.driver.core

Examples of com.datastax.driver.core.RegularStatement


        verify(context).pushCounterStatement(bsWrapper);
    }

    @Test
    public void should_prepare_statement() throws Exception {
        RegularStatement statement = new SimpleStatement("query");
        when(session.prepare("query")).thenReturn(ps);

        assertThat(daoContext.prepare(statement)).isSameAs(ps);
    }
View Full Code Here


        when(meta.structure().isEmbeddedId()).thenReturn(true);
        when(embeddedIdProperties.getCQL3ComponentNames()).thenReturn(asList("id", "name"));
        Select select = QueryBuilder.select().from("table");

        //When
        final RegularStatement actual = view.generateWhereClauseForSelect(pmO, select);

        //Then
        assertThat(actual.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id AND name=:name;");
    }
View Full Code Here

        when(meta.structure().isEmbeddedId()).thenReturn(true);
        when(embeddedIdProperties.getPartitionComponents().getCQL3ComponentNames()).thenReturn(asList("id"));
        Select select = QueryBuilder.select().from("table");

        //When
        final RegularStatement actual = view.generateWhereClauseForSelect(pmO, select);

        //Then
        assertThat(actual.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id;");
    }
View Full Code Here

        when(meta.structure().isEmbeddedId()).thenReturn(false);
        when(meta.getCQL3ColumnName()).thenReturn("id");
        Select select = QueryBuilder.select().from("table");

        //When
        final RegularStatement actual = view.generateWhereClauseForSelect(pmO, select);

        //Then
        assertThat(actual.getQueryString()).isEqualTo("SELECT * FROM table WHERE id=:id;");
    }
View Full Code Here

        when(meta.structure().isEmbeddedId()).thenReturn(true);
        when(embeddedIdProperties.getCQL3ComponentNames()).thenReturn(asList("id", "name"));
        Delete delete = QueryBuilder.delete().from("table");

        //When
        final RegularStatement actual = view.generateWhereClauseForDelete(false, delete);

        //Then
        assertThat(actual.getQueryString()).isEqualTo("DELETE FROM table WHERE id=:id AND name=:name;");
    }
View Full Code Here

        when(meta.structure().isEmbeddedId()).thenReturn(true);
        when(embeddedIdProperties.getPartitionComponents().getCQL3ComponentNames()).thenReturn(asList("id"));
        Delete delete = QueryBuilder.delete().from("table");

        //When
        final RegularStatement actual = view.generateWhereClauseForDelete(true, delete);

        //Then
        assertThat(actual.getQueryString()).isEqualTo("DELETE FROM table WHERE id=:id;");
    }
View Full Code Here

        when(meta.structure().isEmbeddedId()).thenReturn(false);
        when(meta.getCQL3ColumnName()).thenReturn("id");
        Delete delete = QueryBuilder.delete().from("table");

        //When
        final RegularStatement actual = view.generateWhereClauseForDelete(true, delete);

        //Then
        assertThat(actual.getQueryString()).isEqualTo("DELETE FROM table WHERE id=:id;");
    }
View Full Code Here

    @Test
    public void should_end_batch_with_logged_batch() throws Exception {
        //Given
        EventHolder eventHolder = mock(EventHolder.class);
        RegularStatement statement1 = QueryBuilder.select().from("table1");
        RegularStatement statement2 = QueryBuilder.select().from("table2");
        AbstractStatementWrapper wrapper1 = new RegularStatementWrapper(CompleteBean.class, statement1, null, com.datastax.driver.core.ConsistencyLevel.ONE, NO_LISTENER, NO_SERIAL_CONSISTENCY);
        AbstractStatementWrapper wrapper2 = new RegularStatementWrapper(CompleteBean.class, statement2, null, com.datastax.driver.core.ConsistencyLevel.ONE, NO_LISTENER, NO_SERIAL_CONSISTENCY);
        AbstractStatementWrapper wrapper3 = new RegularStatementWrapper(CompleteBean.class, statement2, null, com.datastax.driver.core.ConsistencyLevel.ONE, NO_LISTENER, NO_SERIAL_CONSISTENCY);
        context.eventHolders = asList(eventHolder);
        context.statementWrappers = asList(wrapper1, wrapper2);
View Full Code Here

    }

    @Test
    public void should_flush() throws Exception {
        // Given
        RegularStatement statement1 = QueryBuilder.select().from("table1");
        RegularStatement statement2 = QueryBuilder.select().from("table2");
        AbstractStatementWrapper wrapper1 = new RegularStatementWrapper(CompleteBean.class, statement1, null, com.datastax.driver.core.ConsistencyLevel.ONE, NO_LISTENER, NO_SERIAL_CONSISTENCY);
        AbstractStatementWrapper wrapper2 = new RegularStatementWrapper(CompleteBean.class, statement2, null, com.datastax.driver.core.ConsistencyLevel.ONE, NO_LISTENER, NO_SERIAL_CONSISTENCY);
        context.statementWrappers = asList(wrapper1);
        context.counterStatementWrappers = asList(wrapper2);
View Full Code Here

        statement.setConsistencyLevel(ConsistencyLevel.ALL);
        statement.setSerialConsistencyLevel(ConsistencyLevel.LOCAL_SERIAL);
        final NativeStatementWrapper wrapper = new NativeStatementWrapper(NativeQueryLog.class, statement, new Object[] {}, Optional.<CASResultListener>absent());

        //When
        final RegularStatement actual = (RegularStatement)wrapper.buildParameterizedStatement();

        //Then
        assertThat(actual).isSameAs(statement);
        assertThat(actual.getQueryString()).isEqualTo(statement.getQueryString());
        assertThat(actual.getValues()).isNotEmpty();
        assertThat(actual.getConsistencyLevel()).isEqualTo(ConsistencyLevel.ALL);
        assertThat(actual.getSerialConsistencyLevel()).isEqualTo(ConsistencyLevel.LOCAL_SERIAL);
    }
View Full Code Here

TOP

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

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.