public RevTag readTag(@Nullable ObjectId id, DataInput in) throws IOException { final ObjectId commitId = readObjectId(in); final String name = in.readUTF(); final String message = in.readUTF(); final RevPerson tagger = readRevPerson(in); RevTag tag; if (id == null) { tag = RevTagBuilder.create(ObjectId.NULL, name, commitId, message, tagger); id = new HashObject().setObject(tag).call(); } tag = RevTagBuilder.create(id, name, commitId, message, tagger); return tag; }
public RevCommit readCommit(@Nullable ObjectId id, DataInput in) throws IOException { final ObjectId treeId = readObjectId(in); final int nParents = readUnsignedVarInt(in); final Builder<ObjectId> parentListBuilder = ImmutableList.builder(); for (int i = 0; i < nParents; i++) { ObjectId parentId = readObjectId(in); parentListBuilder.add(parentId); } final RevPerson author = readRevPerson(in); final RevPerson committer = readRevPerson(in); final String message = in.readUTF(); ObjectId commitId = id; if (id == null) { commitId = ObjectId.NULL; } RevCommit commit = CommitBuilder.create(commitId, treeId, parentListBuilder.build(), author, committer, message); if (id == null) { commitId = new HashObject().setObject(commit).call(); commit = CommitBuilder.create(commitId, treeId, parentListBuilder.build(), author, committer, message); } return commit; }
@Test public void testHashNullObject() throws Exception { try { hashCommand.setObject(null).call(); fail("expected IllegalStateException on null feature type"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("Object has not been set")); } }
@Test public void testHashNullObject() throws Exception { try { hashCommand.setObject(null).call(); fail("expected IllegalStateException on null feature type"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("Object has not been set")); } }
private void testHashCommitsConsistency(RevObject o) throws Exception { ObjectId expected = o.getId(); ObjectId actual = hashCommand.setObject(o).call(); assertEquals(expected, actual); } }
private void assertHashing(final RevTree orig) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); RevTreeFormat.encode(orig, new DataOutputStream(out)); final byte[] encoded = out.toByteArray(); assertNotNull(encoded); RevTree decoded = RevTreeFormat.decode(null, encoded); ObjectId expected = new HashObject().setObject(orig).call(); ObjectId actual = new HashObject().setObject(decoded).call(); assertEqualsFully(orig, decoded); assertEquals(expected, actual); }
private void testHashCommitsConsistency(RevObject o) throws Exception { ObjectId expected = o.getId(); ObjectId actual = hashCommand.setObject(o).call(); assertEquals(expected, actual); } }
@Test public void testHashCommits() throws Exception { ObjectId commit1Id = hashCommand.setObject(commit1).call(); ObjectId commit2Id = hashCommand.setObject(commit2).call(); ObjectId commit1DuplicateId = hashCommand.setObject(commit1Duplicate).call(); assertNotNull(commit1Id); assertNotNull(commit2Id); assertNotNull(commit1DuplicateId); assertFalse(commit1Id.equals(commit2Id)); assertTrue(commit1Id.equals(commit1DuplicateId)); }
@Test public void testHashCommits() throws Exception { ObjectId commit1Id = hashCommand.setObject(commit1).call(); ObjectId commit2Id = hashCommand.setObject(commit2).call(); ObjectId commit1DuplicateId = hashCommand.setObject(commit1Duplicate).call(); assertNotNull(commit1Id); assertNotNull(commit2Id); assertNotNull(commit1DuplicateId); assertFalse(commit1Id.equals(commit2Id)); assertTrue(commit1Id.equals(commit1DuplicateId)); }
private void assertHashing(final RevTree orig) { final byte[] encoded = RevTreeFormat.encode(orig); assertNotNull(encoded); RevTree decoded = RevTreeFormat.decode(null, encoded); ObjectId expected = new HashObject().setObject(orig).call(); ObjectId actual = new HashObject().setObject(decoded).call(); assertEqualsFully(orig, decoded); assertEquals(expected, actual); }
@Test public void testHashFeatureTypes() throws Exception { ObjectId featureType1Id = hashCommand.setObject(featureType1).call(); ObjectId featureType2Id = hashCommand.setObject(featureType2).call(); ObjectId coverageTypeId = hashCommand.setObject(coverageRevFeatureType).call(); ObjectId featureType1DuplicateId = hashCommand.setObject(featureType1Duplicate).call(); assertNotNull(featureType1Id); assertNotNull(featureType2Id); assertNotNull(coverageTypeId); assertNotNull(featureType1DuplicateId); assertFalse(featureType1Id.equals(featureType2Id)); assertFalse(featureType1Id.equals(coverageTypeId)); assertFalse(featureType2Id.equals(coverageTypeId)); assertTrue(featureType1Id.equals(featureType1DuplicateId)); }
@Test public void testHashFeatures() throws Exception { ObjectId feature1Id = hashCommand.setObject(pointFeature1).call(); ObjectId feature2Id = hashCommand.setObject(pointFeature2).call(); ObjectId coverageFeatureId = hashCommand.setObject(coverageRevFeature).call(); ObjectId feature1DuplicateId = hashCommand.setObject(pointFeature1Duplicate).call(); assertNotNull(feature1Id); assertNotNull(feature2Id); assertNotNull(coverageFeatureId); assertNotNull(feature1DuplicateId); assertFalse(feature1Id.equals(feature2Id)); assertFalse(feature1Id.equals(coverageFeatureId)); assertFalse(feature2Id.equals(coverageFeatureId)); assertTrue(feature1Id.equals(feature1DuplicateId)); }
@Test public void testHashFeatureTypes() throws Exception { ObjectId featureType1Id = hashCommand.setObject(featureType1).call(); ObjectId featureType2Id = hashCommand.setObject(featureType2).call(); ObjectId coverageTypeId = hashCommand.setObject(coverageRevFeatureType).call(); ObjectId featureType1DuplicateId = hashCommand.setObject(featureType1Duplicate).call(); assertNotNull(featureType1Id); assertNotNull(featureType2Id); assertNotNull(coverageTypeId); assertNotNull(featureType1DuplicateId); assertFalse(featureType1Id.equals(featureType2Id)); assertFalse(featureType1Id.equals(coverageTypeId)); assertFalse(featureType2Id.equals(coverageTypeId)); assertTrue(featureType1Id.equals(featureType1DuplicateId)); }
@Test public void testHashFeatures() throws Exception { ObjectId feature1Id = hashCommand.setObject(pointFeature1).call(); ObjectId feature2Id = hashCommand.setObject(pointFeature2).call(); ObjectId coverageFeatureId = hashCommand.setObject(coverageRevFeature).call(); ObjectId feature1DuplicateId = hashCommand.setObject(pointFeature1Duplicate).call(); assertNotNull(feature1Id); assertNotNull(feature2Id); assertNotNull(coverageFeatureId); assertNotNull(feature1DuplicateId); assertFalse(feature1Id.equals(feature2Id)); assertFalse(feature1Id.equals(coverageFeatureId)); assertFalse(feature2Id.equals(coverageFeatureId)); assertTrue(feature1Id.equals(feature1DuplicateId)); }