Exemplo n.º 1
0
 public NxActionSet(string id, IActionMatrixCell actionMatrixCell, NxObjectWriter pow, IResourceManager resourceManager)
     : base(id)
 {
     m_Pow = pow;
     m_ActionMatrixCell = actionMatrixCell;
     m_resourceManager = resourceManager;
 }
Exemplo n.º 2
0
 public NxOfflineRoutingSet(IPolicyChannel channel, NxObjectWriter objectWriter, IResourceManager resourceManager, Guid offlineRoutingId)
     : base(offlineRoutingId.ToString())
 {
     m_Pow = objectWriter;
     m_PolicyChannel = channel;
     m_OfflineRoutingId = offlineRoutingId;
     m_resourceManager = resourceManager;
     CreateOfflineRoutingSet();
 }
Exemplo n.º 3
0
 public NxRoutingSet(IPolicyChannel channel, NxObjectWriter objectWriter, IResourceManager resourceManager)
 {
     m_objectWriter = objectWriter;
     m_policyChannel = channel;
     m_routingId = channel.Routing.Identifier.ToString();
     m_routingSet = new NxSet(m_routingId);
     m_routingSet.Append(new NxComment("Online routing"));
     m_resourceManager = resourceManager;
     InitialiseObjectLookups();
 }
Exemplo n.º 4
0
 public void TestLdapAnalyzerConditionIsAdded() 
 {
     MockDataSource1 dataSource = new MockDataSource1();
     NxObjectWriter pow = new NxObjectWriter();
     XmlDocument objectsXml = pow.Objects;
     XmlNode objectNode = objectsXml.SelectSingleNode("/PolicyObjects/Conditions/Object");
     Assert.AreEqual("LDAPAnalyzer", objectNode.Attributes["ref"].Value);
     Assert.AreEqual("Workshare.DirectorySearcher.dll", objectNode.Attributes["assembly"].Value);
     Assert.AreEqual("Workshare.DirectorySearcher.DirectoryAnalyzer", objectNode.Attributes["class"].Value);
 }
Exemplo n.º 5
0
        public void TestMultipleConditions()
        {
            MockDataSource1 dataSource1 = new MockDataSource1();
            MockDataSource2 dataSource2 = new MockDataSource2();
            
            string parentId1 = "0D31D126-D23F-4e55-85D9-55504BE53160";
            string parentId2 = "FB66A86F-38E8-49aa-9675-4A30E6EB7EF8";

            NxObjectWriter pow = new NxObjectWriter();
            pow.AddCondition(dataSource1, parentId1);
            pow.AddCondition(dataSource2, parentId2);

            XmlDocument objectsXml = pow.Objects;
            XmlNodeList nodes = objectsXml.SelectNodes("/PolicyObjects/Conditions/Object");

            // The NxBre writer adding the LDAPAnalyzer and InternalExternalResolver condition objects
            Assert.AreEqual(4, nodes.Count);

            Assert.AreEqual(parentId1, nodes[2].Attributes["ref"].Value);
            Assert.AreEqual("MockDataSourceAssembly1", nodes[2].Attributes["assembly"].Value);
            Assert.AreEqual("MockClass1", nodes[2].Attributes["class"].Value);
            Assert.AreEqual("purple", nodes[2].Attributes["colour"].Value);
            Assert.AreEqual("true", nodes[2].Attributes["allowoverride"].Value);
            Assert.AreEqual(parentId2, nodes[3].Attributes["ref"].Value);
            Assert.AreEqual("MockDataSourceAssembly2", nodes[3].Attributes["assembly"].Value);
            Assert.AreEqual("MockClass2", nodes[3].Attributes["class"].Value);
            Assert.AreEqual("green", nodes[3].Attributes["colour"].Value);
            Assert.AreEqual("false", nodes[3].Attributes["allowoverride"].Value);
        }
