assertNotNull(protocols);
assertEquals(6, protocols.size());
for(int i=0; i < names.length; i++) {
String name=names[i];
Protocol p=(Protocol)protocols.get(i);
assertEquals(name, p.getName());
}
// insert below
Protocol new_prot=(Protocol)Class.forName("org.jgroups.protocols.TRACE").newInstance();
stack.insertProtocol(new_prot, ProtocolStack.BELOW, "UNICAST");
protocols=stack.getProtocols();
assertEquals(7, protocols.size());
for(int i=0; i < below.length; i++) {
String name=below[i];
Protocol p=(Protocol)protocols.get(i);
assertEquals(name, p.getName());
}
// remove
Protocol prot=stack.removeProtocol("TRACE");
assertNotNull(prot);
protocols=stack.getProtocols();
assertEquals(6, protocols.size());
for(int i=0; i < names.length; i++) {
String name=names[i];
Protocol p=(Protocol)protocols.get(i);
assertEquals(name, p.getName());
}
// insert above
new_prot=(Protocol)Class.forName("org.jgroups.protocols.TRACE").newInstance();
stack.insertProtocol(new_prot, ProtocolStack.ABOVE, "UNICAST");
protocols=stack.getProtocols();
assertEquals(7, protocols.size());
for(int i=0; i < above.length; i++) {
String name=above[i];
Protocol p=(Protocol)protocols.get(i);
assertEquals(name, p.getName());
}
}