X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fcommons%2Ffilter-valve%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Ffiltervalve%2Fcors%2Fmodel%2FUrlMatcherTest.java;fp=opendaylight%2Fcommons%2Ffilter-valve%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Ffiltervalve%2Fcors%2Fmodel%2FUrlMatcherTest.java;h=0000000000000000000000000000000000000000;hp=6276deab78c8183a563e591af1e85b541d2974dd;hb=49568a573fe8d44e67518300b34426331abb258f;hpb=f984aadefd56f48aec345b8b7cc7ddf27b794f56 diff --git a/opendaylight/commons/filter-valve/src/test/java/org/opendaylight/controller/filtervalve/cors/model/UrlMatcherTest.java b/opendaylight/commons/filter-valve/src/test/java/org/opendaylight/controller/filtervalve/cors/model/UrlMatcherTest.java deleted file mode 100644 index 6276deab78..0000000000 --- a/opendaylight/commons/filter-valve/src/test/java/org/opendaylight/controller/filtervalve/cors/model/UrlMatcherTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.filtervalve.cors.model; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; - -import java.util.LinkedHashMap; -import org.junit.Test; - -public class UrlMatcherTest { - UrlMatcher urlMatcher; - - @Test - public void test() throws Exception { - final String defaultFilter = "default"; - final String exactMatchFilter = "someFilter"; - final String jspFilter = "jspFilter"; - final String exactMatch = "/somePath"; - final String prefixFilter = "prefixFilter"; - LinkedHashMap patternMap = new LinkedHashMap<>(); - patternMap.put(exactMatch, exactMatchFilter); - patternMap.put("/*", defaultFilter); - patternMap.put("*.jsp", jspFilter); - patternMap.put("/foo/*", prefixFilter); - urlMatcher = new UrlMatcher<>(patternMap); - assertMatches("/abc", defaultFilter); - assertMatches(exactMatch, exactMatchFilter, defaultFilter); - assertMatches("/some.jsp", defaultFilter, jspFilter); - assertMatches("/foo/bar", defaultFilter, prefixFilter); - assertMatches("/foo/bar.jsp", defaultFilter, jspFilter, prefixFilter); - } - - public void assertMatches(String testedPath, String... filters) { - assertEquals(asList(filters), urlMatcher.findMatchingFilters(testedPath)); - } - -}