Beispiel #1
0
        public void CanCreateATagAnnotationPointingToAGitObject()
        {
            string path = SandboxBareTestRepo();

            using (var repo = new Repository(path))
            {
                var blob = repo.Head.Tip["README"].Target as Blob;
                Assert.NotNull(blob);

                TagAnnotation tag = repo.ObjectDatabase.CreateTagAnnotation(
                    "nice_blob",
                    blob,
                    Constants.Signature,
                    "I can point at blobs, too!");

                Assert.NotNull(tag);

                // The TagAnnotation is not pointed at by any reference...
                Assert.Null(repo.Tags["nice_blob"]);

                // ...but exists in the odb.
                var fetched = repo.Lookup <TagAnnotation>(tag.Id);
                Assert.Equal(tag, fetched);
            }
        }
Beispiel #2
0
        public void CanAddAnAnnotatedTagPointingToATagAnnotation()
        {
            TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo();

            using (var repo = new Repository(path.RepositoryPath))
            {
                Tag           annotatedTag = repo.Tags["e90810b"];
                TagAnnotation annotation   = annotatedTag.Annotation;

                Tag tag = repo.ApplyTag("annotatedtag-tag", annotation.Sha, signatureNtk, "A new annotation");
                Assert.NotNull(tag);
                Assert.True(tag.IsAnnotated);
                Assert.Equal(annotation.Id, tag.Annotation.Target.Id);
                Assert.NotEqual(annotation, tag.Annotation);

                Assert.Equal(tag, repo.Tags[tag.Name]);
            }
        }
        public void CanAddAnAnnotatedTagPointingToATagAnnotation()
        {
            string path = SandboxBareTestRepo();

            using (var repo = new Repository(path))
            {
                Tag           annotatedTag = repo.Tags["e90810b"];
                TagAnnotation annotation   = annotatedTag.Annotation;

                Tag tag = repo.ApplyTag("annotatedtag-tag", annotation.Sha, signatureNtk, "A new annotation");
                Assert.NotNull(tag);
                Assert.True(tag.IsAnnotated);
                Assert.Equal(annotation.Id, tag.Annotation.Target.Id);
                Assert.NotEqual(annotation, tag.Annotation);

                Assert.Equal(tag, repo.Tags[tag.FriendlyName]);
            }
        }
Beispiel #4
0
        public void CanCreateAnAnnotatedTagPointingToATagAnnotation()
        {
            TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo();

            using (var repo = new Repository(path.RepositoryPath))
            {
                Tag           annotatedTag = repo.Tags["e90810b"];
                TagAnnotation annotation   = annotatedTag.Annotation;

                Tag tag = repo.ApplyTag("annotatedtag-tag", annotation.Sha, signatureNtk, "A new annotation");
                tag.ShouldNotBeNull();
                tag.IsAnnotated.ShouldBeTrue();
                tag.Annotation.Target.Id.ShouldEqual(annotation.Id);
                tag.Annotation.ShouldNotEqual(annotation);

                repo.Tags[tag.Name].ShouldEqual(tag);
            }
        }
        public void CreatingALightweightTagPointingToATagAnnotationGeneratesAnAnnotatedTagReusingThePointedAtTagAnnotation()
        {
            string path = SandboxBareTestRepo();

            using (var repo = new Repository(path))
            {
                Tag           annotatedTag = repo.Tags["e90810b"];
                TagAnnotation annotation   = annotatedTag.Annotation;

                Tag tag = repo.ApplyTag("lightweight-tag", annotation.Sha);
                Assert.NotNull(tag);
                Assert.True(tag.IsAnnotated);
                Assert.Equal(annotation.Target.Id, tag.Target.Id);
                Assert.Equal(annotation, tag.Annotation);

                Assert.Equal(annotation, repo.Lookup(tag.Annotation.Id));
                Assert.Equal(tag, repo.Tags[tag.FriendlyName]);
            }
        }
Beispiel #6
0
        public void CreatingALightweightTagPointingToATagAnnotationGeneratesAnAnnotatedTagReusingThePointedAtTagAnnotation()
        {
            TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo();

            using (var repo = new Repository(path.RepositoryPath))
            {
                Tag           annotatedTag = repo.Tags["e90810b"];
                TagAnnotation annotation   = annotatedTag.Annotation;

                Tag tag = repo.ApplyTag("lightweight-tag", annotation.Sha);
                tag.ShouldNotBeNull();
                tag.IsAnnotated.ShouldBeTrue();
                tag.Target.Id.ShouldEqual(annotation.Target.Id);
                tag.Annotation.ShouldEqual(annotation);

                repo.Lookup(tag.Annotation.Id).ShouldEqual(annotation);
                repo.Tags[tag.Name].ShouldEqual(tag);
            }
        }
        public void TagAnnotationEvent_MatchesReferenceJson()
        {
            var tagAnnotation = new TagAnnotation("https://example.edu/tags/7654")
            {
                Annotated    = TestEntities.EpubSubChap434,
                Tags         = new [] { "to-read", "1765", "shared-with-project-team" },
                DateCreated  = TestEntities.DefaultDateCreated,
                DateModified = TestEntities.DefaultDateModified
            };

            var tagEvent = new AnnotationEvent(tagAnnotation)
            {
                Actor      = TestEntities.User554433,
                Object     = TestEntities.EpubSubChap434_Frame,
                EventTime  = TestEntities.DefaultStartedAtTime,
                EdApp      = TestEntities.EpubViewerApp,
                Group      = TestEntities.AmRev101_Group001,
                Membership = TestEntities.User554433_AmRev101_CourseSection001_Membership
            };

            JsonAssertions.AssertSameObjectJson(tagEvent, "caliperTagAnnotationEvent");
        }
 public TagAnnotationVertex(TagAnnotation tagAnnotation) : base(tagAnnotation)
 {
     Message = tagAnnotation.Message;
 }
Beispiel #9
0
 public void Visit(TagAnnotation tagAnnotation)
 {
     AddBinaryAnnotation(tagAnnotation.Key, tagAnnotation.Value);
 }
Beispiel #10
0
        /// <summary>
        /// Create a tag that will later be added to a clip.
        /// </summary>
        /// <typeparam name="T">Type of the tag, must implement <code>Payload<T></code></typeparam>
        /// <param name="tagPayload">Tag instance</param>
        /// <param name="starTimeInSeconds">start of the tag in seconds (relative to the clip)</param>
        /// <param name="durationInSeconds">duration of the tag in seconds</param>
        public void CreateTag <T>(T tagPayload, float starTimeInSeconds, float durationInSeconds) where T : struct
        {
            TagAnnotation tag = TagAnnotation.Create <T>(tagPayload, starTimeInSeconds, durationInSeconds);

            m_Tags.Add(tag);
        }