本文整理汇总了Java中org.fosstrak.ale.server.ALE.subscribe方法的典型用法代码示例。如果您正苦于以下问题:Java ALE.subscribe方法的具体用法?Java ALE.subscribe怎么用?Java ALE.subscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fosstrak.ale.server.ALE
的用法示例。
在下文中一共展示了ALE.subscribe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReadECSpecsSubscriber
import org.fosstrak.ale.server.ALE; //导入方法依赖的package包/类
/**
* test the subscription.
* @throws Exception test failure.
*/
@Test
public void testReadECSpecsSubscriber() throws Exception {
tempFolder.create();
File f = tempFolder.newFile("current.properties");
final String fileName = f.getName();
// absolute path encodes the filename, thus remove it.
final String path = f.getAbsolutePath().replace(fileName, "");
final String url1 = "url1";
final String url2 = "url2";
Properties p = new Properties();
p.setProperty("url_1", url1);
p.setProperty("url_2", url2);
p.store(new FileOutputStream(f), null);
FileUtils fileUtils = EasyMock.createMock(FileUtils.class);
EasyMock.expect(fileUtils.getFilesName(path, FileUtils.FILE_ENDING_PROPERTES)).andReturn(Arrays.asList(new String[] { fileName } ));
EasyMock.replay(fileUtils);
PersistenceConfig persistenceConfig = EasyMock.createMock(PersistenceConfig.class);
EasyMock.expect(persistenceConfig.getRealPathECSpecSubscriberDir()).andReturn(path).atLeastOnce();
EasyMock.replay(persistenceConfig);
ALE ale = EasyMock.createMock(ALE.class);
ale.subscribe("current", url1);
EasyMock.expectLastCall();
ale.subscribe("current", url2);
EasyMock.expectLastCall();
EasyMock.replay(ale);
ReadConfigImpl readConfig = new ReadConfigImpl();
readConfig.setFileUtils(fileUtils);
readConfig.setPersistenceConfig(persistenceConfig);
readConfig.setAle(ale);
// TEST
readConfig.readECSpecsSubscriber();
EasyMock.verify(fileUtils);
EasyMock.verify(persistenceConfig);
EasyMock.verify(ale);
}