use of org.projectnessie.model.Namespace in project nessie by projectnessie.
the class AbstractRestNamespace method testNamespaceDeletion.
@Test
public void testNamespaceDeletion() throws BaseNessieClientServerException {
Branch branch = createBranch("testNamespaceDeletion");
CommitMultipleOperationsBuilder commit = getApi().commitMultipleOperations().branch(branch).commitMeta(CommitMeta.fromMessage("verifyAllContentAndOperationTypes"));
contentAndOperationTypes().flatMap(c -> c.globalOperation == null ? Stream.of(c.operation) : Stream.of(c.operation, c.globalOperation)).forEach(commit::operation);
commit.commit();
List<Entry> entries = contentAndOperationTypes().filter(c -> c.operation instanceof Put).map(c -> Entry.builder().type(c.type).name(c.operation.getKey()).build()).collect(Collectors.toList());
for (Entry e : entries) {
Namespace namespace = e.getName().getNamespace();
assertThat(getApi().getNamespace().refName(branch.getName()).namespace(namespace).get()).isEqualTo(namespace);
assertThatThrownBy(() -> getApi().deleteNamespace().refName(branch.getName()).namespace(namespace).delete()).isInstanceOf(NessieNamespaceNotEmptyException.class).hasMessage(String.format("Namespace '%s' is not empty", namespace));
}
}
use of org.projectnessie.model.Namespace in project nessie by projectnessie.
the class NamespaceParamsTest method testBuilder.
@Test
public void testBuilder() {
Namespace namespace = Namespace.parse("a.b.c");
NamespaceParams params = NamespaceParams.builder().refName("xx").namespace(namespace).build();
assertThat(params.getRefName()).isEqualTo("xx");
assertThat(params.getNamespace()).isEqualTo(namespace);
assertThat(params.getHashOnRef()).isNull();
}
Aggregations