use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class ProxyTest method checkCreateProxy.
public void checkCreateProxy(final ObjectName src) throws Exception {
final AMX proxy = getProxyFactory().getProxy(src, AMX.class);
Util.getObjectName(proxy);
proxy.getContainer();
proxy.getDomainRoot();
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class ConfigMgrTestBase method getProgeny.
public AMXConfig getProgeny(final String name) {
final Container container = getProgenyContainer();
final String progenyType = getProgenyJ2EEType();
// trace( "getProgeny: " + progenyType + "=" + name );
final Object progeny = container.getContainee(progenyType, name);
if (progeny != null && !(progeny instanceof AMXConfig)) {
assert (progeny instanceof AMX);
failure("getProgeny: " + progenyType + "=" + name + " not an AMXConfig, interface = " + Util.getExtra(Util.asAMX(progeny)).getInterfaceName());
}
return ((AMXConfig) progeny);
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class DomainConfigTest method testGetDeployedItemProxiesByName.
public void testGetDeployedItemProxiesByName() {
final DomainConfig mgr = getDomainConfig();
final Map<String, Map<String, AMX>> typeMap = mgr.getMultiContaineeMap(null);
for (final String j2eeType : typeMap.keySet()) {
final Map<String, AMX> proxyMap = typeMap.get(j2eeType);
for (final String name : proxyMap.keySet()) {
final AMX amx = Util.asAMX(proxyMap.get(name));
final AMX proxy = mgr.getContainee(j2eeType, name);
assert (Util.getObjectName(proxy).equals(Util.getObjectName(amx)));
assert (proxy.getName().equals(name));
}
}
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class LibrariesTest method testLibraries.
/**
* public void
* testGUIHang()
* {
* final String[] TEST_LIBS = new String[] { "/foo", "/bar" };
* final ObjectName objectName = Util.newObjectName( "amx:j2eeType=X-WebModuleConfig,name=admingui" );
* final WebModuleConfig cfg = getProxyFactory().getProxy( objectName );
* <p/>
* final String[] saveLibs = cfg.getLibraries();
* assert( saveLibs != null );
* <p/>
* final String[] testLibs = ArrayUtil.newArray( saveLibs, TEST_LIBS );
* try
* {
* cfg.setLibraries( testLibs );
* }
* finally
* {
* cfg.setLibraries( saveLibs );
* }
* }
*/
public void testLibraries() {
final Set<Libraries> all = getTestUtil().getAllAMX(Libraries.class);
for (final Libraries l : all) {
final AMX amx = (AMX) l;
if (DONT_TEST_LIBRARIES.contains(amx.getName())) {
continue;
}
final ObjectName objectName = Util.getObjectName(amx);
final String saveLibs = l.getLibraries();
assert (saveLibs != null);
final String testLibs = TEST_LIBS;
try {
l.setLibraries(testLibs);
} catch (Exception e) {
if (!READ_ONLY_LIBRARIES.contains(((AMX) l).getName())) {
warning("Couldn't change Libraries Attribute for " + objectName + " (probably read-only, though not advertised as such)");
}
} finally {
l.setLibraries(saveLibs);
}
}
}
use of com.sun.appserv.management.base.AMX in project Payara by payara.
the class PropertiesAccessTest method testPropertiesCreateRemove.
private void testPropertiesCreateRemove(final PropertiesAccess props) {
final AMX amx = Util.asAMX(props);
final String j2eeType = amx.getJ2EEType();
if (!TEST_CREATE_REMOVE_TYPES.contains(j2eeType)) {
return;
}
final Map<String, PropertyConfig> startProps = props.getPropertyConfigMap();
// add some properties, then delete them
final int numToAdd = 1;
final long now = System.currentTimeMillis();
for (int i = 0; i < numToAdd; ++i) {
final String testName = "__junittest_" + i + now;
if (props.getPropertyConfigMap().get(testName) != null) {
failure("test property already exists: " + testName);
}
props.createPropertyConfig(testName, "value_" + i);
assert (props.getPropertyConfigMap().get(testName) != null);
}
final int numProps = props.getPropertyConfigMap().keySet().size();
if (numProps != numToAdd + startProps.keySet().size()) {
failure("expecting " + numProps + " have " + numToAdd + startProps.keySet().size());
}
// remove the ones we added
for (int i = 0; i < numToAdd; ++i) {
final String testName = "__junittest_" + i + now;
props.removePropertyConfig(testName);
assert props.getPropertyConfigMap().get(testName) == null;
}
assert (props.getPropertyConfigMap().size() == startProps.keySet().size());
}
Aggregations