use of io.crate.metadata.view.ViewsMetadata in project crate by crate.
the class ViewsITest method testViewCanBeCreatedAndThenReplaced.
@Test
public void testViewCanBeCreatedAndThenReplaced() throws Exception {
execute("create view v2 as select 1 from sys.cluster");
assertThat(printedTable(execute("select * from v2").rows()), is("1\n"));
execute("create or replace view v2 as select 2 from sys.cluster");
assertThat(printedTable(execute("select * from v2").rows()), is("2\n"));
for (ClusterService clusterService : internalCluster().getInstances(ClusterService.class)) {
ViewsMetadata views = clusterService.state().metadata().custom(ViewsMetadata.TYPE);
assertThat(views, Matchers.notNullValue());
assertThat(views.contains(RelationName.fromIndexName(sqlExecutor.getCurrentSchema() + ".v2")), is(true));
}
}
Aggregations