DMRLocationResolver implements LocationResolver<DMRNodeLocation> { private static boolean matches(int length, PathAddress pattern, PathAddress address) { for (int i = 0; i < length; i++) { PathElement otherElem = address.getElement(i); Property prop = new Property(otherElem.getKey(), new ModelNode(otherElem.getValue())); if (!pattern.getElement(i).matches(prop)) { return false; } } return true; }  @Override DMRNodeLocation buildLocation(String path); @Override String findWildcardMatch(DMRNodeLocation multiTargetLocation, DMRNodeLocation singleLocation); @Override boolean isMultiTarget(DMRNodeLocation location); @Override DMRNodeLocation absolutize(DMRNodeLocation base, DMRNodeLocation location); @Override boolean isParent(DMRNodeLocation parent, DMRNodeLocation child); @Override boolean matches(DMRNodeLocation query, DMRNodeLocation location); @Override String applyTemplate(String nameTemplate, DMRNodeLocation location, String endpointName);  }
@Test public void testMatches() { DMRLocationResolver resolver = new DMRLocationResolver(); Assert.assertTrue(resolver.matches(DMRNodeLocation.of("/one=*/two=2"), DMRNodeLocation.of("/one=1/two=2"))); Assert.assertTrue(resolver.matches(DMRNodeLocation.of("/one=1/two=*"), DMRNodeLocation.of("/one=1/two=2"))); Assert.assertTrue(resolver.matches(DMRNodeLocation.of("/one=*/two=*"), DMRNodeLocation.of("/one=1/two=2"))); Assert.assertFalse(resolver.matches(DMRNodeLocation.of("/one=1/two=XX"), DMRNodeLocation.of("/one=1/two=2"))); }