use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class MailServerImplTest method setup.
@BeforeMethod
public void setup() {
ServiceConfigManager serviceConfigManagerMock = PowerMockito.mock(ServiceConfigManager.class);
ServiceConfig serviceConfigMock = PowerMockito.mock(ServiceConfig.class);
Debug debugMock = PowerMockito.mock(Debug.class);
sendMailMock = PowerMockito.mock(AMSendMail.class);
Map<String, Set<String>> options = createOptionsMap();
try {
Mockito.doNothing().when(sendMailMock).postMail(eq(recipients), anyString(), anyString(), anyString());
Mockito.doNothing().when(sendMailMock).postMail(eq(recipients), anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), anyBoolean());
} catch (MessagingException e) {
assert (false);
}
mailServerMock = new MailServerImpl(serviceConfigManagerMock, serviceConfigMock, debugMock, sendMailMock, options);
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class ConfigurationBase method getRootServerConfig.
protected static ServiceConfig getRootServerConfig(SSOToken ssoToken) throws SMSException, SSOException {
ServiceConfigManager scm = new ServiceConfigManager(Constants.SVC_NAME_PLATFORM, ssoToken);
ServiceConfig globalSvcConfig = scm.getGlobalConfig(null);
return (globalSvcConfig != null) ? globalSvcConfig.getSubConfig(CONFIG_SERVERS) : null;
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class DeleteSubConfiguration method deleteSubConfigToRoot.
private void deleteSubConfigToRoot(String serviceName, String subConfigName) throws CLIException {
SSOToken adminSSOToken = getAdminSSOToken();
IOutput outputWriter = getOutputWriter();
String[] params = { subConfigName, serviceName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_DELETE_SUB_CONFIGURATION", params);
try {
ServiceConfigManager scm = new ServiceConfigManager(serviceName, adminSSOToken);
ServiceConfig sc = scm.getGlobalConfig(null);
deleteSubConfig(sc, subConfigName);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_DELETE_SUB_CONFIGURATION", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("delete-sub-configuration-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { subConfigName, serviceName, e.getMessage() };
debugError("DeleteSubConfiguration.deleteSubConfigToRoot", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_DELETE_SUB_CONFIGURATION", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { subConfigName, serviceName, e.getMessage() };
debugError("DeleteSubConfiguration.deleteSubConfigToRoot", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_DELETE_SUB_CONFIGURATION", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class AMCommonNameGenerator method initialize.
private void initialize() {
try {
serviceSchemaManager = new ServiceSchemaManager(G11N_SERVICE_NAME, adminSSOToken);
serviceConfigManager = new ServiceConfigManager(G11N_SERVICE_NAME, adminSSOToken);
//listener for org
serviceConfigManager.addListener(this);
//listener for global
serviceSchemaManager.addListener(this);
} catch (SMSException smse) {
debug.error("AMCommonNameGenerator.initManager", smse);
} catch (SSOException ssoe) {
debug.error("AMCommonNameGenerator.initManager", ssoe);
}
}
use of com.sun.identity.sm.ServiceConfigManager in project OpenAM by OpenRock.
the class ModifySubConfiguration method modifySubConfigToRealm.
private void modifySubConfigToRealm(String realmName, String serviceName, String subConfigName, Map attrValues, String operation) throws CLIException {
SSOToken adminSSOToken = getAdminSSOToken();
IOutput outputWriter = getOutputWriter();
String[] params = { realmName, subConfigName, serviceName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_MODIFY_SUB_CONFIGURATION_IN_REALM", params);
try {
ServiceConfigManager scm = new ServiceConfigManager(serviceName, adminSSOToken);
ServiceConfig sc = scm.getOrganizationConfig(realmName, null);
if (sc == null) {
sc = scm.createOrganizationConfig(realmName, null);
}
modifySubConfig(sc, subConfigName, attrValues, operation);
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_MODIFY_SUB_CONFIGURATION_IN_REALM", params);
outputWriter.printlnMessage(MessageFormat.format(getResourceString("modify-sub-configuration-to-realm-succeed"), (Object[]) params));
} catch (SSOException e) {
String[] args = { realmName, subConfigName, serviceName, e.getMessage() };
debugError("ModifySubConfiguration.modifySubConfigToRealm", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_SUB_CONFIGURATIONT_IN_REALM", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
} catch (SMSException e) {
String[] args = { realmName, subConfigName, serviceName, e.getMessage() };
debugError("ModifySubConfiguration.modifySubConfigToRealm", e);
writeLog(LogWriter.LOG_ERROR, Level.INFO, "FAILED_MODIFY_SUB_CONFIGURATIONT_IN_REALM", args);
throw new CLIException(e, ExitCodes.REQUEST_CANNOT_BE_PROCESSED);
}
}
Aggregations