當前位置: 首頁>>代碼示例>>Java>>正文


Java ReportsGenerator.unsubscribe方法代碼示例

本文整理匯總了Java中org.fosstrak.ale.server.ReportsGenerator.unsubscribe方法的典型用法代碼示例。如果您正苦於以下問題:Java ReportsGenerator.unsubscribe方法的具體用法?Java ReportsGenerator.unsubscribe怎麽用?Java ReportsGenerator.unsubscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.fosstrak.ale.server.ReportsGenerator的用法示例。


在下文中一共展示了ReportsGenerator.unsubscribe方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testUnsubscribe

import org.fosstrak.ale.server.ReportsGenerator; //導入方法依賴的package包/類
/**
 * tests the unsubscribe method.
 * @throws Exception test failure (or see what is expected by the test).
 */
@Test
public void testUnsubscribe() throws Exception {
	RemoveConfig persistenceRemoveMock = EasyMock.createMock(RemoveConfig.class);
	persistenceRemoveMock.removeECSpecSubscriber(EasyMock.isA(String.class), EasyMock.isA(String.class));
	EasyMock.expectLastCall();
	EasyMock.replay(persistenceRemoveMock);
	((ALEImpl) ale).setPersistenceRemoveAPI(persistenceRemoveMock);
	
	final String notificationURI = "test";
	ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
	reportGenerator.unsubscribe(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.unsubscribe("spec", notificationURI);

	EasyMock.verify(persistenceRemoveMock);
	EasyMock.verify(reportGenerator);
	EasyMock.verify(rgenProvider);
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:31,代碼來源:ALETest.java

示例2: testUnsubscribeNoSuchSubscriber

import org.fosstrak.ale.server.ReportsGenerator; //導入方法依賴的package包/類
/**
 * test the correct behavior of the constructor in the spec validation case.
 */
@Test(expected = NoSuchSubscriberException.class)
public void testUnsubscribeNoSuchSubscriber() 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.unsubscribe("http://localhost:9999");
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源:ReportsGeneratorTest.java

示例3: testUnsubscribeInvalidURI

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 testUnsubscribeInvalidURI() 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.unsubscribe(null);
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:14,代碼來源: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: testUnsubscribe

import org.fosstrak.ale.server.ReportsGenerator; //導入方法依賴的package包/類
/**
 * tests the unsubscribe method.
 * @throws Exception test failure (or see what is expected by the test).
 */
@Test
public void testUnsubscribe() throws Exception {
	ALEACImpl aleac = EasyMock.createMock(ALEACImpl.class);
	((ALEImpl) ale).setAleac(aleac);
	
	
	RemoveConfig persistenceRemoveMock = EasyMock.createMock(RemoveConfig.class);
	persistenceRemoveMock.removeECSpecSubscriber(EasyMock.isA(String.class), EasyMock.isA(String.class));
	EasyMock.expectLastCall();
	EasyMock.replay(persistenceRemoveMock);
	((ALEImpl) ale).setPersistenceRemoveAPI(persistenceRemoveMock);
	
	final String notificationURI = "test";
	ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
	reportGenerator.unsubscribe(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.unsubscribe("spec", notificationURI);

	EasyMock.verify(persistenceRemoveMock);
	EasyMock.verify(reportGenerator);
	EasyMock.verify(rgenProvider);
}
 
開發者ID:gs1oliot,項目名稱:oliot-fc,代碼行數:35,代碼來源:ALETest.java


注:本文中的org.fosstrak.ale.server.ReportsGenerator.unsubscribe方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。