@Test public void testBuiltStatementOptionValues() { MockSession session = new MockSession(); Insert insert = QueryBuilder.insertInto("myTable"); insert.values(new String[] {"arg"}, new Object[] {"stringvalue"}); Insert.Options using = insert.using(timestamp(100)); using.values(new String[] {"another"}, new Object[] {"value"}); Operation operation = CassandraOperationFinalizer.get(insert); assertNotNull(operation); session.execute(insert); assertNotNull(operation.getLabel()); assertEquals("OperationType", CassandraExternalResourceAnalyzer.TYPE, operation.getType()); String cql = operation.get("cql", String.class); assertEquals("cql", insert.getQueryString(), cql); OperationMap params = operation.get(CassandraOperationFinalizer.PARAMS_VALUES, OperationMap.class); assertNotNull(params); assertEquals("params", params.size(), 2); assertNull(CassandraOperationFinalizer.remove(insert)); }
@Test public void testBuiltStatementValue() { MockSession session = new MockSession(); Insert insert = QueryBuilder.insertInto("myTable"); insert.value("arg", "stringvalue"); Operation operation = CassandraOperationFinalizer.get(insert); assertNotNull(operation); session.execute(insert); assertNotNull(operation.getLabel()); assertEquals("OperationType", CassandraExternalResourceAnalyzer.TYPE, operation.getType()); String cql = operation.get("cql", String.class); assertEquals("cql", insert.getQueryString(), cql); OperationMap params = operation.get(CassandraOperationFinalizer.PARAMS_VALUES, OperationMap.class); assertNotNull(params); assertEquals("params", params.size(), 1); assertNull(CassandraOperationFinalizer.remove(insert)); }