@Override public InvalidConfigurationInQueryException copy() { return new InvalidConfigurationInQueryException(getAddress(), getMessage()); } }
@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 InvalidConfigurationInQueryException copy() { return new InvalidConfigurationInQueryException(getAddress(), getMessage()); } }
@Override public InvalidConfigurationInQueryException copy() { return new InvalidConfigurationInQueryException(getAddress(), getMessage()); } }
@Override public InvalidConfigurationInQueryException copy() { return new InvalidConfigurationInQueryException(getAddress(), getMessage()); } }
@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"); }
@Test public void testInValidCreateIndex() { String createIndexQuery = "CREATE CUSTOM INDEX " + TestingConstants.INDEX_NAME_CONSTANT + " ON " + cassandraUtils.getKeyspace() + "." + cassandraUtils.getTable() + "(lucene) " + "USING 'com.stratio.cassandra.lucene.Index' " + "WITH OPTIONS = { " + "'refresh_seconds' : '1', " + "'schema' : '{ " + " fields : { " + " \"addres.inexistent.latitude\" : {type:\"string\"}}}'};"; try { cassandraUtils.executeQuery(createIndexQuery); assertFalse("Creating invalid index must throw an Exception but does not ", true); } catch (InvalidConfigurationInQueryException e) { String expectedMessage = "'schema' is invalid : No column definition 'addres.inexistent' for mapper 'addres.inexistent.latitude'"; assertEquals("Cretaing invalid index must return InvalidConfigurationInQueryException(" + expectedMessage + ") but returns InvalidConfigurationInQueryException(" + e.getMessage() + ")", expectedMessage, e.getMessage()); } }
@Test public void testInValidCreateIndex2() { String createIndexQuery = "CREATE CUSTOM INDEX " + TestingConstants.INDEX_NAME_CONSTANT + " ON " + cassandraUtils.getKeyspace() + "." + cassandraUtils.getTable() + "(lucene) " + "USING 'com.stratio.cassandra.lucene.Index' " + "WITH OPTIONS = { " + "'refresh_seconds' : '1', " + "'schema' : '{ " + " fields : { " + "\"addres.inexistent\" : {type:\"string\"}}}'};"; try { cassandraUtils.executeQuery(createIndexQuery); assertFalse("Creating invalid index must throw an Exception but does not ", true); } catch (InvalidConfigurationInQueryException e) { String expectedMessage = "'schema' is invalid : No column definition 'addres.inexistent' for mapper 'addres.inexistent'"; assertEquals("Cretaing invalid index must return InvalidConfigurationInQueryException(" + expectedMessage + ") but returns InvalidConfigurationInQueryException(" + e.getMessage() + ")", expectedMessage, e.getMessage()); } }
expectedMessage + ") but returns InvalidConfigurationInQueryException(" + e.getMessage() + ")", expectedMessage, e.getMessage());
expectedMessage + ") but returns InvalidConfigurationInQueryException(" + e.getMessage() + ")", expectedMessage, e.getMessage());