本文整理汇总了Java中java.rmi.server.RemoteServer.getLog方法的典型用法代码示例。如果您正苦于以下问题:Java RemoteServer.getLog方法的具体用法?Java RemoteServer.getLog怎么用?Java RemoteServer.getLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.rmi.server.RemoteServer
的用法示例。
在下文中一共展示了RemoteServer.getLog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetLog001
import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public void testGetLog001() {
try {
RemoteServer.getLog();
} catch (Throwable e) {
fail("Failed with:" + e);
}
}
示例2: testSetLog004
import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
public void testSetLog004() {
try {
OutputStream outS = RemoteServer.getLog();
RemoteServer.setLog(new PrintStream(new ByteArrayOutputStream()));
RemoteServer.setLog(outS);
assertSame(outS, RemoteServer.getLog());
} catch (Throwable e) {
fail("Failed with:" + e);
}
}
示例3: checkServerCallLog
import java.rmi.server.RemoteServer; //导入方法依赖的package包/类
/**
* Check serverCallLog output
*/
private static void checkServerCallLog() throws Exception {
ByteArrayOutputStream serverCallLog = new ByteArrayOutputStream();
RemoteServer.setLog(serverCallLog);
Naming.list(LOCATION);
verifyLog(serverCallLog, "list");
serverCallLog.reset();
RemoteServer.setLog(null);
PrintStream callStream = RemoteServer.getLog();
if (callStream != null) {
TestLibrary.bomb("call stream not null after calling " +
"setLog(null)");
} else {
System.err.println("call stream should be null and it is");
}
Naming.list(LOCATION);
if (usingOld) {
if (serverCallLog.toString().indexOf("UnicastServerRef") >= 0) {
TestLibrary.bomb("server call logging not turned off");
}
} else if (serverCallLog.toByteArray().length != 0) {
TestLibrary.bomb("call log contains output but it " +
"should be empty");
}
serverCallLog.reset();
RemoteServer.setLog(serverCallLog);
try {
// generates a notbound exception
Naming.lookup(LOCATION + "notthere");
} catch (Exception e) {
}
verifyLog(serverCallLog, "exception");
serverCallLog.reset();
RemoteServer.setLog(serverCallLog);
callStream = RemoteServer.getLog();
callStream.println("bingo, this is a getLog test");
verifyLog(serverCallLog, "bingo");
}