Ejemplo n.º 1
0
 public void TestAffinityChangeAfterClearingHostObject()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
     hostServices.RegisterHostObject("project", "target", "task", null);
     Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
     hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
     Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
 }
Ejemplo n.º 2
0
        public void TestUnregisteringNonConflictingHostObjectRestoresOriginalAffinity()
        {
            HostServices hostServices = new HostServices();
            TestHostObject hostObject = new TestHostObject();
            hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc);
            hostServices.SetNodeAffinity("project", NodeAffinity.Any);
            Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2"));
            Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));

            hostServices.RegisterHostObject("project", "target", "task", hostObject);
            Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
            hostServices.RegisterHostObject("project", "target", "task", null);
            Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
            Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project2"));
        }
Ejemplo n.º 3
0
 public void TestContradictoryAffinityCausesException_Any()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
     hostServices.SetNodeAffinity("project", NodeAffinity.Any);
 }
Ejemplo n.º 4
0
 public void TestNonContraditcoryHostObjectAllowed_Any()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.SetNodeAffinity("project", NodeAffinity.Any);
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
 }
Ejemplo n.º 5
0
        public void TestOverrideGeneralAffinityRegistration()
        {
            HostServices hostServices = new HostServices();

            hostServices.SetNodeAffinity(String.Empty, NodeAffinity.InProc);
            hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
            Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
            Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project2"));
        }
Ejemplo n.º 6
0
        public void TestClearingAffinities()
        {
            HostServices hostServices = new HostServices();

            hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
            Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity(null, NodeAffinity.OutOfProc);
            Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));

            hostServices.SetNodeAffinity(String.Empty, NodeAffinity.OutOfProc);
            Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
            hostServices.SetNodeAffinity(null, NodeAffinity.OutOfProc);
            Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
        }
Ejemplo n.º 7
0
 public void TestDefaultAffinityWhenProjectNotRegistered()
 {
     HostServices hostServices = new HostServices();
     hostServices.SetNodeAffinity("project1", NodeAffinity.InProc);
     Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project2"));
 }
Ejemplo n.º 8
0
 public void TestSpecificAffinityRegistration()
 {
     HostServices hostServices = new HostServices();
     hostServices.SetNodeAffinity("project", NodeAffinity.InProc);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
     hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
     Assert.AreEqual(NodeAffinity.OutOfProc, hostServices.GetNodeAffinity("project"));
     hostServices.SetNodeAffinity("project", NodeAffinity.Any);
     Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
 }
Ejemplo n.º 9
0
 public void TestHostObjectCausesInProcAffinity()
 {
     HostServices hostServices = new HostServices();
     TestHostObject hostObject = new TestHostObject();
     hostServices.RegisterHostObject("project", "target", "task", hostObject);
     Assert.AreEqual(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
 }
Ejemplo n.º 10
0
 public void TestAffinityDefaultsToAny()
 {
     HostServices hostServices = new HostServices();
     Assert.AreEqual(NodeAffinity.Any, hostServices.GetNodeAffinity("project"));
 }
Ejemplo n.º 11
0
 public void TestContradictoryAffinityCausesException_OutOfProc()
 {
     Assert.Throws<InvalidOperationException>(() =>
     {
         HostServices hostServices = new HostServices();
         TestHostObject hostObject = new TestHostObject();
         hostServices.RegisterHostObject("project", "target", "task", hostObject);
         Assert.Equal(NodeAffinity.InProc, hostServices.GetNodeAffinity("project"));
         hostServices.SetNodeAffinity("project", NodeAffinity.OutOfProc);
     }
    );
 }