// Path: halfpipe-client/src/main/java/halfpipe/client/ClientConfigurer.java
// @Configuration
// public class ClientConfigurer {
// 
//     @Inject
//     ObjectMapper objectMapper;
// 
//     @Bean
//     public Encoder feignEncoder() {
//         return new JacksonEncoder(objectMapper);
//     }
// 
//     @Bean
//     public Decoder feignDecoder() {
//         return new HystrixJacksonDecoder(objectMapper);
//         //return new JacksonDecoder();
//     }
// 
//     @Bean
//     public Logger feignLogger() {
//         return new Slf4jLogger(); //TODO pass Client classname in
//     }
// 
//     @Bean
//     public InvocationHandlerFactory invocationHandlerFactory() {
//         return new HystrixInvocationHandler.Factory();
//     }
// 
//     protected Feign.Builder client() {
//         return Feign.builder()
//                 .logger(feignLogger())
//                 .encoder(feignEncoder())
//                 .decoder(feignDecoder())
//                 .invocationHandlerFactory(invocationHandlerFactory());
//     }
// 
// }
// 
// Path: halfpipe-client/src/test/java/halfpipe/client/TestClientBuilder.java
// public class TestClientBuilder {
// 
//     @Autowired
//     Encoder encoder;
// 
//     @Autowired
//     Decoder decoder;
// 
//     @Autowired
//     Logger logger;
// 
//     @Autowired
//     InvocationHandlerFactory invocationHandlerFactory;
// 
//     public Feign.Builder client() {
//         return Feign.builder()
//                 .logger(logger)
//                 .encoder(encoder)
//                 .decoder(decoder)
//                 .invocationHandlerFactory(invocationHandlerFactory)
//                 .logLevel(Logger.Level.FULL);
//     }
// }
// 
// Path: halfpipe-example-service/src/main/java/halfpipe/example/ExampleServiceApp.java
// @Configuration
// @EnableAutoConfiguration
// @ComponentScan(basePackageClasses = ExampleServiceApp.class)
// public class ExampleServiceApp {
// 
//     @Bean(name = "hello.callback")
//     Runnable helloPropertiesCallback() {
//         return new AbstractCallback<ExampleServiceProps, Object>() {
//             @Override
//             public void run() {
//                 logger.info("property named: {} changed to {}", prop.getName(), prop.getValue());
//             }
//         };
//     }
// 
//     @Bean(name = "hello.defaultMessage.callback")
//     Runnable helloDefaultMessageCallback() {
//         return new AbstractCallback<ExampleServiceProps, String>() {
//             @Override
//             public void run() {
//                 logger.info("hello.defaultMessage changed to {}", prop.getValue());
//             }
//         };
//     }
// 
//     public static void main(String[] args) {
//         SpringApplication.run(ExampleServiceApp.class, args);
//     }
// }
// 
// Path: halfpipe-example-service/src/main/java/halfpipe/example/model/Post.java
// @Entity
// @Data
// @ApiModel("A blog post")
// public class Post implements Serializable {
//     @Id
//     @GeneratedValue
//     @ApiModelProperty(value = "The post id")
//     private Long id;
// 
//     @Column(nullable = false)
//     @ApiModelProperty(value = "The post title", required = true)
//     private String title;
// 
//     @Column(nullable = false)
//     @ApiModelProperty(value = "The post body", required = true)
//     private String body;
// 
//     @Column(nullable = false)
//     @ApiModelProperty(value = "The post author", required = true)
//     private String author;
// 
// }


import com.netflix.hystrix.HystrixExecutable;
import halfpipe.client.ClientConfigurer;
import halfpipe.client.TestClientBuilder;
import halfpipe.example.ExampleServiceApp;
import halfpipe.example.model.Post;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.mock.web.MockServletContext;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import rx.Observable;
import javax.annotation.PostConstruct;
import javax.servlet.ServletContext;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import static org.junit.Assert.*;
package halfpipe.example.client;

/**
 * User: spencergibb
 * Date: 5/27/14
 * Time: 9:16 AM
 */




@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {PostClientIT.App.class, ExampleServiceApp.class})
@WebAppConfiguration
@IntegrationTest({
        "server.port=0",
        "application.id=testPostClient",
        "shell.ssh.enabled=false",
        "management.port=0",
})
public class PostClientIT {

    @EnableAutoConfiguration
// Path: halfpipe-client/src/main/java/halfpipe/client/ClientConfigurer.java
// @Configuration
// public class ClientConfigurer {
// 
//     @Inject
//     ObjectMapper objectMapper;
// 
//     @Bean
//     public Encoder feignEncoder() {
//         return new JacksonEncoder(objectMapper);
//     }
// 
//     @Bean
//     public Decoder feignDecoder() {
//         return new HystrixJacksonDecoder(objectMapper);
//         //return new JacksonDecoder();
//     }
// 
//     @Bean
//     public Logger feignLogger() {
//         return new Slf4jLogger(); //TODO pass Client classname in
//     }
// 
//     @Bean
//     public InvocationHandlerFactory invocationHandlerFactory() {
//         return new HystrixInvocationHandler.Factory();
//     }
// 
//     protected Feign.Builder client() {
//         return Feign.builder()
//                 .logger(feignLogger())
//                 .encoder(feignEncoder())
//                 .decoder(feignDecoder())
//                 .invocationHandlerFactory(invocationHandlerFactory());
//     }
// 
// }
// 
// Path: halfpipe-client/src/test/java/halfpipe/client/TestClientBuilder.java
// public class TestClientBuilder {
// 
//     @Autowired
//     Encoder encoder;
// 
//     @Autowired
//     Decoder decoder;
// 
//     @Autowired
//     Logger logger;
// 
//     @Autowired
//     InvocationHandlerFactory invocationHandlerFactory;
// 
//     public Feign.Builder client() {
//         return Feign.builder()
//                 .logger(logger)
//                 .encoder(encoder)
//                 .decoder(decoder)
//                 .invocationHandlerFactory(invocationHandlerFactory)
//                 .logLevel(Logger.Level.FULL);
//     }
// }
// 
// Path: halfpipe-example-service/src/main/java/halfpipe/example/ExampleServiceApp.java
// @Configuration
// @EnableAutoConfiguration
// @ComponentScan(basePackageClasses = ExampleServiceApp.class)
// public class ExampleServiceApp {
// 
//     @Bean(name = "hello.callback")
//     Runnable helloPropertiesCallback() {
//         return new AbstractCallback<ExampleServiceProps, Object>() {
//             @Override
//             public void run() {
//                 logger.info("property named: {} changed to {}", prop.getName(), prop.getValue());
//             }
//         };
//     }
// 
//     @Bean(name = "hello.defaultMessage.callback")
//     Runnable helloDefaultMessageCallback() {
//         return new AbstractCallback<ExampleServiceProps, String>() {
//             @Override
//             public void run() {
//                 logger.info("hello.defaultMessage changed to {}", prop.getValue());
//             }
//         };
//     }
// 
//     public static void main(String[] args) {
//         SpringApplication.run(ExampleServiceApp.class, args);
//     }
// }
// 
// Path: halfpipe-example-service/src/main/java/halfpipe/example/model/Post.java
// @Entity
// @Data
// @ApiModel("A blog post")
// public class Post implements Serializable {
//     @Id
//     @GeneratedValue
//     @ApiModelProperty(value = "The post id")
//     private Long id;
// 
//     @Column(nullable = false)
//     @ApiModelProperty(value = "The post title", required = true)
//     private String title;
// 
//     @Column(nullable = false)
//     @ApiModelProperty(value = "The post body", required = true)
//     private String body;
// 
//     @Column(nullable = false)
//     @ApiModelProperty(value = "The post author", required = true)
//     private String author;
// 
// }


// Path: halfpipe-example-service/src/test/java/halfpipe/example/client/PostClientIT.java
import com.netflix.hystrix.HystrixExecutable;
import halfpipe.client.ClientConfigurer;
import halfpipe.client.TestClientBuilder;
import halfpipe.example.ExampleServiceApp;
import halfpipe.example.model.Post;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.mock.web.MockServletContext;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import rx.Observable;
import javax.annotation.PostConstruct;
import javax.servlet.ServletContext;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import static org.junit.Assert.*;

package halfpipe.example.client;

/**
 * User: spencergibb
 * Date: 5/27/14
 * Time: 9:16 AM
 */




@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {PostClientIT.App.class, ExampleServiceApp.class})
@WebAppConfiguration
@IntegrationTest({
        "server.port=0",
        "application.id=testPostClient",
        "shell.ssh.enabled=false",
        "management.port=0",
})
public class PostClientIT {

    @EnableAutoConfiguration
    @Configuration