当前位置: 首页>>代码示例>>Java>>正文


Java ReportsGenerator.subscribe方法代码示例

本文整理汇总了Java中org.fosstrak.ale.server.ReportsGenerator.subscribe方法的典型用法代码示例。如果您正苦于以下问题:Java ReportsGenerator.subscribe方法的具体用法?Java ReportsGenerator.subscribe怎么用?Java ReportsGenerator.subscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fosstrak.ale.server.ReportsGenerator的用法示例。


在下文中一共展示了ReportsGenerator.subscribe方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSubscribe

import org.fosstrak.ale.server.ReportsGenerator; //导入方法依赖的package包/类
/**
 * tests the subscribe method.
 * @throws Exception test failure (or see what is expected by the test).
 */
@Test
public void testSubscribe() throws Exception {
	WriteConfig persistenceWriteMock = EasyMock.createMock(WriteConfig.class);
	persistenceWriteMock.writeECSpecSubscriber(EasyMock.isA(String.class), EasyMock.isA(String.class));
	EasyMock.expectLastCall();
	EasyMock.replay(persistenceWriteMock);
	((ALEImpl) ale).setPersistenceWriteAPI(persistenceWriteMock);
	
	final String notificationURI = "test";
	ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
	reportGenerator.subscribe(notificationURI);
	EasyMock.expectLastCall();
	EasyMock.replay(reportGenerator);
	
	ReportsGeneratorsProvider rgenProvider = EasyMock.createMock(ReportsGeneratorsProvider.class);
	EasyMock.expect(rgenProvider.containsKey("spec")).andReturn(true);
	EasyMock.expect(rgenProvider.get("spec")).andReturn(reportGenerator);
	EasyMock.replay(rgenProvider);
	((ALEImpl) ale).setReportGeneratorsProvider(rgenProvider);
	
	ale.subscribe("spec", notificationURI);

	EasyMock.verify(persistenceWriteMock);
	EasyMock.verify(reportGenerator);
	EasyMock.verify(rgenProvider);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:31,代码来源:ALETest.java

示例2: testSubscribeInvalidURI

import org.fosstrak.ale.server.ReportsGenerator; //导入方法依赖的package包/类
/**
 * test the correct behavior of the constructor in the spec validation case.
 */
@Test(expected = InvalidURIException.class)
public void testSubscribeInvalidURI() throws Exception {
	ECSpec spec = ECElementsUtils.createECSpec();
	ECSpecValidator validator = EasyMock.createMock(ECSpecValidator.class);
	validator.validateSpec(spec);
	EasyMock.expectLastCall();
	EasyMock.replay(validator);
	ReportsGenerator generator = new ReportsGeneratorImpl("theName", spec, validator, new ECReportsHelper());
	generator.subscribe(null);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:14,代码来源:ReportsGeneratorTest.java

示例3: testSubscribeDuplicateSubscriptionException

import org.fosstrak.ale.server.ReportsGenerator; //导入方法依赖的package包/类
/**
 * test duplicate subscription not allowed.
 */
@Test(expected = DuplicateSubscriptionException.class)
public void testSubscribeDuplicateSubscriptionException() throws Exception {
	ECSpec spec = ECElementsUtils.createECSpec();
	ECSpecValidator validator = EasyMock.createMock(ECSpecValidator.class);
	validator.validateSpec(spec);
	EasyMock.expectLastCall();
	EasyMock.replay(validator);
	ReportsGenerator generator = new NonRunnableReportsGenerator("theName", spec, validator);
	
	final String uri ="http://localhost:9999"; 
	generator.subscribe(uri);
	generator.subscribe(uri);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:17,代码来源:ReportsGeneratorTest.java

示例4: testSubscribeUnSubscribe

import org.fosstrak.ale.server.ReportsGenerator; //导入方法依赖的package包/类
@Test
public void testSubscribeUnSubscribe() throws Exception {
	ECSpec spec = ECElementsUtils.createECSpec();
	ECSpecValidator validator = EasyMock.createMock(ECSpecValidator.class);
	validator.validateSpec(spec);
	EasyMock.expectLastCall();
	EasyMock.replay(validator);
	ReportsGenerator generator = new NonRunnableReportsGenerator("theName", spec, validator);
	
	final String uri ="http://localhost:9999"; 
	final String uri2 ="http://localhost:8888"; 
	
	Assert.assertEquals(ReportsGeneratorState.UNREQUESTED, ((ReportsGeneratorImpl) generator).getState());
	generator.subscribe(uri);
	Assert.assertEquals(1, generator.getSubscribers().size());
	Assert.assertEquals(ReportsGeneratorState.REQUESTED, ((ReportsGeneratorImpl) generator).getState());
	generator.subscribe(uri2);
	
	Assert.assertEquals(2, generator.getSubscribers().size());
	List<String> subscribers = generator.getSubscribers();
	for (String str : new String[] {uri, uri2 }) {
		Assert.assertTrue(subscribers.contains(str));
	}
	
	generator.unsubscribe(uri);
	Assert.assertEquals(1, generator.getSubscribers().size());
	Assert.assertEquals(ReportsGeneratorState.REQUESTED, ((ReportsGeneratorImpl) generator).getState());
	generator.unsubscribe(uri2);
	Assert.assertEquals(0, generator.getSubscribers().size());
	Assert.assertEquals(ReportsGeneratorState.UNREQUESTED, ((ReportsGeneratorImpl) generator).getState());	
	
	EasyMock.verify(validator);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:34,代码来源:ReportsGeneratorTest.java

示例5: testSubscribe

import org.fosstrak.ale.server.ReportsGenerator; //导入方法依赖的package包/类
/**
 * tests the subscribe method.
 * @throws Exception test failure (or see what is expected by the test).
 */
@Test
public void testSubscribe() throws Exception {
	ALEACImpl aleac = EasyMock.createMock(ALEACImpl.class);
	((ALEImpl) ale).setAleac(aleac);
	
	
	WriteConfig persistenceWriteMock = EasyMock.createMock(WriteConfig.class);
	persistenceWriteMock.writeECSpecSubscriber(EasyMock.isA(String.class), EasyMock.isA(String.class));
	EasyMock.expectLastCall();
	EasyMock.replay(persistenceWriteMock);
	((ALEImpl) ale).setPersistenceWriteAPI(persistenceWriteMock);
	
	final String notificationURI = "test";
	ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
	reportGenerator.subscribe(notificationURI);
	EasyMock.expectLastCall();
	EasyMock.replay(reportGenerator);
	
	ReportsGeneratorsProvider rgenProvider = EasyMock.createMock(ReportsGeneratorsProvider.class);
	EasyMock.expect(rgenProvider.containsKey("spec")).andReturn(true);
	EasyMock.expect(rgenProvider.get("spec")).andReturn(reportGenerator);
	EasyMock.replay(rgenProvider);
	((ALEImpl) ale).setReportGeneratorsProvider(rgenProvider);
	
	ale.subscribe("spec", notificationURI);

	EasyMock.verify(persistenceWriteMock);
	EasyMock.verify(reportGenerator);
	EasyMock.verify(rgenProvider);
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:35,代码来源:ALETest.java


注:本文中的org.fosstrak.ale.server.ReportsGenerator.subscribe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。