本文整理汇总了Java中org.fosstrak.ale.server.impl.ALEImpl类的典型用法代码示例。如果您正苦于以下问题:Java ALEImpl类的具体用法?Java ALEImpl怎么用?Java ALEImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ALEImpl类属于org.fosstrak.ale.server.impl包,在下文中一共展示了ALEImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInitialize
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的package包/类
/**
* tests the initialize function
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testInitialize() throws Exception {
ReportsGeneratorsProvider rgenProvider = EasyMock.createMock(ReportsGeneratorsProvider.class);
rgenProvider.clear();
EasyMock.expectLastCall();
EasyMock.replay(rgenProvider);
((ALEImpl) ale).setReportGeneratorsProvider(rgenProvider);
InputGeneratorProvider iProvider = EasyMock.createMock(InputGeneratorProvider.class);
iProvider.clear();
EasyMock.expectLastCall();
EasyMock.replay(iProvider);
((ALEImpl) ale).setInputGenerators(iProvider);
((ALEImpl)ale).initialize();
Assert.assertTrue(ale.isReady());
// now try to invoke once more (must not initialize once more). easymock will throw an exception if mocks are hit twice.
((ALEImpl)ale).initialize();
Assert.assertTrue(ale.isReady());
EasyMock.verify(rgenProvider);
EasyMock.verify(iProvider);
}
示例2: testDefine
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的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.impl.ALEImpl; //导入依赖的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.impl.ALEImpl; //导入依赖的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.impl.ALEImpl; //导入依赖的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.impl.ALEImpl; //导入依赖的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: testGetECSpec
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的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);
}
示例8: testGetSubscribers
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的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);
}
示例9: testGetVendorVersion
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的package包/类
/**
* vendor version shall never return null.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testGetVendorVersion() throws Exception {
ALESettings aleSettings = EasyMock.createMock(ALESettings.class);
((ALEImpl) ale).setAleSettings(aleSettings);
EasyMock.expect(aleSettings.getVendorVersion()).andReturn("1.1");
EasyMock.replay(aleSettings);
Assert.assertEquals("1.1", ale.getVendorVersion());
EasyMock.verify(aleSettings);
}
示例10: testGetStandardVersion
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的package包/类
/**
* standard version shall never return null.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testGetStandardVersion() throws Exception {
ALESettings aleSettings = EasyMock.createMock(ALESettings.class);
((ALEImpl) ale).setAleSettings(aleSettings);
EasyMock.expect(aleSettings.getAleStandardVersion()).andReturn("1.1.1");
EasyMock.replay(aleSettings);
Assert.assertEquals("1.1.1", ale.getStandardVersion());
EasyMock.verify(aleSettings);
}
示例11: testDefineDuplicateNameException
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的package包/类
/**
* tests that exception is thrown when invoking define on an existing specification.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test(expected = DuplicateNameException.class)
public void testDefineDuplicateNameException() throws Exception {
ReportsGeneratorsProvider rgenProvider = EasyMock.createMock(ReportsGeneratorsProvider.class);
EasyMock.expect(rgenProvider.containsKey("spec")).andReturn(true);
EasyMock.replay(rgenProvider);
((ALEImpl) ale).setReportGeneratorsProvider(rgenProvider);
ale.define("spec", null);
}
示例12: testSubscribe
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的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);
}
示例13: testUnsubscribe
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的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);
}
示例14: testDefineDuplicateNameException
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的package包/类
/**
* tests that exception is thrown when invoking define on an existing specification.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test(expected = DuplicateNameException.class)
public void testDefineDuplicateNameException() throws Exception {
ALEACImpl aleac = EasyMock.createMock(ALEACImpl.class);
((ALEImpl) ale).setAleac(aleac);
ReportsGeneratorsProvider rgenProvider = EasyMock.createMock(ReportsGeneratorsProvider.class);
EasyMock.expect(rgenProvider.containsKey("spec")).andReturn(true);
EasyMock.replay(rgenProvider);
((ALEImpl) ale).setReportGeneratorsProvider(rgenProvider);
ale.define("spec", null);
}
示例15: testDefine
import org.fosstrak.ale.server.impl.ALEImpl; //导入依赖的package包/类
/**
* tests the define method.
* @throws Exception test failure (or see what is expected by the test).
*/
@Test
public void testDefine() throws Exception {
ALEACImpl aleac = EasyMock.createMock(ALEACImpl.class);
((ALEImpl) ale).setAleac(aleac);
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);
}