// Path: src/test/java/com/schibsted/triathlon/service/RxTestServer.java
// public class RxTestServer {
//     public static final int DEFAULT_PORT = 8088;
// 
//     private final int port;
// 
//     private HttpServer<ByteBuf, ByteBuf> server;
// 
//     public RxTestServer(int port) {
//         this.port = port;
//     }
// 
//     public HttpServer<ByteBuf, ByteBuf> createServer() {
//         HttpServer<ByteBuf, ByteBuf> server = RxNetty.newHttpServerBuilder(port, new RequestHandler<ByteBuf, ByteBuf>() {
//             @Override
//             public Observable<Void> handle(HttpServerRequest<ByteBuf> request, final HttpServerResponse<ByteBuf> response) {
//                 if (request.getPath().contains("/v2/apps")) {
//                     if (request.getHttpMethod().equals(HttpMethod.POST)) {
//                         return handleTest(request, response);
//                     }
//                 }
//                 response.setStatus(HttpResponseStatus.NOT_FOUND);
//                 return response.close();
//             }
//         }).pipelineConfigurator(PipelineConfigurators.<ByteBuf, ByteBuf>httpServerConfigurator()).enableWireLogging(LogLevel.ERROR).build();
// 
//         System.out.println("RxTetstServer server started...");
//         return server;
//     }
// 
//     private Observable<Void> handleTest(HttpServerRequest<ByteBuf> request, final HttpServerResponse<ByteBuf> response) {
//         response.setStatus(HttpResponseStatus.OK);
// 
//         ByteBuf byteBuf = UnpooledByteBufAllocator.DEFAULT.buffer();
//         byteBuf.writeBytes("test".getBytes(Charset.defaultCharset()));
// 
//         response.write(byteBuf);
//         return response.close();
//     }
// 
//     public void start(){
//         server = createServer();
//         server.start();
//     }
// 
//     public void shutdown(){
//         try {
//             server.shutdown();
//         } catch (InterruptedException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     public static void main(final String[] args) {
//         new RxTestServer(DEFAULT_PORT).createServer().startAndWait();
//     }
// 
// }


import com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo;
import com.netflix.eureka2.registry.datacenter.DataCenterInfo;
import com.netflix.eureka2.registry.instance.InstanceInfo;
import com.netflix.eureka2.registry.instance.NetworkAddress;
import com.netflix.eureka2.registry.instance.ServicePort;
import com.schibsted.triathlon.service.RxTestServer;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.reactivex.netty.RxNetty;
import io.reactivex.netty.protocol.http.AbstractHttpContentHolder;
import io.reactivex.netty.protocol.http.client.HttpClientRequest;
import io.reactivex.netty.protocol.http.client.HttpClientResponse;
import io.reactivex.netty.protocol.http.server.HttpServer;
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
import io.reactivex.netty.protocol.http.server.HttpServerResponse;
import io.reactivex.netty.protocol.http.server.RequestHandler;
import io.reactivex.netty.server.RxServer;
import netflix.karyon.transport.http.SimpleUriRouter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import rx.Observable;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.*;
import static rx.Observable.using;
/*
 * Copyright (c) 2015 Schibsted Products and Technology
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.schibsted.triathlon.service.commands;




/**
 * @author Albert Manyà
 */
public class MarathonCommandTest {

    private InstanceInfo ii;
// Path: src/test/java/com/schibsted/triathlon/service/RxTestServer.java
// public class RxTestServer {
//     public static final int DEFAULT_PORT = 8088;
// 
//     private final int port;
// 
//     private HttpServer<ByteBuf, ByteBuf> server;
// 
//     public RxTestServer(int port) {
//         this.port = port;
//     }
// 
//     public HttpServer<ByteBuf, ByteBuf> createServer() {
//         HttpServer<ByteBuf, ByteBuf> server = RxNetty.newHttpServerBuilder(port, new RequestHandler<ByteBuf, ByteBuf>() {
//             @Override
//             public Observable<Void> handle(HttpServerRequest<ByteBuf> request, final HttpServerResponse<ByteBuf> response) {
//                 if (request.getPath().contains("/v2/apps")) {
//                     if (request.getHttpMethod().equals(HttpMethod.POST)) {
//                         return handleTest(request, response);
//                     }
//                 }
//                 response.setStatus(HttpResponseStatus.NOT_FOUND);
//                 return response.close();
//             }
//         }).pipelineConfigurator(PipelineConfigurators.<ByteBuf, ByteBuf>httpServerConfigurator()).enableWireLogging(LogLevel.ERROR).build();
// 
//         System.out.println("RxTetstServer server started...");
//         return server;
//     }
// 
//     private Observable<Void> handleTest(HttpServerRequest<ByteBuf> request, final HttpServerResponse<ByteBuf> response) {
//         response.setStatus(HttpResponseStatus.OK);
// 
//         ByteBuf byteBuf = UnpooledByteBufAllocator.DEFAULT.buffer();
//         byteBuf.writeBytes("test".getBytes(Charset.defaultCharset()));
// 
//         response.write(byteBuf);
//         return response.close();
//     }
// 
//     public void start(){
//         server = createServer();
//         server.start();
//     }
// 
//     public void shutdown(){
//         try {
//             server.shutdown();
//         } catch (InterruptedException e) {
//             e.printStackTrace();
//         }
//     }
// 
//     public static void main(final String[] args) {
//         new RxTestServer(DEFAULT_PORT).createServer().startAndWait();
//     }
// 
// }


// Path: src/test/java/com/schibsted/triathlon/service/commands/MarathonCommandTest.java
import com.netflix.eureka2.registry.datacenter.BasicDataCenterInfo;
import com.netflix.eureka2.registry.datacenter.DataCenterInfo;
import com.netflix.eureka2.registry.instance.InstanceInfo;
import com.netflix.eureka2.registry.instance.NetworkAddress;
import com.netflix.eureka2.registry.instance.ServicePort;
import com.schibsted.triathlon.service.RxTestServer;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.reactivex.netty.RxNetty;
import io.reactivex.netty.protocol.http.AbstractHttpContentHolder;
import io.reactivex.netty.protocol.http.client.HttpClientRequest;
import io.reactivex.netty.protocol.http.client.HttpClientResponse;
import io.reactivex.netty.protocol.http.server.HttpServer;
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
import io.reactivex.netty.protocol.http.server.HttpServerResponse;
import io.reactivex.netty.protocol.http.server.RequestHandler;
import io.reactivex.netty.server.RxServer;
import netflix.karyon.transport.http.SimpleUriRouter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import rx.Observable;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.*;
import static rx.Observable.using;

/*
 * Copyright (c) 2015 Schibsted Products and Technology
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.schibsted.triathlon.service.commands;




/**
 * @author Albert Manyà
 */
public class MarathonCommandTest {

    private InstanceInfo ii;
    private static RxTestServer testServer = new RxTestServer(8088);