public void LoadITICs_Test() { ITICHierarchy hierarchy = new ITICHierarchy(); using (DataTransactionBase dt = new OracleDataTransaction(Configuration.ITICConnectionString)) { ITICGateway gateway = new ITICGateway(dt.Transaction); gateway.Load(hierarchy); } Assert.IsNotNull(hierarchy); Assert.IsNotNull(hierarchy.Codes); Assert.IsTrue(hierarchy.Codes.Count > 0); Debug.WriteLine("ITIC:{0}", hierarchy.Codes.Count); Assert.IsNotNull(hierarchy.Infrastructures); Assert.IsTrue(hierarchy.Infrastructures.Count > 0); Debug.WriteLine("Infrastructures:{0}", hierarchy.Infrastructures.Count); Assert.IsNotNull(hierarchy.Capabilities); Assert.IsTrue(hierarchy.Capabilities.Count > 0); Debug.WriteLine("Capabilities:{0}", hierarchy.Capabilities.Count); Assert.IsNotNull(hierarchy.LogicalSystemGroups); Assert.IsTrue(hierarchy.LogicalSystemGroups.Count > 0); Debug.WriteLine("LogicalSystemGroups:{0}", hierarchy.LogicalSystemGroups.Count); Assert.AreEqual(hierarchy.Infrastructures.Count, hierarchy.Infrastructures.Count((item) => item.IsLoaded)); Assert.AreEqual(hierarchy.Capabilities.Count, hierarchy.Capabilities.Count((item) => item.IsLoaded)); Assert.AreEqual(hierarchy.LogicalSystemGroups.Count, hierarchy.LogicalSystemGroups.Count((item) => item.IsLoaded)); }
public static void UpdateITIC(ITIC pITIC) { if (pITIC == null) { return; } pITIC.Infrastructure = new InfrastructureLookup(pITIC.InfrastructureCode, null); pITIC.Capability = new CapabilityLookup(pITIC.CapabilityCode, null); pITIC.LogicalSystemGroup = new LogicalSystemGroupLookup(pITIC.LogicalSystemGroupCode, null); using (DataTransactionBase dt = new OracleDataTransaction(Configuration.ITICConnectionString)) { ITICGateway gateway = new ITICGateway(dt.Transaction); gateway.LoadInfrastructure(pITIC.Infrastructure); gateway.LoadCapability(pITIC.Capability); gateway.LoadLogicalSystemGroup(pITIC.LogicalSystemGroup); } }
protected void Page_Init(object sender, EventArgs e) { using (EventWaitHandle synchronizer = new AutoResetEvent(false)) { 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; } } }
public void LoadInfrastructure_Test() { const string CODE = "DCM"; const string NAME = "DCMS"; InfrastructureLookup lookup = new InfrastructureLookup(CODE, null); using (DataTransactionBase dt = new OracleDataTransaction(Configuration.ITICConnectionString)) { ITICGateway gateway = new ITICGateway(dt.Transaction); gateway.LoadInfrastructure(lookup); } Assert.IsNotNull(lookup); Assert.AreEqual(CODE, lookup.Code); Assert.AreEqual(NAME, lookup.Name); Assert.IsTrue(lookup.IsLoaded); Assert.IsFalse(lookup.IsDefault); }
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 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); }