Exemplo n.º 1
0
        public virtual void TestTimelineDomain()
        {
            TimelineDomains domains = new TimelineDomains();
            TimelineDomain  domain  = null;

            for (int i = 0; i < 2; ++i)
            {
                domain = new TimelineDomain();
                domain.SetId("test id " + (i + 1));
                domain.SetDescription("test description " + (i + 1));
                domain.SetOwner("test owner " + (i + 1));
                domain.SetReaders("test_reader_user_" + (i + 1) + " test_reader_group+" + (i + 1)
                                  );
                domain.SetWriters("test_writer_user_" + (i + 1) + " test_writer_group+" + (i + 1)
                                  );
                domain.SetCreatedTime(0L);
                domain.SetModifiedTime(1L);
                domains.AddDomain(domain);
            }
            Log.Info("Domain in JSON:");
            Log.Info(TimelineUtils.DumpTimelineRecordtoJSON(domains, true));
            NUnit.Framework.Assert.AreEqual(2, domains.GetDomains().Count);
            for (int i_1 = 0; i_1 < domains.GetDomains().Count; ++i_1)
            {
                domain = domains.GetDomains()[i_1];
                NUnit.Framework.Assert.AreEqual("test id " + (i_1 + 1), domain.GetId());
                NUnit.Framework.Assert.AreEqual("test description " + (i_1 + 1), domain.GetDescription
                                                    ());
                NUnit.Framework.Assert.AreEqual("test owner " + (i_1 + 1), domain.GetOwner());
                NUnit.Framework.Assert.AreEqual("test_reader_user_" + (i_1 + 1) + " test_reader_group+"
                                                + (i_1 + 1), domain.GetReaders());
                NUnit.Framework.Assert.AreEqual("test_writer_user_" + (i_1 + 1) + " test_writer_group+"
                                                + (i_1 + 1), domain.GetWriters());
                NUnit.Framework.Assert.AreEqual(0L, domain.GetCreatedTime());
                NUnit.Framework.Assert.AreEqual(1L, domain.GetModifiedTime());
            }
        }
Exemplo n.º 2
0
 /// <summary>Add a single domain into the existing domain list</summary>
 /// <param name="domain">a single domain</param>
 public virtual void AddDomain(TimelineDomain domain)
 {
     domains.AddItem(domain);
 }