@Override public Node visitSetProperty(final SqlBaseParser.SetPropertyContext context) { final String propertyName = unquote(context.STRING(0).getText(), "'"); final String propertyValue = unquote(context.STRING(1).getText(), "'"); return new SetProperty(Optional.ofNullable(getLocation(context)), propertyName, propertyValue); }
@Test public void shouldRunSetStatements() { // Given: when(engine.parseStatements(anyString())).thenReturn(ImmutableList.of( new PreparedStatement<>("CS", new SetProperty(Optional.empty(), "name", "value")), new PreparedStatement<>("CS", new CreateStream(SOME_NAME, emptyList(), false, emptyMap())) )); // When: standaloneExecutor.start(); // Then: verify(engine) .execute(any(), any(), eq(ImmutableMap.of("name", "value"))); }
@Test public void shouldRunUnSetStatements() { // Given: when(engine.parseStatements(anyString())).thenReturn(ImmutableList.of( new PreparedStatement<>("SET", new SetProperty(Optional.empty(), "name", "value")), new PreparedStatement<>("UNSET", new UnsetProperty(Optional.empty(), "name")), new PreparedStatement<>("CS", new CreateStream(SOME_NAME, emptyList(), false, emptyMap())) )); // When: standaloneExecutor.start(); // Then: verify(engine).execute(any(), any(), eq(emptyMap())); }