Package org.springframework.cassandra.core.cql

Examples of org.springframework.cassandra.core.cql.CqlIdentifier


  public void testUnquotedIdentifiers() {

    String[] ids = new String[] { "foo", "Foo", "FOO", "a_", "a1" };

    for (String id : ids) {
      CqlIdentifier cqlId = cqlId(id);
      assertFalse(cqlId.isQuoted());
      assertEquals(id.toLowerCase(), cqlId.toCql());
    }
  }
View Full Code Here


  public void testForceQuotedIdentifiers() {

    String[] ids = new String[] { "foo", "Foo", "FOO", "a_", "a1" };

    for (String id : ids) {
      CqlIdentifier cqlId = quotedCqlId(id);
      assertTrue(cqlId.isQuoted());
      assertEquals("\"" + id + "\"", cqlId.toCql());
    }
  }
View Full Code Here

  @Test
  public void testReservedWordsEndUpQuoted() {

    for (ReservedKeyword id : ReservedKeyword.values()) {
      CqlIdentifier cqlId = cqlId(id.name());
      assertTrue(cqlId.isQuoted());
      assertEquals("\"" + id.name() + "\"", cqlId.toCql());

      cqlId = cqlId(id.name().toLowerCase());
      assertTrue(cqlId.isQuoted());
      assertEquals("\"" + id.name().toLowerCase() + "\"", cqlId.toCql());
    }
  }
View Full Code Here

  public void throwsIllegalArgumentExceptionIfColumnDoesNotExistByCqlIdentifier() throws Exception {
    given(columnDefinitions.contains(NON_EXISTENT_COLUMN)).willReturn(false);
    given(columnDefinitions.getIndexOf(NON_EXISTENT_COLUMN)).willReturn(-1);

    try {
      underTest.get(new CqlIdentifier(NON_EXISTENT_COLUMN));
      fail("Expected illegal argument exception");
    } catch (IllegalArgumentException e) {
      assertEquals("Column does not exist in Cassandra table: " + NON_EXISTENT_COLUMN, e.getMessage());
    }
  }
View Full Code Here

  public void throwsIllegalArgumentExceptionIfColumnDoesNotExistByCqlIdentifierAndType() throws Exception {
    given(columnDefinitions.contains(NON_EXISTENT_COLUMN)).willReturn(false);
    given(columnDefinitions.getIndexOf(NON_EXISTENT_COLUMN)).willReturn(-1);

    try {
      underTest.get(new CqlIdentifier(NON_EXISTENT_COLUMN), String.class);
      fail("Expected illegal argument exception");
    } catch (IllegalArgumentException e) {
      assertEquals("Column does not exist in Cassandra table: " + NON_EXISTENT_COLUMN, e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.cassandra.core.cql.CqlIdentifier

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.