@Test public void testResolveMissingRole() { _thrown.expect(NoSuchElementException.class); new RoleNameNodeSpecifier("norole", "dim1").resolve(_ctxt); }
@Override public Set<String> resolve(SpecifierContext ctxt) { NodeRoleDimension nodeRoleDimension = ctxt.getNodeRoleDimension(_roleDimension) .orElseThrow( () -> new NoSuchElementException( "Role dimension '" + _roleDimension + "' not found")); SortedMap<String, SortedSet<String>> roleNodesMap = nodeRoleDimension.createRoleNodesMap(ctxt.getConfigs().keySet()); roleNodesMap.keySet().stream() .filter(r -> r.equalsIgnoreCase(_roleName)) .findAny() .orElseThrow( () -> new NoSuchElementException( "Role name '" + _roleName + "' not found in dimension '" + _roleDimension + "'")); return roleNodesMap.get(_roleName); }
RoleNameNodeSpecifier implements NodeSpecifier { @Override public Set<String> resolve(SpecifierContext ctxt) { NodeRoleDimension nodeRoleDimension = ctxt.getNodeRoleDimension(_roleDimension) .orElseThrow( () -> new NoSuchElementException( "Role dimension '" + _roleDimension + "' not found")); SortedMap<String, SortedSet<String>> roleNodesMap = nodeRoleDimension.createRoleNodesMap(ctxt.getConfigs().keySet()); roleNodesMap.keySet().stream() .filter(r -> r.equalsIgnoreCase(_roleName)) .findAny() .orElseThrow( () -> new NoSuchElementException( "Role name '" + _roleName + "' not found in dimension '" + _roleDimension + "'")); return roleNodesMap.get(_roleName); } }
RoleNameNodeSpecifier implements NodeSpecifier { @Override public Set<String> resolve(SpecifierContext ctxt) { NodeRoleDimension nodeRoleDimension = ctxt.getNodeRoleDimension(_roleDimension) .orElseThrow( () -> new NoSuchElementException( "Role dimension '" + _roleDimension + "' not found")); SortedMap<String, SortedSet<String>> roleNodesMap = nodeRoleDimension.createRoleNodesMap(ctxt.getConfigs().keySet()); roleNodesMap.keySet().stream() .filter(r -> r.equalsIgnoreCase(_roleName)) .findAny() .orElseThrow( () -> new NoSuchElementException( "Role name '" + _roleName + "' not found in dimension '" + _roleDimension + "'")); return roleNodesMap.get(_roleName); } RoleNameNodeSpecifier(String roleName, String roleDimension); }
RoleNameNodeSpecifier implements NodeSpecifier { @Override public Set<String> resolve(SpecifierContext ctxt) { NodeRoleDimension nodeRoleDimension = ctxt.getNodeRoleDimension(_roleDimension) .orElseThrow( () -> new NoSuchElementException( "Role dimension '" + _roleDimension + "' not found")); SortedMap<String, SortedSet<String>> roleNodesMap = nodeRoleDimension.createRoleNodesMap(ctxt.getConfigs().keySet()); roleNodesMap.keySet().stream() .filter(r -> r.equalsIgnoreCase(_roleName)) .findAny() .orElseThrow( () -> new NoSuchElementException( "Role name '" + _roleName + "' not found in dimension '" + _roleDimension + "'")); return roleNodesMap.get(_roleName); } RoleNameNodeSpecifier(String roleName, String roleDimension); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<String> resolve(SpecifierContext ctxt); }
RoleNameNodeSpecifier implements NodeSpecifier { @Override public Set<String> resolve(SpecifierContext ctxt) { NodeRoleDimension nodeRoleDimension = ctxt.getNodeRoleDimension(_roleDimension) .orElseThrow( () -> new NoSuchElementException( "Role dimension '" + _roleDimension + "' not found")); SortedMap<String, SortedSet<String>> roleNodesMap = nodeRoleDimension.createRoleNodesMap(ctxt.getConfigs().keySet()); roleNodesMap.keySet().stream() .filter(r -> r.equalsIgnoreCase(_roleName)) .findAny() .orElseThrow( () -> new NoSuchElementException( "Role name '" + _roleName + "' not found in dimension '" + _roleDimension + "'")); return roleNodesMap.get(_roleName); } RoleNameNodeSpecifier(String roleName, String roleDimension); @Override boolean equals(Object o); @Override int hashCode(); @Override Set<String> resolve(SpecifierContext ctxt);  }