assertEquals(e.getKeyspace(), keyspace.toLowerCase()); assertEquals(e.getTable(), null); assertEquals(e.wasTableCreation(), false); assertEquals(e.getHost(), ccm().addressOfNode(1).getAddress()); assertEquals(e.getAddress(), ccm().addressOfNode(1)); assertEquals(e.wasTableCreation(), true); assertEquals(e.getHost(), ccm().addressOfNode(1).getAddress()); assertEquals(e.getAddress(), ccm().addressOfNode(1));
/** * Convert the given Cassandra driver exception to a corresponding ConnectorException if possible, otherwise * return a generic ConnectorException. * * @param de The Cassandra driver exception * @param name The fully qualified name of the resource which was attempting to be accessed or modified at time of * error * @return A connector exception wrapping the DriverException */ public ConnectorException toConnectorException( @Nonnull @NonNull final DriverException de, @Nonnull @NonNull final QualifiedName name ) { if (de instanceof AlreadyExistsException) { final AlreadyExistsException ae = (AlreadyExistsException) de; if (ae.wasTableCreation()) { return new TableAlreadyExistsException(name, ae); } else { return new DatabaseAlreadyExistsException(name, ae); } } else { return new ConnectorException(de.getMessage(), de); } } }
/** * Convert the given Cassandra driver exception to a corresponding ConnectorException if possible, otherwise * return a generic ConnectorException. * * @param de The Cassandra driver exception * @param name The fully qualified name of the resource which was attempting to be accessed or modified at time of * error * @return A connector exception wrapping the DriverException */ public ConnectorException toConnectorException( @Nonnull @NonNull final DriverException de, @Nonnull @NonNull final QualifiedName name ) { if (de instanceof AlreadyExistsException) { final AlreadyExistsException ae = (AlreadyExistsException) de; if (ae.wasTableCreation()) { return new TableAlreadyExistsException(name, ae); } else { return new DatabaseAlreadyExistsException(name, ae); } } else { return new ConnectorException(de.getMessage(), de); } } }
return aex.wasTableCreation() ? new CassandraTableExistsException(aex.getTable(), exception.getMessage(), exception) : new CassandraKeyspaceExistsException(aex.getKeyspace(), exception.getMessage(), exception);
assertEquals(e.getKeyspace(), keyspace.toLowerCase()); assertEquals(e.getTable(), null); assertEquals(e.wasTableCreation(), false); assertEquals(e.getHost(), ccm().addressOfNode(1).getAddress()); assertEquals(e.getAddress(), ccm().addressOfNode(1)); assertEquals(e.wasTableCreation(), true); assertEquals(e.getHost(), ccm().addressOfNode(1).getAddress()); assertEquals(e.getAddress(), ccm().addressOfNode(1));
return aex.wasTableCreation() ? new CassandraTableExistsException(aex.getTable(), message, exception) : new CassandraKeyspaceExistsException(aex.getKeyspace(), message, exception);