Beispiel #1
0
 protected void Page_Init(object sender, EventArgs e)
 {
     using (EventWaitHandle synchronizer = new AutoResetEvent(false))
     {
         Task t1 = Task.Factory.StartNew(
             () =>
         {
             try
             {
                 _ITICHierarchy = new ITICHierarchy();
                 using (DataTransactionBase dt = new OracleDataTransaction(Configuration.ITICConnectionString))
                 {
                     ITICGateway gateway = new ITICGateway(dt.Transaction);
                     gateway.Load(_ITICHierarchy);
                 }
             }
             catch (Exception ex)
             {
                 _exception = ex;
             }
         });
         Task t2 = Task.Factory.StartNew(
             () =>
         {
             try
             {
                 _platformStackHierarchy = new PlatformStackHierarchy();
                 using (DataTransactionBase dt = new OracleDataTransaction(Configuration.StacksConnectionString))
                 {
                     StackGatewayBase gateway = new PlatformStackGateway(dt.Transaction);
                     gateway.Load(_platformStackHierarchy);
                 }
             }
             catch (Exception ex)
             {
                 _exception = ex;
             }
         });
         Task.Factory.ContinueWhenAll(new Task[] { t1, t2 }, (ts) => { synchronizer.Set(); });
         synchronizer.WaitOne();
     }
 }
        public void LoadPlatformStacks_Test()
        {
            PlatformStackHierarchy hierarchy = new PlatformStackHierarchy();

            using (DataTransactionBase dt = new OracleDataTransaction(Configuration.StacksConnectionString))
            {
                StackGatewayBase gateway = new PlatformStackGateway(dt.Transaction);
                gateway.Load(hierarchy);
            }

            Assert.IsNotNull(hierarchy);
            Assert.IsNotNull(hierarchy.Stacks);
            Assert.IsTrue(hierarchy.Stacks.Count > 0);
            Debug.WriteLine("PlatformStacks:{0}", hierarchy.Stacks.Count);
            Assert.IsNotNull(hierarchy.MajorFilters);
            Assert.IsTrue(hierarchy.MajorFilters.Count > 0);
            Debug.WriteLine("MajorFilters:{0}", hierarchy.MajorFilters.Count);
            Assert.IsNotNull(hierarchy.MinorFilters);
            Assert.IsTrue(hierarchy.MinorFilters.Count > 0);
            Debug.WriteLine("MinorFilters:{0}", hierarchy.MinorFilters.Count);
            Assert.IsNotNull(hierarchy.ArchitectureFilters);
            Assert.IsTrue(hierarchy.ArchitectureFilters.Count > 0);
            Debug.WriteLine("ArchitectureFilters:{0}", hierarchy.ArchitectureFilters.Count);
            Assert.IsNotNull(hierarchy.BuildFilters);
            Assert.IsTrue(hierarchy.BuildFilters.Count > 0);
            Debug.WriteLine("BuildFilters:{0}", hierarchy.BuildFilters.Count);
            Assert.IsNotNull(hierarchy.StackLookups);
            Assert.IsTrue(hierarchy.StackLookups.Count > 0);
            Debug.WriteLine("PlatformStackLookups:{0}", hierarchy.StackLookups.Count);

            Assert.AreEqual(hierarchy.MajorFilters.Count, hierarchy.MajorFilters.Count((item) => item.IsLoaded));
            Assert.AreEqual(hierarchy.MinorFilters.Count, hierarchy.MinorFilters.Count((item) => item.IsLoaded));
            Assert.AreEqual(hierarchy.ArchitectureFilters.Count, hierarchy.ArchitectureFilters.Count((item) => item.IsLoaded));
            Assert.AreEqual(hierarchy.BuildFilters.Count, hierarchy.BuildFilters.Count((item) => item.IsLoaded));
            Assert.AreEqual(hierarchy.Stacks.Count, hierarchy.StackLookups.Count((item) => item.IsLoaded));
            Assert.AreEqual(hierarchy.Stacks.OfType <PlatformStack>().Count(), hierarchy.Stacks.Count);
        }
