本文整理汇总了Java中javax.management.loading.MLet类的典型用法代码示例。如果您正苦于以下问题:Java MLet类的具体用法?Java MLet怎么用?Java MLet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MLet类属于javax.management.loading包,在下文中一共展示了MLet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testMLetLoadClass
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for the method loadClass()
*
* @see javax.management.loading.mlet#loadClass()
*/
public Result testMLetLoadClass() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL",
new Object[] { MLET_URL + "mlet1.conf" },
new String[] { String.class.getName() });
mlet.loadClass("FirstRemoteClass");
} catch (Exception e) {
//e.printStackTrace();
return failed("Unexpected Exception occur");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:ExtMLetTest.java
示例2: testGetURLs
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for the method getURLs()
*
* @see javax.management.loading.mlet#getURLs()
*/
public Result testGetURLs() throws Exception {
MLet mlet = new MLet();
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
mlet.addURL(MLET_URL);
} catch (Exception e) {
//e.printStackTrace();
return failed("Unexpected Exception occur");
}
if (mlet.getURLs().length == 1 )
return passed();
else
return failed("Wrong number of URLs returned by getURLs() method");
}
开发者ID:freeVM,项目名称:freeVM,代码行数:22,代码来源:LoadingMBeanTest.java
示例3: testNativeLib
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for the method getLibraryDirectory()
*
* @see javax.management.loading.mlet#getLibraryDirectory()
*/
public Result testNativeLib() throws Exception {
try{
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
mlet.getMBeansFromURL(MLET_URL+"mlet2.conf");
String libPath = mlet.getLibraryDirectory();
//System.out.println(libPath);
if(libPath.equals(null))
return failed("method MLet.getLibraryDirectory()return wrong value = " + libPath);
}catch(Exception e){
//e.printStackTrace();
return failed("Unexpected Exception occur");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:LoadingMBeanTest.java
示例4: testSetLibraryDirectory
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for the method
* getLibraryDirectory()
* setLibraryDirectory()
*
* @see javax.management.loading.mlet#setLibraryDirectory()
*/
public Result testSetLibraryDirectory() throws Exception {
try{
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
mlet.getMBeansFromURL(MLET_URL+"mlet2.conf");
String libPath = mlet.getLibraryDirectory();
mlet.setLibraryDirectory(libPath);
if(libPath.equals(null))
return failed("method MLet.getLibraryDirectory()return wrong value = " + libPath);
}catch(Exception e){
//e.printStackTrace();
return failed("Unexpected Exception occur");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:26,代码来源:LoadingMBeanTest.java
示例5: testClassCheck
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for the method loadClass()
*
* @see javax.management.loading.mlet#loadClass()
*/
public Result testClassCheck() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL",new Object[] { MLET_URL+"mlet1.conf" },new String[] { String.class.getName() });
//mlet.getMBeansFromURL(MLET_URL+"/mlet-1/mlet1.conf");
Class type = mlet.loadClass("FirstRemoteClass");
//System.out.println(type);
if(type.equals(null))
return failed("method MLet.loadClass return wrong value = " + type);
} catch (Exception e) {
e.printStackTrace();
return failed("Unexpected Exception occur");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:24,代码来源:LoadingMBeanTest.java
示例6: testExceptionClassCheck
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for the method loadClass()
*
* @see javax.management.loading.mlet#loadClass()
*/
public Result testExceptionClassCheck() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL",new Object[] { MLET_URL+"/mlet-1/mlet1.conf" },new String[] { String.class.getName() });
Class type = mlet.loadClass("IAmNotAClass");
System.out.println(type);
if(type.equals(null))
return failed("method MLet.loadClass return wrong value = " + type);
} catch (Exception e) {
//e.printStackTrace();
return passed("Expected Exception occur");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:LoadingMBeanTest.java
示例7: testBaseChk
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for mandatory: Tags CODE, ARCHIVE, NAME
*/
public Result testBaseChk() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL",
new Object[] { MLET_URL + "BaseChk.conf" },
new String[] { String.class.getName() });
if (!server.isRegistered(new ObjectName(
"test:name=SecondRemoteClass")))
return failed("MBean SecondRemoteClass does not registered by the server");
} catch (Exception e) {
return failed("Unexpected Exception");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:TheMLetTagTest.java
示例8: testSerChk
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for mandatory: Tags OBJECT, ARCHIVE, NAME
*/
public Result testSerChk() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL",
new Object[] { MLET_URL + "SerChk.conf" },
new String[] { String.class.getName() });
if (!server.isRegistered(new ObjectName("test:name=AnSerTest")))
return failed("MBean AnSerTest(ser class) does not registered by the server");
server.getMBeanInfo(new ObjectName("test:name=AnSerTest")).getDescription();
} catch (Exception e) {
e.printStackTrace();
return failed("Unexpected Exception");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:24,代码来源:TheMLetTagTest.java
示例9: testCODEAndOBJECT
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for mandatory: Tags CODE, OBJECT.
* Exception should be thrown if it is exist in conf mlet text file
*/
public Result testCODEAndOBJECT() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "CODEAndOBJECT.conf" }, new String[] { String.class
.getName() });
} catch (Exception e) {
return failed("Unexpected Exception");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:23,代码来源:TheMLetTagTest.java
示例10: testUnexpCfg
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Exception should be thrown if in conf mlet text file exist unexpected end of file
*/
public Result testUnexpCfg() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "unexp.conf" }, new String[] { String.class.getName() });
} catch (MBeanException e) {
//e.printStackTrace();
return passed();
} catch (Exception exp) {
//exp.printStackTrace();
return failed("Unexpected Exception");
}
return failed("javax.management.MBeanException is absence");
}
开发者ID:freeVM,项目名称:freeVM,代码行数:25,代码来源:TheMLetTagTest.java
示例11: testMissArc
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Exception should be thrown if in conf mlet text file absence mandatory ARCHIVE tag
*/
public Result testMissArc() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "MissArc.conf" }, new String[] { String.class
.getName() });
} catch (MBeanException e) {
//e.printStackTrace();
return passed();
} catch (Exception exp) {
//exp.printStackTrace();
return failed("Unexpected Exception");
}
return failed("javax.management.MBeanException is absence");
}
开发者ID:freeVM,项目名称:freeVM,代码行数:24,代码来源:TheMLetTagTest.java
示例12: testOutOfEnd
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Exception should be thrown if in conf mlet text file out of end
*/
public Result testOutOfEnd() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "OutOfEnd.conf" },
new String[] { String.class.getName() });
} catch (MBeanException e) {
//e.printStackTrace();
return passed();
} catch (Exception exp) {
//exp.printStackTrace();
return failed("Unexpected Exception");
}
return failed("javax.management.MBeanException is absence");
}
开发者ID:freeVM,项目名称:freeVM,代码行数:25,代码来源:TheMLetTagTest.java
示例13: testEmptyConf
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Exception should be thrown if in conf mlet text is empty
*/
public Result testEmptyConf() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "empty.conf" }, new String[] { String.class.getName() });
} catch (MBeanException e) {
//e.printStackTrace();
return passed();
} catch (Exception exp) {
//exp.printStackTrace();
return failed("Unexpected Exception");
}
return failed("javax.management.MBeanException is absence");
}
开发者ID:freeVM,项目名称:freeVM,代码行数:22,代码来源:TheMLetTagTest.java
示例14: testListOfMlets
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for mandatory: Tags CODE, ARCHIVE, NAME, CODEBASE and arglist
* Check that mlet service work properly with list of remote classes
*/
public Result testListOfMlets() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "ListMLet.conf" },
new String[] { String.class.getName() });
} catch (Exception exp) {
exp.printStackTrace();
return failed("Unexpected Exception");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:21,代码来源:TheMLetTagTest.java
示例15: testMletsComments
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for mandatory: Tags CODE, ARCHIVE, NAME
* Check that mlet service work properly with comments in mlet text conf file
*/
public Result testMletsComments() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "ComMLet.conf" },
new String[] { String.class.getName() });
} catch (Exception exp) {
exp.printStackTrace();
return failed("Unexpected Exception");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:21,代码来源:TheMLetTagTest.java
示例16: testWrongListOfCalsses
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Test for mandatory: Tags CODE, OBJECT, ARCHIVE, NAME, CODEBASE and arglist
* Exception should be thrown if in conf mlet text file list of remote classes
*/
public Result testWrongListOfCalsses() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "DiffNameChk.conf" }, new String[] { String.class
.getName() });
if (!server.isRegistered(new ObjectName(
"test:name=SecondRemoteClass")))
return failed("MBean SecondRemoteClass does not registered by the server");
if (!server.isRegistered(new ObjectName(
"test:name=FirstRemoteClass")))
return failed("MBean SecondRemoteClass does not registered by the server");
} catch (Exception exp) {
//exp.printStackTrace();
return failed("Unexpected Exception");
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:27,代码来源:TheMLetTagTest.java
示例17: testMissCode
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Exception should be thrown if in conf mlet text file absence mandatory CODE tag
*/
public Result testMissCode() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "MissCode.conf" },
new String[] { String.class.getName() });
} catch (MBeanException e) {
//e.printStackTrace();
return passed();
} catch (Exception exp) {
//exp.printStackTrace();
return failed("Unexpected Exception");
}
return failed("javax.management.MBeanException is absence");
}
开发者ID:freeVM,项目名称:freeVM,代码行数:25,代码来源:TheMLetTagTest.java
示例18: testNoconf
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Exception should be thrown if conf mlet text file not a conf mlet file
*/
public Result testNoconf() throws Exception {
try {
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL", new Object[] { MLET_URL
+ "not.conf" }, new String[] { String.class.getName() });
} catch (MBeanException e) {
//e.printStackTrace();
return passed();
} catch (Exception exp) {
//exp.printStackTrace();
return failed("Unexpected Exception");
}
return failed("javax.management.MBeanException is absence");
}
开发者ID:freeVM,项目名称:freeVM,代码行数:24,代码来源:TheMLetTagTest.java
示例19: testBaseSecurityChk2
import javax.management.loading.MLet; //导入依赖的package包/类
/**
* Check that Security Manager work properly with mlet service
*/
public Result testBaseSecurityChk2() throws Exception {
try {
System.setProperty("java.security.policy", POLICY_FILE);
Policy.getPolicy().refresh();
System.setSecurityManager(new SecurityManager());
MBeanServer server = MBeanServerFactory.createMBeanServer();
MLet mlet = new MLet();
ObjectName name = new ObjectName("test:name=mlet1");
server.registerMBean(mlet, name);
server.invoke(name, "getMBeansFromURL",
new Object[] { MLET_URL + "mlet.conf" },
new String[] { String.class.getName() });
boolean res = server.isRegistered(new ObjectName(
"test:name=FirstRemoteClass"));
System.out.println("Is MBean register: " + res);
} catch (Exception e) {
e.printStackTrace();
}
return result();
}
开发者ID:freeVM,项目名称:freeVM,代码行数:25,代码来源:SecurityMLetTest.java
示例20: makeMLet
import javax.management.loading.MLet; //导入依赖的package包/类
public static URLClassLoader makeMLet ( String url ) throws MalformedURLException, Exception {
URLClassLoader ucl = new MLet(new URL[] {
new URL(url)
});
Reflections.setFieldValue(ucl, "parent", null);
Reflections.setFieldValue(ucl, "domains", new HashSet<>());
Reflections.setFieldValue(ucl, "defaultDomain", null);
Reflections.setFieldValue(ucl, "acc", null);
Reflections.setFieldValue(Reflections.getFieldValue(ucl, "ucp"), "acc", null);
return ucl;
}
开发者ID:mbechler,项目名称:marshalsec,代码行数:13,代码来源:JDKUtil.java
注:本文中的javax.management.loading.MLet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论