Search in sources :

Example 1 with ApiPathResolverImpl

use of io.gravitee.gateway.handlers.api.path.impl.ApiPathResolverImpl in project gravitee-gateway by gravitee-io.

the class ApiPathResolverTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    final Map<String, Path> paths = new HashMap<>();
    paths.putAll(new HashMap<String, Path>() {

        {
            Path p1 = new Path();
            p1.setPath("/");
            put(p1.getPath(), p1);
            Path p2 = new Path();
            p2.setPath("/products");
            put(p2.getPath(), p2);
            Path p3 = new Path();
            p3.setPath("/stores");
            put(p3.getPath(), p3);
            Path p4 = new Path();
            p4.setPath("/stores/:storeId");
            put(p4.getPath(), p4);
            Path p5 = new Path();
            p5.setPath("/[0-9,;]+");
            put(p5.getPath(), p5);
            Path p6 = new Path();
            p6.setPath("/Stores/:storeId");
            put(p6.getPath(), p6);
        }
    });
    // API 1
    Proxy proxy = new Proxy();
    proxy.setContextPath("/");
    when(api.getProxy()).thenReturn(proxy);
    when(api.getPaths()).thenReturn(paths);
    pathResolver = new ApiPathResolverImpl(api);
    // API 2
    Proxy proxy2 = new Proxy();
    proxy2.setContextPath("/v1/products");
    when(api2.getProxy()).thenReturn(proxy2);
    when(api2.getPaths()).thenReturn(paths);
    pathResolver2 = new ApiPathResolverImpl(api2);
}
Also used : Path(io.gravitee.definition.model.Path) Proxy(io.gravitee.definition.model.Proxy) HashMap(java.util.HashMap) ApiPathResolverImpl(io.gravitee.gateway.handlers.api.path.impl.ApiPathResolverImpl) Before(org.junit.Before)

Aggregations

Path (io.gravitee.definition.model.Path)1 Proxy (io.gravitee.definition.model.Proxy)1 ApiPathResolverImpl (io.gravitee.gateway.handlers.api.path.impl.ApiPathResolverImpl)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1