Beispiel #3
0
        protected void Page_Init(object sender, EventArgs e)
        {
            PlatformStackHierarchy hierarchy = new PlatformStackHierarchy();

            try
            {
                using (DataTransactionBase dt = new OracleDataTransaction(Configuration.StacksConnectionString))
                {
                    StackGatewayBase gateway = new PlatformStackGateway(dt.Transaction);
                    gateway.Load(hierarchy);
                }
            }
            catch (Exception ex)
            {
                _exception = ex;
            }

            if (_exception == null)
            {
                string name = Domain.Profile.ExtractName(this.CurrentProfile.ITICCode.Code, this.CurrentProfile.Context.Name);
                _items = hierarchy.GatherPlatformStacksByName(name);
                _items.Insert(0, new PlatformStack());
            }
        }
        public void LoadITICsAndPlatformStacks_Test()
        {
            ITICHierarchy          ITICHierarchy  = new ITICHierarchy();
            PlatformStackHierarchy stackHierarchy = new PlatformStackHierarchy();

            using (EventWaitHandle synchronizer = new AutoResetEvent(false))
            {
                Task t1 = Task.Factory.StartNew(
                    (obj) =>
                {
                    ITICHierarchy h = obj as ITICHierarchy;
                    if (h == null)
                    {
                        return;
                    }

                    using (DataTransactionBase dt = new OracleDataTransaction(Configuration.ITICConnectionString))
                    {
                        ITICGateway gateway = new ITICGateway(dt.Transaction);
                        gateway.Load(h);
                    }
                }, ITICHierarchy);

                Task t2 = Task.Factory.StartNew(
                    (obj) =>
                {
                    PlatformStackHierarchy h = obj as PlatformStackHierarchy;
                    if (h == null)
                    {
                        return;
                    }

                    using (DataTransactionBase dt = new OracleDataTransaction(Configuration.StacksConnectionString))
                    {
                        StackGatewayBase gateway = new PlatformStackGateway(dt.Transaction);
                        gateway.Load(h);
                    }
                }, stackHierarchy);

                Task.Factory.ContinueWhenAll(new Task[] { t1, t2 }, (ts) => { synchronizer.Set(); });
                synchronizer.WaitOne();
            }

            Assert.IsNotNull(ITICHierarchy);
            Assert.IsNotNull(ITICHierarchy.Codes);
            Assert.IsTrue(ITICHierarchy.Codes.Count > 0);
            Assert.IsNotNull(ITICHierarchy.Infrastructures);
            Assert.IsTrue(ITICHierarchy.Infrastructures.Count > 0);
            Assert.IsNotNull(ITICHierarchy.Capabilities);
            Assert.IsTrue(ITICHierarchy.Capabilities.Count > 0);
            Assert.IsNotNull(ITICHierarchy.LogicalSystemGroups);
            Assert.IsTrue(ITICHierarchy.LogicalSystemGroups.Count > 0);

            Assert.IsNotNull(stackHierarchy);
            Assert.IsNotNull(stackHierarchy.Stacks);
            Assert.IsTrue(stackHierarchy.Stacks.Count > 0);
            Assert.IsNotNull(stackHierarchy.MajorFilters);
            Assert.IsTrue(stackHierarchy.MajorFilters.Count > 0);
            Assert.IsNotNull(stackHierarchy.MinorFilters);
            Assert.IsTrue(stackHierarchy.MinorFilters.Count > 0);
            Assert.IsNotNull(stackHierarchy.ArchitectureFilters);
            Assert.IsTrue(stackHierarchy.ArchitectureFilters.Count > 0);
            Assert.IsNotNull(stackHierarchy.BuildFilters);
            Assert.IsTrue(stackHierarchy.BuildFilters.Count > 0);
            Assert.IsNotNull(stackHierarchy.StackLookups);
            Assert.IsTrue(stackHierarchy.StackLookups.Count > 0);
        }