use of org.projectnessie.model.IcebergView in project nessie by projectnessie.
the class TestNessieIcebergViews method testCreateView.
@Test
public void testCreateView() throws IOException {
ViewDefinition viewDefinition = ViewDefinition.of(SQL, SCHEMA, CATALOG_NAME, new ArrayList<>());
TableIdentifier viewIdentifier = ViewUtils.toCatalogTableIdentifier(VIEW_IDENTIFIER + "x");
catalog.create(viewIdentifier.toString(), viewDefinition, Collections.emptyMap());
View icebergView = catalog.load(viewIdentifier.toString());
assertThat(icebergView).isNotNull();
assertThat(icebergView.currentVersion().versionId()).isEqualTo(1);
assertThat(icebergView.currentVersion().viewDefinition()).isEqualTo(viewDefinition);
assertThat(Paths.get(metadataLocationViews(viewIdentifier.name()))).exists();
assertThat(metadataFilesForViews(viewIdentifier.name())).isNotNull().hasSize(1);
verifyCommitMetadata();
assertThat(api.getCommitLog().refName(BRANCH).get().getLogEntries()).hasSize(3);
verifyViewInNessie(viewIdentifier, icebergView);
}
Aggregations