Exemplo n.º 6
0
        public void TestDoesntAddDuplicateCondtion()
        {
            MockDataSource1 dataSource1 = new MockDataSource1();
            MockDataSource1 dataSource2 = new MockDataSource1();

            string parentId = "0D31D126-D23F-4e55-85D9-55504BE53160";

            NxObjectWriter pow = new NxObjectWriter();
            pow.AddCondition(dataSource1,parentId);
            pow.AddCondition(dataSource2, parentId);

            XmlDocument objectsXml = pow.Objects;

            string xpath = string.Format("/PolicyObjects/Conditions/Object[@ref='{0}']", parentId);
            XmlNode objectNode = objectsXml.SelectSingleNode(xpath);
            XmlNodeList nodes = objectsXml.SelectNodes("/PolicyObjects/Conditions/Object");

            // The NxBre writer adding the LDAPAnalyzer and InternalExternalResolver condition objects
            Assert.AreEqual(3, nodes.Count);

            Assert.AreEqual(parentId, objectNode.Attributes["ref"].Value);
            Assert.AreEqual("MockDataSourceAssembly1", objectNode.Attributes["assembly"].Value);
            Assert.AreEqual("MockClass1", objectNode.Attributes["class"].Value);
            Assert.AreEqual("purple", objectNode.Attributes["colour"].Value);
            Assert.AreEqual("true", objectNode.Attributes["allowoverride"].Value);
        }
Exemplo n.º 7
0
        public void TestCondtions()
        {
            MockDataSource1 dataSource = new MockDataSource1();
            NxObjectWriter pow = new NxObjectWriter();
            string parentId = "0D31D126-D23F-4e55-85D9-55504BE53160";
            pow.AddCondition(dataSource, parentId);

            XmlDocument objectsXml = pow.Objects;
            string xpath = string.Format("/PolicyObjects/Conditions/Object[@ref='{0}']", parentId);
            XmlNode objectNode = objectsXml.SelectSingleNode(xpath);
            Assert.AreEqual(parentId, objectNode.Attributes["ref"].Value);
            Assert.AreEqual("MockDataSourceAssembly1", objectNode.Attributes["assembly"].Value);
            Assert.AreEqual("MockClass1", objectNode.Attributes["class"].Value);
            Assert.AreEqual("purple", objectNode.Attributes["colour"].Value);
            Assert.AreEqual("true", objectNode.Attributes["allowoverride"].Value);
        }
Exemplo n.º 8
0
        public void TestMultipleActions()
        {
            MockAction1 action1 = new MockAction1();
            MockAction2 action2 = new MockAction2();
            action1.Precedence = 1;
            action2.Precedence = 2;

            NxObjectWriter pow = new NxObjectWriter();
            pow.AddAction(action1);
            pow.AddAction(action2);
            XmlDocument objects = pow.Objects;
            string xpath = string.Format("/PolicyObjects/Actions/Object[@ref='{0}']", action1.Identifier.ToString());
            XmlNode objectNode = objects.SelectSingleNode(xpath);

            Assert.AreEqual(action1.Identifier.ToString(), objectNode.Attributes["ref"].Value);
            Assert.AreEqual(action1.Assembly, objectNode.Attributes["assembly"].Value);
            Assert.AreEqual(action1.Class, objectNode.Attributes["class"].Value);

            XmlNode deNode = objectNode.SelectSingleNode("DataElement");
            Assert.AreEqual("StringArray", deNode.Attributes["type"].Value);
            XmlNodeList nodes = deNode.SelectNodes("DataItem");
            Assert.IsTrue(string.Compare("Paragraph", nodes[0].InnerText, true) == 0);
            Assert.IsTrue(string.Compare("Body", nodes[1].InnerText, true) == 0);
            Assert.IsTrue(string.Compare("Subject", nodes[2].InnerText, true) == 0);

            xpath = string.Format("/PolicyObjects/Actions/Object[@ref='{0}']", action2.Identifier.ToString());
            objectNode = objects.SelectSingleNode(xpath);

            Assert.AreEqual(action2.Identifier.ToString(), objectNode.Attributes["ref"].Value);
            Assert.AreEqual(action2.Assembly, objectNode.Attributes["assembly"].Value);
            Assert.AreEqual(action2.Class, objectNode.Attributes["class"].Value);

            deNode = objectNode.SelectSingleNode("DataElement");
            Assert.AreEqual("StringArray", deNode.Attributes["type"].Value);
            nodes = deNode.SelectNodes("DataItem");
            Assert.IsTrue(string.Compare("Toc", nodes[0].InnerText, true) == 0);
            Assert.IsTrue(string.Compare("Footer", nodes[1].InnerText, true) == 0);
            Assert.IsTrue(string.Compare("Header", nodes[2].InnerText, true) == 0);
        }