@Test public void testNotDefinesLocation() { List<String> paths = ImmutableList.of( PathUtils.ROOT_PATH, NodeTypeConstants.NODE_TYPES_PATH, "/content", "" ); for (String path : paths) { TreeLocation location = Mockito.mock(TreeLocation.class); when(location.getPath()).thenReturn(path); assertFalse(path, ctx.definesLocation(location)); } }
@Override public boolean definesLocation(@NotNull TreeLocation location) { Tree tree = location.getTree(); if (tree != null && location.exists()) { PropertyState p = location.getProperty(); return (p == null) ? definesTree(tree) : definesProperty(tree, p); } else { String path = location.getPath(); String name = Text.getName(path); return USER_PROPERTY_NAMES.contains(name) || GROUP_PROPERTY_NAMES.contains(name) || path.contains(REP_MEMBERS_LIST) || path.contains(REP_MEMBERS) || path.contains(REP_PWD); } }
UserContext implements Context, UserConstants { @Override public boolean definesLocation(@NotNull TreeLocation location) { Tree tree = location.getTree(); if (tree != null && location.exists()) { PropertyState p = location.getProperty(); return (p == null) ? definesTree(tree) : definesProperty(tree, p); } else { String path = location.getPath(); String name = Text.getName(path); return USER_PROPERTY_NAMES.contains(name) || GROUP_PROPERTY_NAMES.contains(name) || path.contains(REP_MEMBERS_LIST) || path.contains(REP_MEMBERS) || path.contains(REP_PWD); } } }
UserContext implements Context, UserConstants { @Override public boolean definesLocation(@NotNull TreeLocation location) { Tree tree = location.getTree(); if (tree != null && location.exists()) { PropertyState p = location.getProperty(); return (p == null) ? definesTree(tree) : definesProperty(tree, p); } else { String path = location.getPath(); String name = Text.getName(path); return USER_PROPERTY_NAMES.contains(name) || GROUP_PROPERTY_NAMES.contains(name) || path.contains(REP_MEMBERS_LIST) || path.contains(REP_MEMBERS) || path.contains(REP_PWD); } } private  UserContext(); }
UserContext implements Context, UserConstants { @Override public boolean definesLocation(@NotNull TreeLocation location) { Tree tree = location.getTree(); if (tree != null && location.exists()) { PropertyState p = location.getProperty(); return (p == null) ? definesTree(tree) : definesProperty(tree, p); } else { String path = location.getPath(); String name = Text.getName(path); return USER_PROPERTY_NAMES.contains(name) || GROUP_PROPERTY_NAMES.contains(name) || path.contains(REP_MEMBERS_LIST) || path.contains(REP_MEMBERS) || path.contains(REP_PWD); } } private  UserContext(); @Override boolean definesProperty(@NotNull Tree parent, @NotNull PropertyState property); @Override boolean definesContextRoot(@NotNull Tree tree); @Override boolean definesTree(@NotNull Tree tree); @Override boolean definesLocation(@NotNull TreeLocation location); @Override boolean definesInternal(@NotNull Tree tree); }
UserContext implements Context, UserConstants { @Override public boolean definesLocation(@NotNull TreeLocation location) { Tree tree = location.getTree(); if (tree != null && location.exists()) { PropertyState p = location.getProperty(); return (p == null) ? definesTree(tree) : definesProperty(tree, p); } else { String path = location.getPath(); String name = Text.getName(path); return USER_PROPERTY_NAMES.contains(name) || GROUP_PROPERTY_NAMES.contains(name) || path.contains(REP_MEMBERS_LIST) || path.contains(REP_MEMBERS) || path.contains(REP_PWD); } } private  UserContext(); @Override boolean definesProperty(@NotNull Tree parent, @NotNull PropertyState property); @Override boolean definesContextRoot(@NotNull Tree tree); @Override boolean definesTree(@NotNull Tree tree); @Override boolean definesLocation(@NotNull TreeLocation location); @Override boolean definesInternal(@NotNull Tree tree);  }