Exemple #1
0
 public void RegisterNullNodeProviders()
 {
      MockNodeProvider nullNodeProvider = null;
      NodeManager nodeManager = new NodeManager(1, false, engine);
      nodeManager.RegisterNodeProvider(nullNodeProvider);
 }
Exemple #2
0
        public void RegisterNodeProviders()
        {
                      
            MockNodeProvider ProviderOneNode = new MockNodeProvider();
            ProviderOneNode.NodeDescriptions.Add(new MockNodeDescription("Provider One Node One"));
           
            MockNodeProvider ProviderThreeNodes = new MockNodeProvider();
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node One"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Two"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Three"));

            MockNodeProvider ProviderNoNodes = new MockNodeProvider();

            // Register a node provider with only one node
            NodeManager nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderOneNode);
            // One from node added by node provider, one for the default 0 local node (null as there is no description)
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 2, "Expected there to be two node Descriptions");
            Assert.AreEqual(2, nodeManager.MaxNodeCount);
            Assert.IsNull(nodeManager.GetNodeDescriptions()[0],"Expected first element to be null");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[1]).NodeDescription, "Provider One Node One", StringComparison.OrdinalIgnoreCase)==0, "Expected node description to be Provider One  Node One");

            // Register a node provider with more than one node
            nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            // THree from node added by node provider, one for the default 0 local node (null as there is no description)
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 4, "Expected there to be four node Descriptions");
            Assert.AreEqual(4, nodeManager.MaxNodeCount);
            Assert.IsNull(nodeManager.GetNodeDescriptions()[0], "Expected first element to be null");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[1]).NodeDescription, "Provider Two Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node One");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[2]).NodeDescription, "Provider Two Node Two", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Two");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[3]).NodeDescription, "Provider Two Node Three", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Three");


            // Register a node provider with more than one node
            nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderOneNode);
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            // THree from node added by node provider, one for the default 0 local node (null as there is no description)
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 5, "Expected there to be four node Descriptions");
            Assert.AreEqual(5, nodeManager.MaxNodeCount);
            Assert.IsNull(nodeManager.GetNodeDescriptions()[0], "Expected first element to be null");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[1]).NodeDescription, "Provider One Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider One Node One");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[2]).NodeDescription, "Provider Two Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node One");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[3]).NodeDescription, "Provider Two Node Two", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Two");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[4]).NodeDescription, "Provider Two Node Three", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Three");


            // Register a node provider with more than one node
            nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            nodeManager.RegisterNodeProvider(ProviderOneNode);
            nodeManager.UpdateSettings(true, false, true); // just need to test this once
            // THree from node added by node provider, one for the default 0 local node (null as there is no description)
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 5, "Expected there to be four node Descriptions");
            Assert.AreEqual(5, nodeManager.MaxNodeCount);
            Assert.IsNull(nodeManager.GetNodeDescriptions()[0], "Expected first element to be null");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[1]).NodeDescription, "Provider Two Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node One");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[2]).NodeDescription, "Provider Two Node Two", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Two");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[3]).NodeDescription, "Provider Two Node Three", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider Two Node Three");
            Assert.IsTrue(string.Compare(((MockNodeDescription)nodeManager.GetNodeDescriptions()[4]).NodeDescription, "Provider One Node One", StringComparison.OrdinalIgnoreCase) == 0, "Expected node description to be Provider One Node One");
        }
Exemple #3
0
        public void TestGetNodeDescriptions()
        {
            MockNodeProvider ProviderThreeNodes = new MockNodeProvider();
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node One"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Two"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Three"));

            MockNodeProvider ProviderOneNode = new MockNodeProvider();
            ProviderOneNode.NodeDescriptions.Add(new MockNodeDescription("Provider One Node One"));

            NodeManager nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            nodeManager.RegisterNodeProvider(ProviderOneNode);
            // Cant assert the contents yet as there is no definition inside of a INodeDescription interface
            Assert.IsTrue(nodeManager.GetNodeDescriptions().Length == 5, "Expected there to be five descriptions");
        }
