use of org.projectnessie.model.Branch in project nessie by projectnessie.
the class AbstractSparkSqlTest method commitAndReturnLog.
private List<Object[]> commitAndReturnLog(String branch) throws NessieConflictException, NessieNotFoundException {
assertThat(sql("CREATE BRANCH %s IN nessie", branch)).containsExactly(row("Branch", branch, hash));
ContentKey key = ContentKey.of("table", "name");
CommitMeta cm1 = ImmutableCommitMeta.builder().author("sue").authorTime(Instant.ofEpochMilli(1)).message("1").putProperties("test", "123").build();
CommitMeta cm2 = ImmutableCommitMeta.builder().author("janet").authorTime(Instant.ofEpochMilli(10)).message("2").putProperties("test", "123").build();
CommitMeta cm3 = ImmutableCommitMeta.builder().author("alice").authorTime(Instant.ofEpochMilli(100)).message("3").putProperties("test", "123").build();
Operations ops = ImmutableOperations.builder().addOperations(Operation.Put.of(key, IcebergTable.of("foo", 42, 42, 42, 42))).commitMeta(cm1).build();
Operations ops2 = ImmutableOperations.builder().addOperations(Operation.Put.of(key, IcebergTable.of("bar", 42, 42, 42, 42))).commitMeta(cm2).build();
Operations ops3 = ImmutableOperations.builder().addOperations(Operation.Put.of(key, IcebergTable.of("baz", 42, 42, 42, 42))).commitMeta(cm3).build();
Branch ref1 = api.commitMultipleOperations().branchName(branch).hash(hash).operations(ops.getOperations()).commitMeta(ops.getCommitMeta()).commit();
Branch ref2 = api.commitMultipleOperations().branchName(branch).hash(ref1.getHash()).operations(ops2.getOperations()).commitMeta(ops2.getCommitMeta()).commit();
Branch ref3 = api.commitMultipleOperations().branchName(branch).hash(ref2.getHash()).operations(ops3.getOperations()).commitMeta(ops3.getCommitMeta()).commit();
List<Object[]> resultList = new ArrayList<>();
resultList.add(cmToRow(cm3, ref3.getHash()));
resultList.add(cmToRow(cm2, ref2.getHash()));
resultList.add(cmToRow(cm1, ref1.getHash()));
return resultList;
}
use of org.projectnessie.model.Branch in project nessie by projectnessie.
the class AbstractCompatibilityTests method getDefaultBranch.
@Test
void getDefaultBranch() throws Exception {
Branch defaultBranch = api.getDefaultBranch();
assertThat(defaultBranch).extracting(Branch::getName).isEqualTo("main");
ReferencesResponse allRefs = api.getAllReferences().get();
assertThat(allRefs.getReferences()).contains(defaultBranch);
}
use of org.projectnessie.model.Branch in project nessie by projectnessie.
the class ITUpgradePath method commit.
@Test
@Order(103)
void commit() throws Exception {
ContentKey key = ContentKey.of("my", "tables", "table_name");
IcebergTable content = IcebergTable.of("metadata-location", 42L, 43, 44, 45, "content-id-" + version);
String commitMessage = "hello world " + version;
Put operation = Put.of(key, content);
Branch branchNew = commitMaybeRetry(api.commitMultipleOperations().commitMeta(CommitMeta.fromMessage(commitMessage)).operation(operation).branch(versionBranch));
assertThat(branchNew).isNotEqualTo(versionBranch).extracting(Branch::getName).isEqualTo(versionBranch.getName());
expectedRefLogEntry("COMMIT");
}
use of org.projectnessie.model.Branch in project nessie by projectnessie.
the class ITUpgradePath method keysUpgradeCreateBranch.
@Test
@Order(201)
void keysUpgradeCreateBranch() throws Exception {
assumeThat(keysUpgradeBranch).isNull();
Branch main = api.getDefaultBranch();
keysUpgradeBranch = (Branch) api.createReference().sourceRefName(main.getName()).reference(Branch.of("keyUpgradeBranch", main.getHash())).create();
}
use of org.projectnessie.model.Branch in project nessie by projectnessie.
the class ITUpgradePath method createReference.
@Test
@Order(101)
void createReference() throws Exception {
Branch main = api.getDefaultBranch();
versionBranch = Branch.of(VERSION_BRANCH_PREFIX + version, main.getHash());
createdBranches.add(versionBranch.getName());
api.createReference().sourceRefName(main.getName()).reference(versionBranch).create();
expectedRefLogEntry("CREATE_REFERENCE");
}
Aggregations