예제 #1
0
        public void CastCheckExpectedCompatIds()
        {
            Type           t = typeof(ISimpleGrain);
            int            expectedInterfaceId = GrainInterfaceData.GetGrainInterfaceId(t);
            GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <ISimpleGrain>(random.Next(), SimpleGrain.SimpleGrainNamePrefix);

            Assert.IsTrue(grain.IsCompatible(expectedInterfaceId));
        }
예제 #2
0
        public void CastFailInternalCastFromBadType()
        {
            Type           t     = typeof(ISimpleGrain);
            GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <ISimpleGrain>(random.Next(), SimpleGrain.SimpleGrainNamePrefix);
            IAddressable   cast  = GrainReference.CastInternal(
                typeof(Boolean),
                null,
                grain,
                GrainInterfaceData.GetGrainInterfaceId(t));

            Assert.Fail("Exception should have been raised");
        }
예제 #3
0
        public void CastCheckExpectedCompatIds2()
        {
            // GeneratorTestDerivedDerivedGrainReference extends GeneratorTestDerivedGrain2Reference
            // GeneratorTestDerivedGrain2Reference extends GeneratorTestGrainReference
            Type           t1    = typeof(IGeneratorTestDerivedDerivedGrain);
            Type           t2    = typeof(IGeneratorTestDerivedGrain2);
            Type           t3    = typeof(IGeneratorTestGrain);
            int            id1   = GrainInterfaceData.GetGrainInterfaceId(t1);
            int            id2   = GrainInterfaceData.GetGrainInterfaceId(t2);
            int            id3   = GrainInterfaceData.GetGrainInterfaceId(t3);
            GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <IGeneratorTestDerivedDerivedGrain>(GetRandomGrainId());

            Assert.IsTrue(grain.IsCompatible(id1));
            Assert.IsTrue(grain.IsCompatible(id2));
            Assert.IsTrue(grain.IsCompatible(id3));
        }
예제 #4
0
        public void ConfirmServiceInterfacesListContents()
        {
            // GeneratorTestDerivedDerivedGrainReference extends GeneratorTestDerivedGrain2Reference
            // GeneratorTestDerivedGrain2Reference extends GeneratorTestGrainReference
            Type t1  = typeof(IGeneratorTestDerivedDerivedGrain);
            Type t2  = typeof(IGeneratorTestDerivedGrain2);
            Type t3  = typeof(IGeneratorTestGrain);
            int  id1 = GrainInterfaceData.GetGrainInterfaceId(t1);
            int  id2 = GrainInterfaceData.GetGrainInterfaceId(t2);
            int  id3 = GrainInterfaceData.GetGrainInterfaceId(t3);

            var interfaces = GrainInterfaceData.GetRemoteInterfaces(typeof(IGeneratorTestDerivedDerivedGrain));

            Assert.IsNotNull(interfaces);
            Assert.AreEqual(3, interfaces.Keys.Count);
            Assert.IsTrue(interfaces.Keys.Contains(id1), "id1 is present");
            Assert.IsTrue(interfaces.Keys.Contains(id2), "id2 is present");
            Assert.IsTrue(interfaces.Keys.Contains(id3), "id3 is present");
        }
예제 #5
0
 public void InterfaceRules_ObserverGrain_PropertySetter()
 {
     GrainInterfaceData.ValidateInterface(typeof(IInheritedGrain_ObserverGrain_PropertySetter));
 }
예제 #6
0
 public void InterfaceRules_ObserverGrain_IntMethod()
 {
     GrainInterfaceData.ValidateInterface(typeof(IInheritedGrain_ObserverGrain_IntMethod));
 }
예제 #7
0
 public void InterfaceRules_RefArgument()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestGrain_RefArgument));
 }
예제 #8
0
 public void InterfaceRules_Observer_Property()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestObserver_Property));
 }
예제 #9
0
 public void InterfaceRules_Observer_NonVoidMethod()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestObserver_NonVoidMethod));
 }
예제 #10
0
 public void InterfaceRules_PropertySetter()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestGrain_PropertySetter));
 }
예제 #11
0
 public void InterfaceRules_IntProperty()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestGrain_IntProperty));
 }
예제 #12
0
 public void InterfaceRules_IntMethod()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestGrain_IntMethod));
 }