FileDocCategorySizeDatePackage
TestChannelOptionFlag.javaAPI DocApache Tomcat 6.0.143013Fri Jul 20 04:20:36 BST 2007org.apache.catalina.tribes.test.channel

TestChannelOptionFlag

public class TestChannelOptionFlag extends TestCase

Title:

Description:

Company:

author
not attributable
version
1.0

Fields Summary
GroupChannel
channel
Constructors Summary
Methods Summary
protected voidsetUp()

         
        super.setUp();
        channel = new GroupChannel();
    
protected voidtearDown()

        super.tearDown();
        if ( channel != null ) try {channel.stop(channel.DEFAULT);}catch ( Exception ignore) {}
        channel = null;
    
public voidtestOptionConflict()

        boolean error = false;
        channel.setOptionCheck(true);
        ChannelInterceptor i = new TestInterceptor();
        i.setOptionFlag(128);
        channel.addInterceptor(i);
        i = new TestInterceptor();
        i.setOptionFlag(128);
        channel.addInterceptor(i);
        try {
            channel.start(channel.DEFAULT);
        }catch ( ChannelException x ) {
            if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
        }
        assertEquals(true,error);
    
public voidtestOptionNoConflict()

        boolean error = false;
        channel.setOptionCheck(true);
        ChannelInterceptor i = new TestInterceptor();
        i.setOptionFlag(128);
        channel.addInterceptor(i);
        i = new TestInterceptor();
        i.setOptionFlag(64);
        channel.addInterceptor(i);
        i = new TestInterceptor();
        i.setOptionFlag(256);
        channel.addInterceptor(i);
        try {
            channel.start(channel.DEFAULT);
        }catch ( ChannelException x ) {
            if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
        }
        assertEquals(false,error);