@Test public void test() { Attribute result = RolesCommand.getRolesAttributeFor("root", getConnection()); assertNotNull(result); assertTrue(result.getValue().size() == 0); assertEquals(NativeAttribute.ROLES.getName(), result.getName()); }
public static Attribute getRolesAttributeFor(String username, SolarisConnection conn) { final String out = conn.executeCommand(conn.buildCommand(true, "roles", username)); List<String> roles = null; if (!out.endsWith("No such user") && !out.endsWith("No roles") && !out.endsWith("not found")) { roles = Arrays.asList(out.split(",")); } else if (out.endsWith("No roles")) { roles = Collections.emptyList(); } else { throw new RuntimeException("'roles' command for user '" + username + "' failed. Buffer: <" + out + ">"); } return AttributeBuilder.build(NativeAttribute.ROLES.getName(), roles); }
RolesCommand { public static Attribute getRolesAttributeFor(String username, SolarisConnection conn) { final String out = conn.executeCommand(conn.buildCommand(true, "roles", username)); List<String> roles = null; if (!out.endsWith("No such user") && !out.endsWith("No roles") && !out.endsWith("not found")) { roles = Arrays.asList(out.split(",")); } else if (out.endsWith("No roles")) { roles = Collections.emptyList(); } else { throw new RuntimeException("'roles' command for user '" + username + "' failed. Buffer: <" + out + ">"); } return AttributeBuilder.build(NativeAttribute.ROLES.getName(), roles); } }
RolesCommand { public static Attribute getRolesAttributeFor(String username, SolarisConnection conn) { final String out = conn.executeCommand(conn.buildCommand(true, "roles", username)); List<String> roles = null; if (!out.endsWith("No such user") && !out.endsWith("No roles") && !out.endsWith("not found")) { roles = Arrays.asList(out.split(",")); } else if (out.endsWith("No roles")) { roles = Collections.emptyList(); } else { throw new RuntimeException("'roles' command for user '" + username + "' failed. Buffer: <" + out + ">"); } return AttributeBuilder.build(NativeAttribute.ROLES.getName(), roles); } private  RolesCommand(); }
RolesCommand { public static Attribute getRolesAttributeFor(String username, SolarisConnection conn) { final String out = conn.executeCommand(conn.buildCommand(true, "roles", username)); List<String> roles = null; if (!out.endsWith("No such user") && !out.endsWith("No roles") && !out.endsWith("not found")) { roles = Arrays.asList(out.split(",")); } else if (out.endsWith("No roles")) { roles = Collections.emptyList(); } else { throw new RuntimeException("'roles' command for user '" + username + "' failed. Buffer: <" + out + ">"); } return AttributeBuilder.build(NativeAttribute.ROLES.getName(), roles); } private  RolesCommand(); static Attribute getRolesAttributeFor(String username, SolarisConnection conn); }
RolesCommand { public static Attribute getRolesAttributeFor(String username, SolarisConnection conn) { final String out = conn.executeCommand(conn.buildCommand(true, "roles", username)); List<String> roles = null; if (!out.endsWith("No such user") && !out.endsWith("No roles") && !out.endsWith("not found")) { roles = Arrays.asList(out.split(",")); } else if (out.endsWith("No roles")) { roles = Collections.emptyList(); } else { throw new RuntimeException("'roles' command for user '" + username + "' failed. Buffer: <" + out + ">"); } return AttributeBuilder.build(NativeAttribute.ROLES.getName(), roles); } private  RolesCommand(); static Attribute getRolesAttributeFor(String username, SolarisConnection conn);  }