本文整理汇总了Java中org.fosstrak.ale.server.type.FileSubscriberOutputChannel.notify方法的典型用法代码示例。如果您正苦于以下问题:Java FileSubscriberOutputChannel.notify方法的具体用法?Java FileSubscriberOutputChannel.notify怎么用?Java FileSubscriberOutputChannel.notify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fosstrak.ale.server.type.FileSubscriberOutputChannel
的用法示例。
在下文中一共展示了FileSubscriberOutputChannel.notify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFileNotExistsCannotCreate
import org.fosstrak.ale.server.type.FileSubscriberOutputChannel; //导入方法依赖的package包/类
@Test(expected = ImplementationException.class)
public void testFileNotExistsCannotCreate() throws Exception {
final String filename = "file://localhost/dir/dir";
File mock = EasyMock.createMock(File.class);
EasyMock.expect(mock.exists()).andReturn(false);
EasyMock.expect(mock.createNewFile()).andThrow(new IOException());
EasyMock.replay(mock);
FileSubscriberOutputChannel tcp = new NotifyFile(filename, mock);
tcp.notify(ECElementsUtils.createECReports());
}
示例2: testFileNotFileCannotCreate
import org.fosstrak.ale.server.type.FileSubscriberOutputChannel; //导入方法依赖的package包/类
@Test(expected = ImplementationException.class)
public void testFileNotFileCannotCreate() throws Exception {
final String filename = "file://localhost/dir/dir";
File mock = EasyMock.createMock(File.class);
EasyMock.expect(mock.exists()).andReturn(true);
EasyMock.expect(mock.isFile()).andReturn(false);
EasyMock.expect(mock.createNewFile()).andThrow(new IOException());
EasyMock.replay(mock);
FileSubscriberOutputChannel tcp = new NotifyFile(filename, mock);
tcp.notify(ECElementsUtils.createECReports());
}
示例3: testNotify_File
import org.fosstrak.ale.server.type.FileSubscriberOutputChannel; //导入方法依赖的package包/类
@Test
public void testNotify_File() throws Exception {
// create file
File notificationFile = folder.newFile("test");
// create notification listener
FileSubscriberOutputChannel file = new FileSubscriberOutputChannel("file:///" + notificationFile.getAbsolutePath());
// create reports
ECReports reports = ECElementsUtils.createECReports();
// notify listener about reports
file.notify(reports);
// read file
ECReports resultReports = DeserializerUtil.deserializeECReports(new FileInputStream(notificationFile));
// check result
ECElementsUtils.assertEquals(reports, resultReports);
}