本文整理汇总了Java中org.fosstrak.ale.server.ReportsGenerator类的典型用法代码示例。如果您正苦于以下问题:Java ReportsGenerator类的具体用法?Java ReportsGenerator怎么用?Java ReportsGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReportsGenerator类属于org.fosstrak.ale.server包,在下文中一共展示了ReportsGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: poll
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
private ECReports poll(ReportsGenerator reportGenerator) throws NoSuchNameException {
ECReports reports = null;
reportGenerator.poll();
try {
synchronized (reportGenerator) {
reports = reportGenerator.getPollReports();
while (reports == null) {
reportGenerator.wait();
reports = reportGenerator.getPollReports();
}
}
} catch (InterruptedException e) {
LOG.debug("got interrupted.");
}
return reports;
}
示例2: testDefine
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
/**
* tests the define method.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testDefine() throws Exception {
ECSpec ecSpec = new ECSpec();
WriteConfig persistenceWriteMock = EasyMock.createMock(WriteConfig.class);
persistenceWriteMock.writeECSpec("spec", ecSpec);
EasyMock.expectLastCall();
EasyMock.replay(persistenceWriteMock);
((ALEImpl) ale).setPersistenceWriteAPI(persistenceWriteMock);
ReportsGenerator rg = EasyMock.createMock(ReportsGenerator.class);
ReportsGeneratorsProvider rgenProvider = EasyMock.createMock(ReportsGeneratorsProvider.class);
EasyMock.expect(rgenProvider.createNewReportGenerator("spec", ecSpec)).andReturn(rg);
EasyMock.expect(rgenProvider.put("spec", rg)).andReturn(rg);
EasyMock.expect(rgenProvider.containsKey("spec")).andReturn(false);
EasyMock.replay(rgenProvider);
((ALEImpl) ale).setReportGeneratorsProvider(rgenProvider);
ale.define("spec", ecSpec);
EasyMock.verify(rgenProvider);
EasyMock.verify(persistenceWriteMock);
}
示例3: testUndefine
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
/**
*
* tests the undefine method.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testUndefine() throws Exception {
RemoveConfig persistenceRemoveMock = EasyMock.createMock(RemoveConfig.class);
persistenceRemoveMock.removeECSpec("spec");
EasyMock.expectLastCall();
EasyMock.replay(persistenceRemoveMock);
((ALEImpl) ale).setPersistenceRemoveAPI(persistenceRemoveMock);
ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
ReportsGeneratorsProvider rgenProvider = EasyMock.createMock(ReportsGeneratorsProvider.class);
EasyMock.expect(rgenProvider.remove("spec")).andReturn(reportGenerator);
EasyMock.expect(rgenProvider.containsKey("spec")).andReturn(true);
EasyMock.replay(rgenProvider);
((ALEImpl) ale).setReportGeneratorsProvider(rgenProvider);
ale.undefine("spec");
EasyMock.verify(rgenProvider);
EasyMock.verify(persistenceRemoveMock);
}
示例4: testGetECSpec
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
/**
* tests the getECSpec method.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testGetECSpec() throws Exception {
ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
ECSpec spec = new ECSpec();
EasyMock.expect(reportGenerator.getSpec()).andReturn(spec);
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);
ECSpec result = ale.getECSpec("spec");
Assert.assertNotNull(result);
Assert.assertEquals(spec, result);
EasyMock.verify(reportGenerator);
EasyMock.verify(rgenProvider);
}
示例5: testPoll
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
/**
* test the poll method.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testPoll() throws Exception {
ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
reportGenerator.poll();
EasyMock.expectLastCall();
ECReports reports = new ECReports();
EasyMock.expect(reportGenerator.getPollReports()).andReturn(reports);
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);
ECReports result = ale.poll("spec");
Assert.assertNotNull(result);
Assert.assertEquals(reports, result);
EasyMock.verify(reportGenerator);
EasyMock.verify(rgenProvider);
}
示例6: testGetSubscribers
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
/**
* test the getSubscribers method.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testGetSubscribers() throws Exception {
String[] subscribers = new String[] { "sub1", "sub2" };
ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
EasyMock.expect(reportGenerator.getSubscribers()).andReturn(Arrays.asList(subscribers));
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);
Assert.assertTrue(ArrayUtils.isEquals(subscribers, ale.getSubscribers("spec")));
EasyMock.verify(reportGenerator);
EasyMock.verify(rgenProvider);
}
示例7: testGetSpecAndStateAndGetSubscribersAndGetName
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
/**
* test getter.
* @throws Exception test failure.
*/
@Test
public void testGetSpecAndStateAndGetSubscribersAndGetName() 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());
Assert.assertEquals(spec, generator.getSpec());
Assert.assertEquals(ReportsGeneratorState.UNREQUESTED, ((ReportsGeneratorImpl) generator).getState());
Assert.assertNotNull(generator.getSubscribers());
Assert.assertEquals(0, generator.getSubscribers().size());
Assert.assertEquals("theName", generator.getName());
EasyMock.verify(validator);
}
示例8: testGetECSpec
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
/**
* tests the getECSpec method.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testGetECSpec() throws Exception {
ALEACImpl aleac = EasyMock.createMock(ALEACImpl.class);
((ALEImpl) ale).setAleac(aleac);
ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
ECSpec spec = new ECSpec();
EasyMock.expect(reportGenerator.getSpec()).andReturn(spec);
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);
ECSpec result = ale.getECSpec("spec");
Assert.assertNotNull(result);
Assert.assertEquals(spec, result);
EasyMock.verify(reportGenerator);
EasyMock.verify(rgenProvider);
}
示例9: testGetSubscribers
import org.fosstrak.ale.server.ReportsGenerator; //导入依赖的package包/类
/**
* test the getSubscribers method.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testGetSubscribers() throws Exception {
ALEACImpl aleac = EasyMock.createMock(ALEACImpl.class);
((ALEImpl) ale).setAleac(aleac);
String[] subscribers = new String[] { "sub1", "sub2" };
ReportsGenerator reportGenerator = EasyMock.createMock(ReportsGenerator.class);
EasyMock.expect(reportGenerator.getSubscribers()).andReturn(Arrays.asList(subscribers));
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);
Assert.assertTrue(ArrayUtils.isEquals(subscribers, ale.getSubscribers("spec")));
EasyMock.verify(reportGenerator);
EasyMock.verify(rgenProvider);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: 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");
}
示例15: 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);
}