// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
// 	
// 	private Integer errorCode;
// 	private String errorMessage;
// 
// 	@JsonProperty("records")
// 	private Record[] resultData;
// 	
// 	public Integer getErrorCode() {
// 		return errorCode;
// 	}
// 	
// 	public void setErrorCode(Integer errorCode) {
// 		this.errorCode = errorCode;
// 	}
// 	
// 	public String getErrorMessage() {
// 		return errorMessage;
// 	}
// 	
// 	public void setErrorMessage(String errorMessage) {
// 		this.errorMessage = errorMessage;
// 	}
// 	
// 	public Record[] getResultData() {
// 		return resultData;
// 	}
// 
// 	public void setResultData(Record[] resultData) {
// 		this.resultData = resultData;
// 	}
// 
// }
// 
// Path: moneta-contract-tests/src/test/java/org/moneta/utils/RestTestingUtils.java
// public class RestTestingUtils {
// 	
// 	public static HttpResponse simpleRESTGet(String requestUri) {
// 		Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// 		CloseableHttpClient httpclient = HttpClients.createDefault();
// 		HttpGet httpGet = new HttpGet(requestUri);
// 		try {
// 			return httpclient.execute(httpGet);
// 		} catch (Exception e) {
// 			throw new ContextedRuntimeException(e)
// 				.addContextValue("requestUri", requestUri);
// 		} 
// 	}
// 	
// //	public static HttpResponse simpleRESTPost(String requestUri, String postData) {
// //		Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// //		CloseableHttpClient httpclient = HttpClients.createDefault();
// //		HttpPost httpPost = new HttpPost(requestUri);
// //		httpPost.set
// //		try {
// //			return httpclient.execute(httpPost);
// //		} catch (Exception e) {
// //			throw new ContextedRuntimeException(e)
// //				.addContextValue("requestUri", requestUri);
// //		} 
// //	}
// 
// }


import net.admin4j.deps.commons.lang3.Validate;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.RestTestingUtils;
import com.fasterxml.jackson.databind.ObjectMapper;

		this.testForOkResult(response, 1, 5);
	}
	
	@Test
	public void testEnvironmentBasic() throws Exception {
		HttpResponse response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topic/Environment");
		this.testForOkResult(response, 92, 13);
		
		response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topic/Environments");
		this.testForOkResult(response, 92, 13);
		
		response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topic/Environments?startRow=90");
		this.testForOkResult(response, 3, 13);
		
		response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topic/Environments?maxRows=10");
		this.testForOkResult(response, 10, 13);
	}
	
	@Test
	public void testHealthcheck() throws Exception {
		String checkUrl = this.serviceUrlPrefix+this.getHealthCheckEndpoint();
		System.out.println("Healthcheck url: " +checkUrl);
		HttpResponse response = RestTestingUtils.simpleRESTGet(checkUrl);
		Assert.assertTrue(response.getStatusLine().getStatusCode() == 200);
		
		System.out.println("Healthcheck output: " +IOUtils.toString(response.getEntity().getContent()));
	}
	
	@Test
	public void testMetrics() throws Exception {

// Path: moneta-core/src/main/java/org/moneta/types/search/SearchResult.java
// public class SearchResult extends BaseType {
// 	
// 	private Integer errorCode;
// 	private String errorMessage;
// 
// 	@JsonProperty("records")
// 	private Record[] resultData;
// 	
// 	public Integer getErrorCode() {
// 		return errorCode;
// 	}
// 	
// 	public void setErrorCode(Integer errorCode) {
// 		this.errorCode = errorCode;
// 	}
// 	
// 	public String getErrorMessage() {
// 		return errorMessage;
// 	}
// 	
// 	public void setErrorMessage(String errorMessage) {
// 		this.errorMessage = errorMessage;
// 	}
// 	
// 	public Record[] getResultData() {
// 		return resultData;
// 	}
// 
// 	public void setResultData(Record[] resultData) {
// 		this.resultData = resultData;
// 	}
// 
// }
// 
// Path: moneta-contract-tests/src/test/java/org/moneta/utils/RestTestingUtils.java
// public class RestTestingUtils {
// 	
// 	public static HttpResponse simpleRESTGet(String requestUri) {
// 		Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// 		CloseableHttpClient httpclient = HttpClients.createDefault();
// 		HttpGet httpGet = new HttpGet(requestUri);
// 		try {
// 			return httpclient.execute(httpGet);
// 		} catch (Exception e) {
// 			throw new ContextedRuntimeException(e)
// 				.addContextValue("requestUri", requestUri);
// 		} 
// 	}
// 	
// //	public static HttpResponse simpleRESTPost(String requestUri, String postData) {
// //		Validate.notEmpty(requestUri, "Null or blank requestUri not allowed.");
// //		CloseableHttpClient httpclient = HttpClients.createDefault();
// //		HttpPost httpPost = new HttpPost(requestUri);
// //		httpPost.set
// //		try {
// //			return httpclient.execute(httpPost);
// //		} catch (Exception e) {
// //			throw new ContextedRuntimeException(e)
// //				.addContextValue("requestUri", requestUri);
// //		} 
// //	}
// 
// }


// Path: moneta-contract-tests/src/test/java/org/moneta/ContractTestSuite.java
import net.admin4j.deps.commons.lang3.Validate;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.junit.Assert;
import org.junit.Test;
import org.moneta.types.search.SearchResult;
import org.moneta.utils.RestTestingUtils;
import com.fasterxml.jackson.databind.ObjectMapper;

		this.testForOkResult(response, 1, 5);
	}
	
	@Test
	public void testEnvironmentBasic() throws Exception {
		HttpResponse response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topic/Environment");
		this.testForOkResult(response, 92, 13);
		
		response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topic/Environments");
		this.testForOkResult(response, 92, 13);
		
		response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topic/Environments?startRow=90");
		this.testForOkResult(response, 3, 13);
		
		response = RestTestingUtils.simpleRESTGet(this.appUrlPrefix+"topic/Environments?maxRows=10");
		this.testForOkResult(response, 10, 13);
	}
	
	@Test
	public void testHealthcheck() throws Exception {
		String checkUrl = this.serviceUrlPrefix+this.getHealthCheckEndpoint();
		System.out.println("Healthcheck url: " +checkUrl);
		HttpResponse response = RestTestingUtils.simpleRESTGet(checkUrl);
		Assert.assertTrue(response.getStatusLine().getStatusCode() == 200);
		
		System.out.println("Healthcheck output: " +IOUtils.toString(response.getEntity().getContent()));
	}
	
	@Test
	public void testMetrics() throws Exception {

		String checkUrl = this.serviceUrlPrefix+this.getMetricsEndpoint();
