Beispiel #1
0
        private void LinkRelation(ModifierProtocol item, RelationProtocol relation, Hashtable ancestors)
        {
            if (!modifyItems.ContainsKey(relation.Reference))
            {
                throw new InvalidOperationException(String.Format("Modification item '{0}' defines a reference '{1}' which was not found.", item.Name, relation.Reference));
            }

            relation.ReferenceInstance = modifyItems[relation.Reference];
            LinkReferencesRecursive(relation.ReferenceInstance, ancestors);
        }
Beispiel #2
0
        private static ModifierResultProtocol[] GetResults(ModifierProtocol[] modifierProtocols)
        {
            ModifierResultProtocol[] modifierResultProtocols = new ModifierResultProtocol[modifierProtocols.Length];

            for (int i = 0; i < modifierProtocols.Length; i++)
            {
                ModifierProtocol modifierProtocol = modifierProtocols[i];
                modifierResultProtocols[i] = new ModifierResultProtocol(modifierProtocol.Name, modifierProtocol.GetAction(), modifierProtocol.Table, modifierProtocol.GetRecordObjID());
            }

            return(modifierResultProtocols);
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSendModifierProtocolResponseForGivenProtocol()
        public void shouldSendModifierProtocolResponseForGivenProtocol()
        {
            // given
            ISet <string> versions = asSet(TestProtocols_TestModifierProtocols.allVersionsOf(COMPRESSION));

            _server.handle(InitialMagicMessage.Instance());

            // when
            _server.handle(new ModifierProtocolRequest(COMPRESSION.canonicalName(), versions));

            // then
            ModifierProtocol expected = TestProtocols_TestModifierProtocols.latest(COMPRESSION);

            verify(_channel).writeAndFlush(new ModifierProtocolResponse(SUCCESS, expected.category(), expected.implementation()));
        }
Beispiel #4
0
        private void LinkReferencesRecursive(ModifierProtocol item, Hashtable ancestors)
        {
            Hashtable ht = (ancestors == null) ? new Hashtable() : (Hashtable)ancestors.Clone();

            if (ht.ContainsKey(item.Name))
            {
                throw new InvalidOperationException(String.Format(@"Circular reference to item '{0}'.", item.Name));
            }

            ht.Add(item.Name, item);

            foreach (RelationProtocol relation in item.Relations)
            {
                LinkRelation(item, relation, ht);
            }

            foreach (RelationProtocol relation in item.UniqueRelations)
            {
                LinkRelation(item, relation, ht);
            }
        }
Beispiel #5
0
 public virtual Builder Modifier(ModifierProtocol modifierProtocol)
 {
     ModifierProtocols.Add(modifierProtocol);
     return(this);
 }