@Override public DriverException copy() { return new InvalidQueryException(getAddress(), getMessage(), this); }
@Test(groups = "unit") public void should_create_proper_invalid_query_exception() { InvalidQueryException e = new InvalidQueryException("Bad, really bad"); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); e = (InvalidQueryException) e.copy(); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); }
/** * Adds a value to a set column. * * <p>This will generate: {@code name = name + {value}}. * * @param name the column name (must be of type set). * @param value the value to add. Using a BindMarker here is not supported. To use a BindMarker * use {@code QueryBuilder#addAll} with a singleton set. * @return the correspond assignment (to use in an update query) */ public static Assignment add(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "Binding a value in add() is not supported, use addAll() and bind a singleton list"); } return addAll(name, Collections.singleton(value)); }
private void alterEndpointProfileTable() { try { cassandraSession.execute("ALTER TABLE ep_profile ADD eps_cf_hash blob;"); } catch (InvalidQueryException ex) { LOG.warn("Failed to alter ep_profile table: {}", ex.getMessage()); } }
@Override public DriverException copy() { return new InvalidQueryException(getMessage(), this); } }
private void error(KeySpaceQueryInformation information, CreateKeySpace createKeySpace, InvalidQueryException exception) { StringBuilder error = new StringBuilder(); error.append(" An error happened when execute create keyspace: ") .append(information.getKeySpace()); error.append(" with type: ").append(information.getReplicaStrategy()); error.append(" With query: ").append( createKeySpace.createQuery(information)); error.append(" Error cause: ").append(exception.getCause()).append(" ") .append(exception.getMessage()); throw new CreateKeySpaceException(error.toString()); }
/** * Remove a value from a set column. * * <p>This will generate: {@code name = name - {value}}. * * @param name the column name (must be of type set). * @param value the value to remove. Using a BindMarker here is not supported. To use a BindMarker * use {@code QueryBuilder#removeAll} with a singleton set. * @return the correspond assignment (to use in an update query) */ public static Assignment remove(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "Binding a value in remove() is not supported, use removeAll() and bind a singleton set"); } return removeAll(name, Collections.singleton(value)); }
if (!e.getMessage().startsWith("unconfigured columnfamily row_key"))
@Override public DriverException copy() { return new InvalidQueryException(getAddress(), getMessage(), this); }
/** * Discard a value from a list column. * * <p>This will generate: {@code name = name - [value]}. * * @param name the column name (must be of type list). * @param value the value to discard. Using a BindMarker here is not supported. To use a * BindMarker use {@code QueryBuilder#discardAll} with a singleton list. * @return the correspond assignment (to use in an update query) */ public static Assignment discard(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "Binding a value in discard() is not supported, use discardAll() and bind a singleton list"); } return discardAll(name, Collections.singletonList(value)); }
} catch (InvalidQueryException e) { if (!e.getMessage().contains(String.format( "Keyspace '%s' does not exist", this.keyspace))) { throw e;
@Test(groups = "unit") public void should_create_proper_invalid_query_exception() { InvalidQueryException e = new InvalidQueryException("Bad, really bad"); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); e = (InvalidQueryException) e.copy(); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); }
@Override public DriverException copy() { return new InvalidQueryException(getAddress(), getMessage(), this); }
/** * Append a value to a list column. * * <p>This will generate: {@code name = name + [value]}. * * @param name the column name (must be of type list). * @param value the value to append. Using a BindMarker here is not supported. To use a BindMarker * use {@code QueryBuilder#appendAll} with a singleton list. * @return the correspond assignment (to use in an update query) */ public static Assignment append(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "Binding a value in append() is not supported, use appendAll() and bind a singleton list"); } return appendAll(name, Collections.singletonList(value)); }
@Test(groups = "unit") public void should_create_proper_invalid_configuration_in_query_exception() { InvalidConfigurationInQueryException e = new InvalidConfigurationInQueryException(address1, "Bad, really bad"); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); assertThat(e.getAddress()).isEqualTo(address1); assertThat(e.getHost()).isEqualTo(address1.getAddress()); InvalidQueryException e1 = (InvalidQueryException) e.copy(); assertThat(e1.getMessage()).isEqualTo("Bad, really bad"); }
@Override public DriverException copy() { return new InvalidQueryException(getAddress(), getMessage(), this); }
/** * Prepend a value to a list column. * * <p>This will generate: {@code name = [ value ] + name}. * * @param name the column name (must be of type list). * @param value the value to prepend. Using a BindMarker here is not supported. To use a * BindMarker use {@code QueryBuilder#prependAll} with a singleton list. * @return the correspond assignment (to use in an update query) */ public static Assignment prepend(String name, Object value) { if (value instanceof BindMarker) { throw new InvalidQueryException( "binding a value in prepend() is not supported, use prependAll() and bind a singleton list"); } return prependAll(name, Collections.singletonList(value)); }
} catch (InvalidQueryException e) { if (!e.getMessage().contains(String.format( "Keyspace '%s' does not exist", this.keyspace))) { throw e;
new BootstrappingException(null, "Bootstrapping"), new UnpreparedException(null, "Unprepared"), new InvalidQueryException("Validation", new Exception()));
@Test(groups = "unit") public void should_create_proper_invalid_configuration_in_query_exception() { InvalidConfigurationInQueryException e = new InvalidConfigurationInQueryException(address1, "Bad, really bad"); assertThat(e.getMessage()).isEqualTo("Bad, really bad"); assertThat(e.getAddress()).isEqualTo(address1); assertThat(e.getHost()).isEqualTo(address1.getAddress()); InvalidQueryException e1 = (InvalidQueryException) e.copy(); assertThat(e1.getMessage()).isEqualTo("Bad, really bad"); }