package io.cozmic.usher.test.integration;

import io.cozmic.usher.TimeoutLogger;
import org.junit.Test;
import org.vertx.java.core.Handler;
import org.vertx.java.core.buffer.Buffer;
import org.vertx.java.core.eventbus.Message;

import static org.vertx.testtools.VertxAssert.assertEquals;
import static org.vertx.testtools.VertxAssert.fail;
import static org.vertx.testtools.VertxAssert.testComplete;

/**
 * Created by chuck on 9/25/14.
 */
public class NetProxyIntegrationTests extends NetProxyBaseIntegrationTests {




    @Test
    public void testSimpleProxyRequest() throws InterruptedException {


            sendToProxy(createFakeTrackingPacket(), 5, 500000, new Handler<Buffer>() {
                @Override
                public void handle(Buffer response) {
                    final byte type = response.getByte(0);
                    assertEquals(0x11, type);

                }
            }, new Handler<Void>() {

                @Override
                public void handle(Void event) {

                    vertx.eventBus().send(TimeoutLogger.COUNT_ADDRESS, true, new Handler<Message<Integer>>() {
                                @Override
                                public void handle(Message<Integer> event) {

                                    container.logger().info("Timeout log count is " + event.body());
                                    testComplete();
                                }
                            });


                }
            });

        vertx.setPeriodic(5000, new Handler<Long>() {
            @Override
            public void handle(Long event) {
                vertx.eventBus().send(TimeoutLogger.COUNT_ADDRESS, true, new Handler<Message<Integer>>() {
                    @Override
                    public void handle(Message<Integer> event) {

                        container.logger().info("Timeout log count is " + event.body());

                    }
                });
            }
        });
        }

    }

@@ -59,29 +59,35 @@
 c.usher.
-TimeoutLogger
+PersistenceVerticle
 ;%0Aimport
@@ -1012,458 +1012,44 @@
 ) %7B%0A
-%0A                    vertx.eventBus().send(TimeoutLogger.COUNT_ADDRESS, true, new Handler%3CMessage%3CInteger%3E%3E() %7B%0A                                @Override%0A                                public void handle(Message%3CInteger%3E event) %7B%0A%0A                                    container.logger().info(%22Timeout log count is %22 + event.body());%0A                                    testComplete();%0A                                %7D%0A                            %7D);
+                    testComplete();%0A
 %0A%0A%0A 
@@ -1078,24 +1078,26 @@
        %7D);%0A%0A
+//
         vert
@@ -1134,24 +1134,26 @@
 r%3CLong%3E() %7B%0A
+//
             
@@ -1154,32 +1154,34 @@
       @Override%0A
+//
             publ
@@ -1201,32 +1201,34 @@
 e(Long event) %7B%0A
+//
                 
@@ -1253,22 +1253,40 @@
 end(
-TimeoutLogger.
+PersistenceVerticle.TIMEOUT_LOG_
 COUN
@@ -1332,24 +1332,26 @@
 teger%3E%3E() %7B%0A
+//
             
@@ -1360,32 +1360,34 @@
       @Override%0A
+//
                 
@@ -1431,25 +1431,29 @@
 r%3E event) %7B%0A
-%0A
+//%0A//
             
@@ -1529,17 +1529,21 @@
 ody());%0A
-%0A
+//%0A//
         
@@ -1548,32 +1548,34 @@
               %7D%0A
+//
                 
@@ -1570,32 +1570,34 @@
             %7D);%0A
+//
             %7D%0A  
@@ -1586,32 +1586,34 @@
 //            %7D%0A
+//
         %7D);%0A    

Update test with changes