static TestTimelineACLsManager()
 {
     domain = new TimelineDomain();
     domain.SetId("domain_id_1");
     domain.SetOwner("owner");
     domain.SetReaders("reader");
     domain.SetWriters("writer");
 }
Exemplo n.º 2
0
        public static TimelineDomain GenerateDomain()
        {
            TimelineDomain domain = new TimelineDomain();

            domain.SetId("namesapce id");
            domain.SetDescription("domain description");
            domain.SetOwner("domain owner");
            domain.SetReaders("domain_reader");
            domain.SetWriters("domain_writer");
            domain.SetCreatedTime(0L);
            domain.SetModifiedTime(1L);
            return(domain);
        }
Exemplo n.º 3
0
        private static TimelineDomain CreateTimelineDomain(string id, string description,
                                                           string owner, string readers, string writers, long createdTime, long modifiedTime
                                                           )
        {
            TimelineDomain domainToStore = new TimelineDomain();

            domainToStore.SetId(id);
            domainToStore.SetDescription(description);
            domainToStore.SetOwner(owner);
            domainToStore.SetReaders(readers);
            domainToStore.SetWriters(writers);
            domainToStore.SetCreatedTime(createdTime);
            domainToStore.SetModifiedTime(modifiedTime);
            return(domainToStore);
        }
            /// <exception cref="System.Exception"/>
            public Void Call()
            {
                TimelineClient client        = this._enclosing.CreateTimelineClientForUGI();
                TimelineDomain domainToStore = new TimelineDomain();

                domainToStore.SetId(typeof(Org.Apache.Hadoop.Yarn.Server.Timeline.Security.TestTimelineAuthenticationFilter
                                           ).FullName);
                domainToStore.SetReaders("*");
                domainToStore.SetWriters("*");
                client.PutDomain(domainToStore);
                TimelineDomain domainToRead = Org.Apache.Hadoop.Yarn.Server.Timeline.Security.TestTimelineAuthenticationFilter
                                              .testTimelineServer.GetTimelineStore().GetDomain(typeof(Org.Apache.Hadoop.Yarn.Server.Timeline.Security.TestTimelineAuthenticationFilter
                                                                                                      ).FullName);

                NUnit.Framework.Assert.IsNotNull(domainToRead);
                return(null);
            }
Exemplo n.º 5
0
        /// <exception cref="System.Exception"/>
        protected override void ServiceInit(Configuration conf)
        {
            TimelineDomain domain = store.GetDomain("DEFAULT");

            // it is okay to reuse an existing domain even if it was created by another
            // user of the timeline server before, because it allows everybody to access.
            if (domain == null)
            {
                // create a default domain, which allows everybody to access and modify
                // the entities in it.
                domain = new TimelineDomain();
                domain.SetId(DefaultDomainId);
                domain.SetDescription("System Default Domain");
                domain.SetOwner(UserGroupInformation.GetCurrentUser().GetShortUserName());
                domain.SetReaders("*");
                domain.SetWriters("*");
                store.Put(domain);
            }
            base.ServiceInit(conf);
        }
Exemplo n.º 6
0
        private void PrepareTimelineDomain()
        {
            TimelineClient timelineClient = null;

            if (conf.GetBoolean(YarnConfiguration.TimelineServiceEnabled, YarnConfiguration.DefaultTimelineServiceEnabled
                                ))
            {
                timelineClient = TimelineClient.CreateTimelineClient();
                timelineClient.Init(conf);
                timelineClient.Start();
            }
            else
            {
                Log.Warn("Cannot put the domain " + domainId + " because the timeline service is not enabled"
                         );
                return;
            }
            try
            {
                //TODO: we need to check and combine the existing timeline domain ACLs,
                //but let's do it once we have client java library to query domains.
                TimelineDomain domain = new TimelineDomain();
                domain.SetId(domainId);
                domain.SetReaders(viewACLs != null && viewACLs.Length > 0 ? viewACLs : " ");
                domain.SetWriters(modifyACLs != null && modifyACLs.Length > 0 ? modifyACLs : " ");
                timelineClient.PutDomain(domain);
                Log.Info("Put the timeline domain: " + TimelineUtils.DumpTimelineRecordtoJSON(domain
                                                                                              ));
            }
            catch (Exception e)
            {
                Log.Error("Error when putting the timeline domain", e);
            }
            finally
            {
                timelineClient.Stop();
            }
        }