Exemple #4
0
        public void TestPostBuildRequestToNode()
        {
            MockNodeProvider ProviderThreeNodes = new MockNodeProvider();
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node One"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Two"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Three"));

            MockNodeProvider ProviderOneNode = new MockNodeProvider();
            ProviderOneNode.NodeDescriptions.Add(new MockNodeDescription("Provider One Node One"));

            NodeManager nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            nodeManager.RegisterNodeProvider(ProviderOneNode);

            nodeManager.PostBuildRequestToNode(1, new BuildRequest(1, "ProjectFile", null, new BuildPropertyGroup(), null, 1, false, false));
            nodeManager.PostBuildRequestToNode(2, new BuildRequest(2, "ProjectFile", null, new BuildPropertyGroup(), null, 2, false, false));
            nodeManager.PostBuildRequestToNode(3, new BuildRequest(3, "ProjectFile", null, new BuildPropertyGroup(), null, 3, false, false));
            nodeManager.PostBuildRequestToNode(4, new BuildRequest(4, "ProjectFile", null, new BuildPropertyGroup(), null, 4, false, false));
            
            Assert.IsTrue(ProviderThreeNodes.buildRequestsSubmittedToProvider.Count == 3, "Expected there to be three build results in the mock provider");
            Assert.IsTrue(ProviderThreeNodes.buildRequestsSubmittedToProvider[0].HandleId == 1, "Expected first NodeProxyId to be 1");
            Assert.IsTrue(ProviderThreeNodes.buildRequestsSubmittedToProvider[1].HandleId == 2, "Expected second NodeProxyId to be 2");
            Assert.IsTrue(ProviderThreeNodes.buildRequestsSubmittedToProvider[2].HandleId == 3, "Expected third NodeProxyId to be 3");
            Assert.IsTrue(ProviderOneNode.buildRequestsSubmittedToProvider.Count == 1, "Expected there to be one build results in the mock provider");
            Assert.IsTrue(ProviderOneNode.buildRequestsSubmittedToProvider[0].HandleId == 4, "Expected first NodeProxyId to be 4");
        }
Exemple #5
0
        public void TestPostBuildResultToNode()
        {
            MockNodeProvider ProviderThreeNodes = new MockNodeProvider();
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node One"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Two"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Three"));

            MockNodeProvider ProviderOneNode = new MockNodeProvider();
            ProviderOneNode.NodeDescriptions.Add(new MockNodeDescription("Provider One Node One"));

            NodeManager nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            nodeManager.RegisterNodeProvider(ProviderOneNode);

            nodeManager.PostBuildResultToNode(1, new BuildResult(null, new Hashtable(StringComparer.OrdinalIgnoreCase), false, 2, 1, 6, false, string.Empty, string.Empty, 0, 0, 0));
            nodeManager.PostBuildResultToNode(2, new BuildResult(null, new Hashtable(StringComparer.OrdinalIgnoreCase), false, 3, 2, 7, false, string.Empty, string.Empty, 0, 0, 0));
            nodeManager.PostBuildResultToNode(3, new BuildResult(null, new Hashtable(StringComparer.OrdinalIgnoreCase), false, 4, 3, 8, false, string.Empty, string.Empty, 0, 0, 0));
            nodeManager.PostBuildResultToNode(4, new BuildResult(null, new Hashtable(StringComparer.OrdinalIgnoreCase), false, 5, 4, 9, false, string.Empty, string.Empty, 0, 0, 0));
            Assert.IsTrue(ProviderThreeNodes.buildResultsSubmittedToProvider.Count == 3, "Expected there to be three build results in the mock provider");
            Assert.IsTrue(ProviderThreeNodes.buildResultsSubmittedToProvider[0].HandleId == 2, "Expected first NodeProxyId to be 2");
            Assert.IsTrue(ProviderThreeNodes.buildResultsSubmittedToProvider[1].HandleId == 3, "Expected second NodeProxyId to be 3");
            Assert.IsTrue(ProviderThreeNodes.buildResultsSubmittedToProvider[2].HandleId == 4, "Expected third NodeProxyId to be 4");
            Assert.IsTrue(ProviderOneNode.buildResultsSubmittedToProvider.Count == 1, "Expected there to be one build results in the mock provider");
            Assert.IsTrue(ProviderOneNode.buildResultsSubmittedToProvider[0].HandleId == 5, "Expected first NodeProxyId to be 5");
        }
Exemple #6
0
        public void TestShutdownNodes()
        {
            MockNodeProvider ProviderThreeNodes = new MockNodeProvider();
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node One"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Two"));
            ProviderThreeNodes.NodeDescriptions.Add(new MockNodeDescription("Provider Two Node Three"));

            NodeManager nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
            nodeManager.RegisterNodeProvider(ProviderThreeNodes);
            nodeManager.ShutdownNodes(Node.NodeShutdownLevel.PoliteShutdown);

            Assert.IsTrue(ProviderThreeNodes.NodeDescriptions.TrueForAll(delegate(INodeDescription o)
                                                                                                     {
                                                                                                         return o == null;
                                                                                                     }
                                                                         ), "Expected all descriptions to be null");

        }
Exemple #7
0
 public void TestEnableOutOfProcLogging()
 {
     // Register a node provider with more than one node
     MockNodeProvider ProviderOneNode = new MockNodeProvider();
     ProviderOneNode.NodeDescriptions.Add(new MockNodeDescription("Provider One Node One"));
     NodeManager nodeManager = new NodeManager(1, false, new Engine(@"c:\"));
     nodeManager.RegisterNodeProvider(ProviderOneNode);
     nodeManager.UpdateSettings(true,false, true); // just need to test this once
 }