// Path: src/main/java/org/msgpack/rpc/builder/StopWatchDispatcherBuilder.java
// public class StopWatchDispatcherBuilder implements DispatcherBuilder {
// 
//     protected DispatcherBuilder baseBuilder;
//     protected boolean verbose = false;
// 
//     public boolean isVerbose() {
//         return verbose;
//     }
// 
//     public void setVerbose(boolean verbose) {
//         this.verbose = verbose;
//     }
// 
//     public StopWatchDispatcherBuilder withVerboseOutput(boolean verbose){
//         this.verbose = verbose;
//         return this;
//     }
// 
//     public StopWatchDispatcherBuilder(DispatcherBuilder baseBuilder){
//         this.baseBuilder = baseBuilder;
//     }
// 
//     public Dispatcher decorate(Dispatcher innerDispatcher) {
//         StopWatchDispatcher disp = new StopWatchDispatcher(innerDispatcher);
//         disp.setVerbose(verbose);
//         return disp;
//     }
// 
//     public Dispatcher build(Object handler, MessagePack messagePack) {
//         return decorate(baseBuilder.build(handler,messagePack));
//     }
// }


import junit.framework.TestCase;
import org.apache.log4j.BasicConfigurator;
import org.junit.Test;
import org.msgpack.MessageTypeException;
import org.msgpack.rpc.builder.StopWatchDispatcherBuilder;
import org.msgpack.rpc.loop.EventLoop;
import org.msgpack.type.Value;
package org.msgpack.rpc;


/**
 * User: takeshita
 * Create: 12/06/15 1:51
 */
public class DecoratorTest extends TestCase {

    public static class TestServer{

        public String success() {
            return "ok";
        }

        public String throwError(String errorMessage) throws Exception{
            throw new MessageTypeException(errorMessage);
        }
    }


    /**
     * Test any Exception is not thrown.
     * @throws Exception
     */
    @Test
    public void testDecorateStopWatch()  throws Exception {

        BasicConfigurator.configure();
        EventLoop loop = EventLoop.start();
        Server svr = new Server(loop);
        svr.setDispatcherBuilder(
// Path: src/main/java/org/msgpack/rpc/builder/StopWatchDispatcherBuilder.java
// public class StopWatchDispatcherBuilder implements DispatcherBuilder {
// 
//     protected DispatcherBuilder baseBuilder;
//     protected boolean verbose = false;
// 
//     public boolean isVerbose() {
//         return verbose;
//     }
// 
//     public void setVerbose(boolean verbose) {
//         this.verbose = verbose;
//     }
// 
//     public StopWatchDispatcherBuilder withVerboseOutput(boolean verbose){
//         this.verbose = verbose;
//         return this;
//     }
// 
//     public StopWatchDispatcherBuilder(DispatcherBuilder baseBuilder){
//         this.baseBuilder = baseBuilder;
//     }
// 
//     public Dispatcher decorate(Dispatcher innerDispatcher) {
//         StopWatchDispatcher disp = new StopWatchDispatcher(innerDispatcher);
//         disp.setVerbose(verbose);
//         return disp;
//     }
// 
//     public Dispatcher build(Object handler, MessagePack messagePack) {
//         return decorate(baseBuilder.build(handler,messagePack));
//     }
// }


// Path: src/test/java/org/msgpack/rpc/DecoratorTest.java
import junit.framework.TestCase;
import org.apache.log4j.BasicConfigurator;
import org.junit.Test;
import org.msgpack.MessageTypeException;
import org.msgpack.rpc.builder.StopWatchDispatcherBuilder;
import org.msgpack.rpc.loop.EventLoop;
import org.msgpack.type.Value;

package org.msgpack.rpc;


/**
 * User: takeshita
 * Create: 12/06/15 1:51
 */
public class DecoratorTest extends TestCase {

    public static class TestServer{

        public String success() {
            return "ok";
        }

        public String throwError(String errorMessage) throws Exception{
            throw new MessageTypeException(errorMessage);
        }
    }


    /**
     * Test any Exception is not thrown.
     * @throws Exception
     */
    @Test
    public void testDecorateStopWatch()  throws Exception {

        BasicConfigurator.configure();
        EventLoop loop = EventLoop.start();
        Server svr = new Server(loop);
        svr.setDispatcherBuilder(
                new StopWatchDispatcherBuilder(svr.getDispatcherBuilder()).