// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/config/DiskSpaceConfiguration.java
// public class DiskSpaceConfiguration {
// 
// 	public static final String ELASTICSEARCH_CHECKER = "elasticsearch";
// 	public static final String SOLR_LOCAL_CHECKER = "solr";
// 	public static final String CLUSTER_CHECKER = "cluster";
// 
// 	@NotNull
// 	private String checkerType;
// 
// 	@NotNull
// 	private String threshold;
// 
// 	@NotNull
// 	private Map<String, Object> configuration = new HashMap<>();
// 
// 
// 	public String getCheckerType() {
// 		return checkerType;
// 	}
// 
// 	public void setCheckerType(String checkerType) {
// 		this.checkerType = checkerType;
// 	}
// 
// 	public String getThreshold() {
// 		return threshold;
// 	}
// 
// 	public void setThreshold(String threshold) {
// 		this.threshold = threshold;
// 	}
// 
// 	public Map<String, Object> getConfiguration() {
// 		return configuration;
// 	}
// 
// 	public void setConfiguration(Map<String, Object> configuration) {
// 		this.configuration = configuration;
// 	}
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/config/ProxyConfiguration.java
// public class ProxyConfiguration {
// 
// 	private int errorStatus = 503;
// 
// 	@NotNull
// 	private String destinationServer;
// 
// 	private List<String> checkUrls = new ArrayList<>();
// 
// 	public int getErrorStatus() {
// 		return errorStatus;
// 	}
// 
// 	public void setErrorStatus(int status) {
// 		this.errorStatus = status;
// 	}
// 
// 	public String getDestinationServer() {
// 		return destinationServer;
// 	}
// 
// 	public void setDestinationServer(String destinationServer) {
// 		this.destinationServer = destinationServer;
// 	}
// 
// 	public List<String> getCheckUrls() {
// 		return checkUrls;
// 	}
// 
// 	public void setCheckUrls(List<String> checkUrls) {
// 		this.checkUrls = checkUrls;
// 	}
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/servlets/DiskSpaceProxyServlet.java
// public class DiskSpaceProxyServlet extends ProxyServlet {
// 
// 	public static final String PROXY_PATH_PREFIX = "/proxy";
// 
// 	public static final String DESTINATION_SERVER_PARAM = "destinationServerPrefix";
// 
// 	private static final Logger LOGGER = LoggerFactory.getLogger(DiskSpaceProxyServlet.class);
// 
// 	@Override
// 	protected String rewriteTarget(HttpServletRequest request) {
// 		final String target;
// 
// 		if (!validateDestination(request.getServerName(), request.getServerPort())) {
// 			target = null;
// 		} else {
// 			final String path = request.getRequestURI();
// 
// 			if (StringUtils.isBlank(path)) {
// 				LOGGER.debug("No path given extracted from {}", request.getRequestURI());
// 				target = null;
// 			} else if (!path.startsWith(PROXY_PATH_PREFIX)) {
// 				target = null;
// 			} else {
// 				final String shortPath = path.substring(PROXY_PATH_PREFIX.length());
// 				final StringBuilder targetBuilder = new StringBuilder(getInitParameter(DESTINATION_SERVER_PARAM))
// 						.append(shortPath);
// 				if (StringUtils.isNotBlank(request.getQueryString())) {
// 					targetBuilder.append("?").append(request.getQueryString());
// 				}
// 
// 				target = targetBuilder.toString();
// 			}
// 		}
// 
// 		return target;
// 	}
// 
// }


import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.health.HealthCheckRegistry;
import io.dropwizard.jersey.setup.JerseyEnvironment;
import io.dropwizard.jetty.setup.ServletEnvironment;
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;
import io.dropwizard.setup.Environment;
import org.junit.Before;
import org.junit.Test;
import uk.co.flax.harahachibu.config.DiskSpaceConfiguration;
import uk.co.flax.harahachibu.config.ProxyConfiguration;
import uk.co.flax.harahachibu.servlets.DiskSpaceProxyServlet;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletRegistration;
/**
 * Copyright (c) 2016 Lemur Consulting Ltd.
 * <p/>
 * 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
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * 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 uk.co.flax.harahachibu;




/**
 * Unit tests for the Hara Hachi Bu application class.
 *
 * Created by mlp on 13/04/16.
 */
public class HaraHachiBuApplicationTest {

