@Override public LocationSpecifier buildLocationSpecifier(Pattern pattern) { return new NameRegexInterfaceLocationSpecifier(pattern); } }
@Test public void testNameRegexInterfaceLinkLocationSpecifierFactory() { assertThat( new NameRegexInterfaceLinkLocationSpecifierFactory().getName(), equalTo(NameRegexInterfaceLinkLocationSpecifierFactory.NAME)); assertThat( new NameRegexInterfaceLocationSpecifierFactory().buildLocationSpecifier(PATTERN_SRC), equalTo(new NameRegexInterfaceLocationSpecifier(PATTERN))); }
public static LocationSpecifier from(@Nonnull InterfacesSpecifier ingressInterfaces) { switch (ingressInterfaces.getType()) { case DESC: return new DescriptionRegexInterfaceLocationSpecifier(ingressInterfaces.getRegex()); case NAME: return new NameRegexInterfaceLocationSpecifier(ingressInterfaces.getRegex()); case VRF: return new VrfNameRegexInterfaceLocationSpecifier(ingressInterfaces.getRegex()); default: throw new BatfishException( "Unexcepted InterfacesSpecifier type: " + ingressInterfaces.getType()); } }
@Test public void testNameRegexInterfaceLocationSpecifierFactory() { assertThat( LocationSpecifierFactory.load(new NameRegexInterfaceLocationSpecifierFactory().getName()), instanceOf(NameRegexInterfaceLocationSpecifierFactory.class)); assertThat( new NameRegexInterfaceLocationSpecifierFactory().getName(), equalTo(NameRegexInterfaceLocationSpecifierFactory.NAME)); assertThat( new NameRegexInterfaceLocationSpecifierFactory().buildLocationSpecifier(PATTERN_SRC), equalTo(new NameRegexInterfaceLocationSpecifier(PATTERN))); }