assert protocols != null;
Assert.assertEquals(6, protocols.size());
for(int i=0; i < names.length; i++) {
String name=names[i];
Protocol p=protocols.get(i);
Assert.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();
Assert.assertEquals(7, protocols.size());
for(int i=0; i < below.length; i++) {
String name=below[i];
Protocol p=protocols.get(i);
Assert.assertEquals(name, p.getName());
}
// remove
Protocol prot=stack.removeProtocol("TRACE");
assert prot != null;
protocols=stack.getProtocols();
Assert.assertEquals(6, protocols.size());
for(int i=0; i < names.length; i++) {
String name=names[i];
Protocol p=protocols.get(i);
Assert.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();
Assert.assertEquals(7, protocols.size());
for(int i=0; i < above.length; i++) {
String name=above[i];
Protocol p=protocols.get(i);
Assert.assertEquals(name, p.getName());
}
}