示例#1
0
        public override bool Equals(object obj)
        {
            OtherType ot = obj as OtherType;

            if (ot != null)
            {
                return(m_struct.Equals(ot.m_struct));
            }
            return(false);
        }
示例#2
0
        private ISerializable CreateOtherType(int i, int otherType)
        {
            ISerializable ot;

            switch (otherType)
            {
            case OTHER_TYPE1: ot = new OtherType(i, i + 20000); break;

            case OTHER_TYPE2: ot = new OtherType2(i, i + 20000); break;

            case OTHER_TYPE22: ot = new OtherType22(i, i + 20000); break;

            case OTHER_TYPE4: ot = new OtherType4(i, i + 20000); break;

            case OTHER_TYPE42: ot = new OtherType42(i, i + 20000); break;

            case OTHER_TYPE43: ot = new OtherType43(i, i + 20000); break;

            default: ot = new OtherType(i, i + 20000); break;
            }
            return(ot);
        }
        private void DoPutsOtherTypeWithEx(OtherType.ExceptionType exType)
        {
            var region = CacheHelper.GetVerifyRegion <object, object>(m_regionNames[0]);

            for (var keyNum = 1; keyNum <= 10; ++keyNum)
            {
                try
                {
                    region["key-" + keyNum] = new OtherType(keyNum, keyNum * keyNum, exType);
                    if (exType != OtherType.ExceptionType.None)
                    {
                        Assert.Fail("Expected an exception in Put");
                    }
                }
                catch (GeodeIOException ex)
                {
                    if (exType == OtherType.ExceptionType.Geode)
                    {
                        // Successfully changed exception back and forth
                        Util.Log("Got expected exception in Put: " + ex);
                    }
                    else if (exType == OtherType.ExceptionType.GeodeGeode)
                    {
                        if (ex.InnerException is CacheServerException)
                        {
                            // Successfully changed exception back and forth
                            Util.Log("Got expected exception in Put: " + ex);
                        }
                        else
                        {
                            throw;
                        }
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (CacheServerException ex)
                {
                    if (exType == OtherType.ExceptionType.GeodeSystem)
                    {
                        if (ex.InnerException is IOException)
                        {
                            // Successfully changed exception back and forth
                            Util.Log("Got expected exception in Put: " + ex);
                        }
                        else
                        {
                            throw;
                        }
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (IOException ex)
                {
                    if (exType == OtherType.ExceptionType.System)
                    {
                        // Successfully changed exception back and forth
                        Util.Log("Got expected system exception in Put: " + ex);
                    }
                    else
                    {
                        throw;
                    }
                }
                catch (ApplicationException ex)
                {
                    if (exType == OtherType.ExceptionType.SystemGeode)
                    {
                        if (ex.InnerException is CacheServerException)
                        {
                            // Successfully changed exception back and forth
                            Util.Log("Got expected system exception in Put: " + ex);
                        }
                        else
                        {
                            throw;
                        }
                    }
                    else if (exType == OtherType.ExceptionType.SystemSystem)
                    {
                        if (ex.InnerException is IOException)
                        {
                            // Successfully changed exception back and forth
                            Util.Log("Got expected system exception in Put: " + ex);
                        }
                        else
                        {
                            throw;
                        }
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }