PipelineApplication extends Application<PipelineConfiguration> { @Override public void run(final PipelineConfiguration configuration, final Environment environment) throws Exception { final AwsConfiguration awsConfig = configuration.getAws(); final AmazonS3 s3 = awsConfig.buildS3(environment); final AmazonSQS sqs = awsConfig.buildSQS(environment); final AmazonSQSIterator sqsIterator = new AmazonSQSIterator(sqs, awsConfig.getQueueUrl()); environment.lifecycle().manage(new AmazonSQSIteratorManager(sqsIterator)); final AmazonS3Downloader s3Downloader = new AmazonS3Downloader(s3); final InstrumentedSseBroadcaster broadcaster = new InstrumentedSseBroadcaster(); final MessageProcessor processor = new MessageProcessor(s3Downloader, broadcaster); final ExecutorService service = environment.lifecycle().executorService("sqs-%d").minThreads(1).build(); final PipelineRunnable runnable = new PipelineRunnable(processor, sqsIterator, broadcaster); service.execute(runnable); final ScheduledExecutorService scheduler = environment.lifecycle().scheduledExecutorService("heartbeat-%d").threads(1).build(); scheduler.scheduleAtFixedRate(() -> broadcaster.ping(), 0, 1, TimeUnit.SECONDS); environment .lifecycle() .addServerLifecycleListener( server -> { for (Handler handler : server.getChildHandlersByClass(BiDiGzipHandler.class)) { ((BiDiGzipHandler) handler).addExcludedMimeTypes(SseFeature.SERVER_SENT_EVENTS); } }); environment.jersey().register(new EventResource(broadcaster)); environment.jersey().register(new PingResource()); environment.jersey().register(new VersionResource()); }  static void main(final String[] args); @Override String getName(); @Override void initialize(Bootstrap<PipelineConfiguration> bootstrap); @Override void run(final PipelineConfiguration configuration, final Environment environment);  }
@Test @Ignore public void buildsAVersionResource() throws Exception { application.run(config, environment); verify(jersey).register(isA(VersionResource.class)); }
@Test @Ignore public void buildsAPingResource() throws Exception { application.run(config, environment); verify(jersey).register(isA(PingResource.class)); }