	private final LifecycleEnvironment lifecycleEnvironment = spy(new LifecycleEnvironment());
	private final MetricRegistry metrics = new MetricRegistry();
	private final Environment environment = mock(Environment.class);
	private final ServletEnvironment servlets = mock(ServletEnvironment.class);
	private final FilterRegistration.Dynamic filterDynamic = mock(FilterRegistration.Dynamic.class);
	private final ServletRegistration.Dynamic servletDynamic = mock(ServletRegistration.Dynamic.class);
	private final JerseyEnvironment jersey = mock(JerseyEnvironment.class);
	private final HealthCheckRegistry healthChecks = mock(HealthCheckRegistry.class);
	private final HaraHachiBuApplication application = new HaraHachiBuApplication();
	private final HaraHachiBuConfiguration config = new HaraHachiBuConfiguration();
	private final ProxyConfiguration proxyConfiguration = new ProxyConfiguration();
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/config/DiskSpaceConfiguration.java
// public class DiskSpaceConfiguration {
// 
// 	public static final String ELASTICSEARCH_CHECKER = "elasticsearch";
// 	public static final String SOLR_LOCAL_CHECKER = "solr";
// 	public static final String CLUSTER_CHECKER = "cluster";
// 
// 	@NotNull
// 	private String checkerType;
// 
// 	@NotNull
// 	private String threshold;
// 
// 	@NotNull
// 	private Map<String, Object> configuration = new HashMap<>();
// 
// 
// 	public String getCheckerType() {
// 		return checkerType;
// 	}
// 
// 	public void setCheckerType(String checkerType) {
// 		this.checkerType = checkerType;
// 	}
// 
// 	public String getThreshold() {
// 		return threshold;
// 	}
// 
// 	public void setThreshold(String threshold) {
// 		this.threshold = threshold;
// 	}
// 
// 	public Map<String, Object> getConfiguration() {
// 		return configuration;
// 	}
// 
// 	public void setConfiguration(Map<String, Object> configuration) {
// 		this.configuration = configuration;
// 	}
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/config/ProxyConfiguration.java
// public class ProxyConfiguration {
// 
// 	private int errorStatus = 503;
// 
// 	@NotNull
// 	private String destinationServer;
// 
// 	private List<String> checkUrls = new ArrayList<>();
// 
// 	public int getErrorStatus() {
// 		return errorStatus;
// 	}
// 
// 	public void setErrorStatus(int status) {
// 		this.errorStatus = status;
// 	}
// 
// 	public String getDestinationServer() {
// 		return destinationServer;
// 	}
// 
// 	public void setDestinationServer(String destinationServer) {
// 		this.destinationServer = destinationServer;
// 	}
// 
// 	public List<String> getCheckUrls() {
// 		return checkUrls;
// 	}
// 
// 	public void setCheckUrls(List<String> checkUrls) {
// 		this.checkUrls = checkUrls;
// 	}
// }
// 
// Path: harahachibu/src/main/java/uk/co/flax/harahachibu/servlets/DiskSpaceProxyServlet.java
// public class DiskSpaceProxyServlet extends ProxyServlet {
// 
// 	public static final String PROXY_PATH_PREFIX = "/proxy";
// 
// 	public static final String DESTINATION_SERVER_PARAM = "destinationServerPrefix";
// 
// 	private static final Logger LOGGER = LoggerFactory.getLogger(DiskSpaceProxyServlet.class);
// 
// 	@Override
// 	protected String rewriteTarget(HttpServletRequest request) {
// 		final String target;
// 
// 		if (!validateDestination(request.getServerName(), request.getServerPort())) {
// 			target = null;
// 		} else {
// 			final String path = request.getRequestURI();
// 
// 			if (StringUtils.isBlank(path)) {
// 				LOGGER.debug("No path given extracted from {}", request.getRequestURI());
// 				target = null;
// 			} else if (!path.startsWith(PROXY_PATH_PREFIX)) {
// 				target = null;
// 			} else {
// 				final String shortPath = path.substring(PROXY_PATH_PREFIX.length());
// 				final StringBuilder targetBuilder = new StringBuilder(getInitParameter(DESTINATION_SERVER_PARAM))
// 						.append(shortPath);
// 				if (StringUtils.isNotBlank(request.getQueryString())) {
// 					targetBuilder.append("?").append(request.getQueryString());
// 				}
// 
// 				target = targetBuilder.toString();
// 			}
// 		}
// 
// 		return target;
// 	}
// 
// }


// Path: harahachibu/src/test/java/uk/co/flax/harahachibu/HaraHachiBuApplicationTest.java
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;
import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.health.HealthCheckRegistry;
import io.dropwizard.jersey.setup.JerseyEnvironment;
import io.dropwizard.jetty.setup.ServletEnvironment;
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;
import io.dropwizard.setup.Environment;
import org.junit.Before;
import org.junit.Test;
import uk.co.flax.harahachibu.config.DiskSpaceConfiguration;
import uk.co.flax.harahachibu.config.ProxyConfiguration;
import uk.co.flax.harahachibu.servlets.DiskSpaceProxyServlet;
import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletRegistration;

/**
 * Copyright (c) 2016 Lemur Consulting Ltd.
 * <p/>
 * 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
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * 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 uk.co.flax.harahachibu;




/**
 * Unit tests for the Hara Hachi Bu application class.
 *
 * Created by mlp on 13/04/16.
 */
public class HaraHachiBuApplicationTest {

	private final LifecycleEnvironment lifecycleEnvironment = spy(new LifecycleEnvironment());
	private final MetricRegistry metrics = new MetricRegistry();
	private final Environment environment = mock(Environment.class);
	private final ServletEnvironment servlets = mock(ServletEnvironment.class);
	private final FilterRegistration.Dynamic filterDynamic = mock(FilterRegistration.Dynamic.class);
	private final ServletRegistration.Dynamic servletDynamic = mock(ServletRegistration.Dynamic.class);
	private final JerseyEnvironment jersey = mock(JerseyEnvironment.class);
	private final HealthCheckRegistry healthChecks = mock(HealthCheckRegistry.class);
	private final HaraHachiBuApplication application = new HaraHachiBuApplication();
	private final HaraHachiBuConfiguration config = new HaraHachiBuConfiguration();
	private final ProxyConfiguration proxyConfiguration = new ProxyConfiguration();
	private final DiskSpaceConfiguration diskSpaceConfiguration = new DiskSpaceConfiguration();