use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class RealmTest method assignedServiceToRealm.
@Parameters({ "realm", "service-name", "attribute-value" })
@Test(groups = { "cli-realm", "add-svc-realm" })
public void assignedServiceToRealm(String realm, String serviceName, String attributeValue) throws CLIException, IdRepoException, SSOException {
String[] param = { realm, serviceName, attributeValue };
entering("assignedServiceToRealm", param);
String[] args = { "add-svc-realm", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, serviceName, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES, attributeValue };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
AMIdentityRepository amir = new AMIdentityRepository(getAdminSSOToken(), realm);
AMIdentity ai = amir.getRealmIdentity();
ai.getServiceAttributes(serviceName);
exiting("assignedServiceToRealm");
}
use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class RealmTest method createRealm.
@Parameters({ "realm" })
@BeforeTest(groups = { "cli-realm", "create-realm" })
public void createRealm(String realm) throws CLIException, SMSException {
String[] param = { realm };
entering("createRealm", param);
String[] args = { "create-realm", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
String parentRealm = RealmUtils.getParentRealm(realm);
String realmName = RealmUtils.getChildRealm(realm);
OrganizationConfigManager ocm = new OrganizationConfigManager(getAdminSSOToken(), parentRealm);
Set names = ocm.getSubOrganizationNames(realmName, true);
assert (names.size() == 1);
String name = (String) names.iterator().next();
assert name.equals(realmName);
exiting("createRealm");
}
use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class RealmTest method setServiceAttribute.
@Parameters({ "realm", "service-name", "modify-attribute-value" })
@Test(groups = { "cli-realm", "services", "set-svc-attrs" }, dependsOnMethods = { "assignedServiceToRealm" })
public void setServiceAttribute(String realm, String serviceName, String attributeValue) throws CLIException, IdRepoException, SSOException {
String[] param = { realm };
entering("setServiceAttribute", param);
String[] args = { "set-svc-attrs", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, serviceName, CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES, attributeValue };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
AMIdentityRepository amir = new AMIdentityRepository(getAdminSSOToken(), realm);
AMIdentity ai = amir.getRealmIdentity();
Map map = ai.getServiceAttributes(serviceName);
Map<String, Set<String>> orig = CollectionUtils.parseStringToMap(attributeValue);
String key = orig.keySet().iterator().next();
String value = orig.get(key).iterator().next();
Set resultSet = (Set) map.get(key);
String result = (String) resultSet.iterator().next();
assert (result.equals(value));
exiting("setServiceAttribute");
}
use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class IdRepoTest method deleteIdentity.
@Parameters({ "realm", "uid" })
@AfterTest(groups = { "cli-idrepo", "delete-identities" })
public void deleteIdentity(String realm, String uid) throws CLIException, IdRepoException, SSOException {
String[] param = { realm, uid };
entering("deleteRealm", param);
String[] args = { "delete-identities", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, realm, CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE, "User", CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAMES, uid };
SSOToken adminSSOToken = getAdminSSOToken();
CLIRequest req = new CLIRequest(null, args, adminSSOToken);
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
AMIdentityRepository amir = new AMIdentityRepository(adminSSOToken, realm);
IdSearchControl isCtl = new IdSearchControl();
IdSearchResults isr = amir.searchIdentities(IdType.USER, uid, isCtl);
Set results = isr.getSearchResults();
assert (results.isEmpty());
exiting("deleteIdentities");
}
use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class IdRepoTest method createIdentity.
@Parameters({ "realm", "uid", "attrs" })
@Test(groups = { "cli-idrepo", "create-identity" })
public void createIdentity(String realm, String uid, String attrs) throws CLIException {
String[] param = { realm, uid, attrs };
entering("createIdentity", param);
List<String> arguments = new ArrayList<String>();
arguments.add("create-identity");
arguments.add(CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME);
arguments.add(realm);
arguments.add(CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_TYPE);
arguments.add("User");
arguments.add(CLIConstants.PREFIX_ARGUMENT_LONG + IdentityCommand.ARGUMENT_ID_NAME);
arguments.add(uid);
arguments.add(CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES);
StringTokenizer st = new StringTokenizer(attrs);
while (st.hasMoreTokens()) {
arguments.add(st.nextToken());
}
String[] args = new String[arguments.size()];
int i = 0;
for (String s : arguments) {
args[i++] = s;
}
SSOToken adminSSOToken = getAdminSSOToken();
CLIRequest req = new CLIRequest(null, args, adminSSOToken);
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
AMIdentity amid = new AMIdentity(adminSSOToken, uid, IdType.USER, realm, null);
assert (amid != null);
exiting("createIdentity");
}
Aggregations