use of com.sun.appserv.management.config.SecurityMapConfig in project Payara by payara.
the class SecurityMapConfigTest method ensureDefaultInstance.
public static SecurityMapConfig ensureDefaultInstance(final DomainConfig domainConfig) {
final ConnectorConnectionPoolConfig ccpc = ConnectorConnectionPoolConfigTest.ensureDefaultInstance(domainConfig);
SecurityMapConfig result = ccpc.getSecurityMapConfigMap().get(getDefaultInstanceName());
if (result == null) {
result = createInstance(ccpc, getDefaultInstanceName(), DEFAULT_BACKEND_PRINCIPAL, DEFAULT_BACKEND_PASSWORD, DEFAULT_PRINCIPALS, DEFAULT_USERGROUPS);
}
return result;
}
use of com.sun.appserv.management.config.SecurityMapConfig in project Payara by payara.
the class SecurityMapConfigTest method testCreateRemove.
public void testCreateRemove() {
if (!checkNotOffline("testDeleteLBConfig")) {
return;
}
final String TEST_NAME = "SecurityMapConfigTest.testCreateRemove";
final ResourceAdapterConfig rac = ResourceAdapterConfigTest.createInstance(getDomainConfig(), TEST_NAME);
try {
final ConnectorConnectionPoolConfig ccpc = ConnectorConnectionPoolConfigTest.createInstance(getDomainConfig(), TEST_NAME, CONNECTOR_DEF_NAME, rac.getName(), null);
try {
final String smcName = "SecurityMapConfigTest.testCreateRemove";
final String[] principals = new String[] { "SecurityMapConfigTest.testCreateRemove" };
final String[] userGroups = new String[0];
final SecurityMapConfig smc = createInstance(ccpc, smcName, DEFAULT_BACKEND_PRINCIPAL, DEFAULT_BACKEND_PASSWORD, principals, null);
try {
assert (smcName.equals(smc.getName()));
assert (smc == ccpc.getSecurityMapConfigMap().get(smc.getName()));
testGetters(smc);
final Set<String> principalsBefore = GSetUtil.newSet(smc.getPrincipalNames());
final String PRINCIPAL1 = "testCreateRemove.test1";
smc.createPrincipal(PRINCIPAL1);
final Set<String> principalsAfter = GSetUtil.newSet(smc.getPrincipalNames());
assert (principalsAfter.contains(PRINCIPAL1));
smc.removePrincipal(PRINCIPAL1);
assert (principalsBefore.equals(GSetUtil.newSet(smc.getPrincipalNames())));
} finally {
ccpc.removeSecurityMapConfig(smc.getName());
}
} finally {
getDomainConfig().getResourcesConfig().removeConnectorConnectionPoolConfig(ccpc.getName());
}
} finally {
getDomainConfig().getResourcesConfig().removeResourceAdapterConfig(rac.getName());
}
}
use of com.sun.appserv.management.config.SecurityMapConfig in project Payara by payara.
the class SecurityServiceConfigTest method testCreateRemove.
public void testCreateRemove() {
if (!checkNotOffline("testDeleteLBConfig")) {
return;
}
final String TEST_NAME = "SecurityMapConfigTest.testCreateRemove";
final ResourceAdapterConfig rac = ResourceAdapterConfigTest.createInstance(getDomainConfig(), TEST_NAME);
try {
final ConnectorConnectionPoolConfig ccpc = ConnectorConnectionPoolConfigTest.createInstance(getDomainConfig(), TEST_NAME, CONNECTOR_DEF_NAME, rac.getName(), null);
try {
final String smcName = TEST_NAME;
final String[] principals = new String[] { TEST_NAME };
final String[] userGroups = new String[0];
final SecurityMapConfig smc = createInstance(ccpc, smcName, DEFAULT_BACKEND_PRINCIPAL, DEFAULT_BACKEND_PASSWORD, principals, null);
try {
assert (smcName.equals(smc.getName()));
assert (smc == ccpc.getSecurityMapConfigMap().get(smc.getName()));
testGetters(smc);
final Set<String> principalsBefore = GSetUtil.newSet(smc.getPrincipalNames());
final String PRINCIPAL1 = "testCreateRemove.test1";
smc.createPrincipal(PRINCIPAL1);
final Set<String> principalsAfter = GSetUtil.newSet(smc.getPrincipalNames());
assert (principalsAfter.contains(PRINCIPAL1));
smc.removePrincipal(PRINCIPAL1);
assert (principalsBefore.equals(GSetUtil.newSet(smc.getPrincipalNames())));
} finally {
ccpc.removeSecurityMapConfig(smc.getName());
}
} finally {
getDomainConfig().getResourcesConfig().removeConnectorConnectionPoolConfig(ccpc.getName());
}
} finally {
getDomainConfig().getResourcesConfig().removeResourceAdapterConfig(rac.getName());
}
}
use of com.sun.appserv.management.config.SecurityMapConfig in project Payara by payara.
the class SecurityServiceConfigTest method ensureDefaultInstance.
public static SecurityMapConfig ensureDefaultInstance(final DomainConfig domainConfig) {
final ConnectorConnectionPoolConfig ccpc = ConnectorConnectionPoolConfigTest.ensureDefaultInstance(domainConfig);
SecurityMapConfig result = ccpc.getSecurityMapConfigMap().get(getDefaultInstanceName());
if (result == null) {
result = createInstance(ccpc, getDefaultInstanceName(), DEFAULT_BACKEND_PRINCIPAL, DEFAULT_BACKEND_PASSWORD, DEFAULT_PRINCIPALS, DEFAULT_USERGROUPS);
}
return result;
}
use of com.sun.appserv.management.config.SecurityMapConfig in project Payara by payara.
the class AMXTest method checkCreateRemoveGet.
/**
* Verify:
* <ul>
* <li>each create() or createAbc() method ends in "Config" if it returns an AMXConfig subclass</li>
* <li>each remove() or removeAbc() method ends in "Config"</li>
* </ul>
*/
public void checkCreateRemoveGet(final ObjectName objectName) throws Exception {
final AMX proxy = getProxyFactory().getProxy(objectName, AMX.class);
if (proxy instanceof Container) {
final Method[] methods = getInterfaceClass(proxy).getMethods();
final MBeanInfo mbeanInfo = Util.getExtra(proxy).getMBeanInfo();
final MBeanOperationInfo[] operations = mbeanInfo.getOperations();
for (int methodIdx = 0; methodIdx < methods.length; ++methodIdx) {
final Method method = methods[methodIdx];
final String methodName = method.getName();
if (methodName.startsWith("create") && !methodName.endsWith("Config")) {
if (AMXConfig.class.isAssignableFrom(method.getReturnType()) && (!(proxy instanceof SecurityMapConfig))) {
trace("WARNING: method " + methodName + " does not end in 'Config': " + objectName);
}
} else if (methodName.startsWith("remove") && !methodName.endsWith("Config") && proxy instanceof AMXConfig) {
if (// method.getReturnType() == Void.class &&
method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == String.class && !method.getName().equals("removeProperty") && !method.getName().equals("removeSystemProperty") && (!(proxy instanceof SecurityMapConfig))) {
trace("WARNING: method " + methodName + " does not end in 'Config': " + methodName);
}
}
}
}
}
Aggregations