use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class SchemaTest method setAttributeAny.
@Parameters({ "subschema" })
@Test(groups = { "schema", "set-attr-any", "attribute-schema-ops", "subschema" }, dependsOnMethods = { "addAttributeSchema" })
public void setAttributeAny(String subschema) throws CLIException, SMSException, SSOException {
Object[] params = { subschema };
entering("setAttributeAny", params);
String[] args = (subschema.length() == 0) ? new String[9] : new String[11];
args[0] = "set-attr-any";
args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME;
args[2] = TEST_SERVICE;
args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SCHEMA_TYPE;
args[4] = "global";
args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_SCHEMA;
args[6] = "mock-add";
args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + ModifyAttributeSchemaAny.ARGUMENT_ANY;
args[8] = "admin";
if (subschema.length() > 0) {
args[9] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUBSCHEMA_NAME;
args[10] = subschema;
}
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
try {
cmdManager.serviceRequestQueue();
ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, getAdminSSOToken());
ServiceSchema serviceSchema = mgr.getGlobalSchema();
if (subschema.length() > 0) {
serviceSchema = serviceSchema.getSubSchema(subschema);
}
AttributeSchema as = serviceSchema.getAttributeSchema("mock-add");
assert (as.getAny().equals("admin"));
exiting("setAttributeAny");
} catch (CLIException e) {
this.log(Level.SEVERE, "setAttributeAny", e.getMessage());
throw e;
} catch (SMSException e) {
this.log(Level.SEVERE, "setAttributeAny", e.getMessage());
throw e;
} catch (SSOException e) {
this.log(Level.SEVERE, "setAttributeAny", e.getMessage());
throw e;
}
}
use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class SchemaTest method setSubConfiguration.
@Test(groups = { "schema", "set-sub-cfg" }, dependsOnMethods = { "createSubConfiguration" })
public void setSubConfiguration() throws CLIException, SMSException, SSOException {
entering("setSubConfiguration", null);
String[] args = { "set-sub-cfg", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME, TEST_SERVICE, CLIConstants.PREFIX_ARGUMENT_LONG + ModifySubConfiguration.ARGUMENT_OPERATION, "set", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUB_CONFIGURATION_NAME, "/testConfig", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.ATTRIBUTE_VALUES, "attr1=2" };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
try {
cmdManager.serviceRequestQueue();
Map map = getSubConfigurationValues("/testConfig");
Set set = (Set) map.get("attr1");
String attr1 = (String) set.iterator().next();
assert attr1.equals("2");
args[4] = "delete";
req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
map = getSubConfigurationValues("/testConfig");
set = (Set) map.get("attr1");
assert (set == null) || set.isEmpty();
args[4] = "add";
args[8] = "attr3=2";
req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
map = getSubConfigurationValues("/testConfig");
set = (Set) map.get("attr3");
attr1 = (String) set.iterator().next();
assert attr1.equals("2");
exiting("setSubConfiguration");
} catch (CLIException e) {
this.log(Level.SEVERE, "setSubConfiguration", e.getMessage());
throw e;
} catch (SMSException e) {
this.log(Level.SEVERE, "setSubConfiguration", e.getMessage());
throw e;
} catch (SSOException e) {
this.log(Level.SEVERE, "setSubConfiguration", e.getMessage());
throw e;
}
}
use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class SchemaTest method deleteServices.
private void deleteServices(List<String> serviceNames) throws CLIException {
String[] args = new String[serviceNames.size() + 2];
args[0] = "delete-svc";
args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME;
int cnt = 2;
for (String xml : serviceNames) {
args[cnt++] = xml;
}
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
}
use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class SchemaTest method addAttributeSchema.
@Parameters({ "subschema" })
@Test(groups = { "schema", "add-attrs", "subschema" })
public void addAttributeSchema(String subschema) throws CLIException, SMSException, SSOException {
Object[] params = { subschema };
entering("addAttributeSchema", params);
String[] args = (subschema.length() > 0) ? new String[9] : new String[7];
args[0] = "add-attrs";
args[1] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SERVICE_NAME;
args[2] = TEST_SERVICE;
args[3] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SCHEMA_TYPE;
args[4] = "global";
args[5] = CLIConstants.PREFIX_ARGUMENT_LONG + AddAttributeSchema.ARGUMENT_SCHEMA_FILES;
args[6] = MOCK_DIR + "/addAttributeSchema.xml";
if (subschema.length() > 0) {
args[7] = CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.SUBSCHEMA_NAME;
args[8] = subschema;
}
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
try {
cmdManager.serviceRequestQueue();
ServiceSchemaManager mgr = new ServiceSchemaManager(TEST_SERVICE, getAdminSSOToken());
ServiceSchema serviceSchema = mgr.getGlobalSchema();
if (subschema.length() > 0) {
serviceSchema = serviceSchema.getSubSchema(subschema);
}
AttributeSchema as = serviceSchema.getAttributeSchema("mock-add");
assert (as != null);
exiting("addAttributeSchema");
} catch (CLIException e) {
this.log(Level.SEVERE, "addAttributeSchema", e.getMessage(), params);
throw e;
} catch (SMSException e) {
this.log(Level.SEVERE, "addAttributeSchema", e.getMessage(), params);
throw e;
} catch (SSOException e) {
this.log(Level.SEVERE, "addAttributeSchema", e.getMessage(), params);
throw e;
}
}
use of com.sun.identity.cli.CLIRequest in project OpenAM by OpenRock.
the class SAML2Test method listCircleOfTrusts.
@Test(groups = { "samlv2", "samlv2entityop" }, dependsOnMethods = { "importEntity" })
public void listCircleOfTrusts() throws CLIException, SAML2MetaException {
entering("listCircleOfTrusts", null);
String[] args = { "list-cots", CLIConstants.PREFIX_ARGUMENT_LONG + IArgument.REALM_NAME, "/" };
CLIRequest req = new CLIRequest(null, args, getAdminSSOToken());
cmdManager.addToRequestQueue(req);
cmdManager.serviceRequestQueue();
exiting("listCircleOfTrusts");
}
Aggregations