@Test public void testDeleteUnsupportedQueryType() throws Exception { final Schema schema = dataContext.getDefaultSchema(); final CreateTable createTable = new CreateTable(schema, "testCreateTable"); createTable.withColumn("foo").ofType(ColumnType.STRING); createTable.withColumn("bar").ofType(ColumnType.NUMBER); dataContext.executeUpdate(createTable); final Table table = schema.getTableByName("testCreateTable"); try { dataContext.executeUpdate( new UpdateScript() { @Override public void run(UpdateCallback callback) { callback.insertInto(table).value("foo", "hello").value("bar", 42).execute(); callback.insertInto(table).value("foo", "world").value("bar", 43).execute(); } }); // greater than is not yet supported try { dataContext.executeUpdate(new DeleteFrom(table).where("bar").gt(40)); fail("Exception expected"); } catch (UnsupportedOperationException e) { assertEquals( "Could not push down WHERE items to delete by query request: [testCreateTable.bar > 40]", e.getMessage()); } } finally { dataContext.executeUpdate(new DropTable(table)); } }
@Test public void test_unsupported() { try { factory.build(-1); fail(); } catch (UnsupportedOperationException err) { assertEquals("Unsupported form field type", err.getMessage()); } }
/** Tests NaturalIdReadOnlyCoherenceRegionAccessStrategy.update(). */ @Test public void testUpdate() { try { NaturalIdRegionAccessStrategy accessStrategy = getNaturalIdRegionAccessStrategy(); Object key = "testUpdate"; Object value = "testUpdate"; accessStrategy.update(key, value); fail("Expect CacheException updating read-only access strategy"); } catch (UnsupportedOperationException ex) { assertEquals( "Expect writes not supported message", CoherenceRegionAccessStrategy.WRITE_OPERATIONS_NOT_SUPPORTED_MESSAGE, ex.getMessage()); } }