// Path: src/main/java/org/mockenize/model/MockBean.java
// @Data
// public class MockBean implements Cacheable {
// 
// 	private static final String UNDERLINE = "_";
// 
// 	private static final String SLASH = "/";
// 
// 	@NotNull
// 	private String key;
// 
// 	@NotNull
// 	private String path;
// 
// 	@NotNull
// 	private String method;
// 
// 	private Map<String, String> headers = Collections.emptyMap();
// 
// 	private JsonNode body;
// 
// 	@NotNull
// 	private Integer status = 200;
// 
// 	private int timeout = 0;
// 
// 	private int minTimeout = 0;
// 
// 	private int maxTimeout = 0;
// 
// 	private String scriptName;
// 
// 	@Override
// 	public String getKey() {
// 		return method.concat(path.replaceAll(SLASH, UNDERLINE));
// 	}
// 
// 	public void setPath(String path) {
// 		if (path != null && !path.startsWith(SLASH)) {
// 			this.path = SLASH + path;
// 		} else {
// 			this.path = path;
// 		}
// 	}
// 
// }
// 
// Path: src/main/java/org/mockenize/vendor/hazelcast/predicate/PathPredicate.java
// public class PathPredicate implements Predicate<String, Object> {
// 
// 	private static final long serialVersionUID = 4605050326503577349L;
// 	private final String value;
// 
//     public PathPredicate(String value) {
//         this.value = value.replaceAll("/", "_");
//     }
// 
//     public PathPredicate(String... segments) {
//         StringBuilder stringBuilder = new StringBuilder();
//         for (String segment : segments) {
//             stringBuilder.append(segment);
//         }
//         this.value = stringBuilder.toString().replaceAll("/", "_");
//     }
// 
//     @Override
//     public boolean apply(Map.Entry<String, Object> mapEntry) {
//         return value.matches(mapEntry.getKey().replace("*", "[^/]+"));
//     }
// }


import java.util.Collection;
import java.util.Iterator;
import org.mockenize.model.MockBean;
import org.mockenize.vendor.hazelcast.predicate.PathPredicate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.hazelcast.core.HazelcastInstance;
package org.mockenize.repository;




@Repository
public class MockRepository extends AbstractRepository<MockBean> {

	public static final String MAP_KEY = "mocks";

	@Autowired
	public MockRepository(HazelcastInstance hazelcastInstance) {
		super(hazelcastInstance, MAP_KEY);
	}

	public MockBean findByMethodAndPath(String method, String path) {
// Path: src/main/java/org/mockenize/model/MockBean.java
// @Data
// public class MockBean implements Cacheable {
// 
// 	private static final String UNDERLINE = "_";
// 
// 	private static final String SLASH = "/";
// 
// 	@NotNull
// 	private String key;
// 
// 	@NotNull
// 	private String path;
// 
// 	@NotNull
// 	private String method;
// 
// 	private Map<String, String> headers = Collections.emptyMap();
// 
// 	private JsonNode body;
// 
// 	@NotNull
// 	private Integer status = 200;
// 
// 	private int timeout = 0;
// 
// 	private int minTimeout = 0;
// 
// 	private int maxTimeout = 0;
// 
// 	private String scriptName;
// 
// 	@Override
// 	public String getKey() {
// 		return method.concat(path.replaceAll(SLASH, UNDERLINE));
// 	}
// 
// 	public void setPath(String path) {
// 		if (path != null && !path.startsWith(SLASH)) {
// 			this.path = SLASH + path;
// 		} else {
// 			this.path = path;
// 		}
// 	}
// 
// }
// 
// Path: src/main/java/org/mockenize/vendor/hazelcast/predicate/PathPredicate.java
// public class PathPredicate implements Predicate<String, Object> {
// 
// 	private static final long serialVersionUID = 4605050326503577349L;
// 	private final String value;
// 
//     public PathPredicate(String value) {
//         this.value = value.replaceAll("/", "_");
//     }
// 
//     public PathPredicate(String... segments) {
//         StringBuilder stringBuilder = new StringBuilder();
//         for (String segment : segments) {
//             stringBuilder.append(segment);
//         }
//         this.value = stringBuilder.toString().replaceAll("/", "_");
//     }
// 
//     @Override
//     public boolean apply(Map.Entry<String, Object> mapEntry) {
//         return value.matches(mapEntry.getKey().replace("*", "[^/]+"));
//     }
// }


// Path: src/main/java/org/mockenize/repository/MockRepository.java
import java.util.Collection;
import java.util.Iterator;
import org.mockenize.model.MockBean;
import org.mockenize.vendor.hazelcast.predicate.PathPredicate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.hazelcast.core.HazelcastInstance;

package org.mockenize.repository;




@Repository
public class MockRepository extends AbstractRepository<MockBean> {

	public static final String MAP_KEY = "mocks";

	@Autowired
	public MockRepository(HazelcastInstance hazelcastInstance) {
		super(hazelcastInstance, MAP_KEY);
	}

	public MockBean findByMethodAndPath(String method, String path) {
		Collection<MockBean> values = map.values(new PathPredicate(method, path));