本文整理汇总了Java中org.fosstrak.ale.server.ALE类的典型用法代码示例。如果您正苦于以下问题:Java ALE类的具体用法?Java ALE怎么用?Java ALE使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ALE类属于org.fosstrak.ale.server包,在下文中一共展示了ALE类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReadECSpecs
import org.fosstrak.ale.server.ALE; //导入依赖的package包/类
/**
* test the creation of persisted ECSpecs.
* @throws Exception test failure.
*/
@Test
public void testReadECSpecs() throws Exception {
tempFolder.create();
File f = tempFolder.newFile("ecspec.xml");
final String fileName = f.getName();
// absolute path encodes the filename, thus remove it.
final String path = f.getAbsolutePath().replace(fileName, "");
ECSpec spec = ECElementsUtils.createECSpec();
SerializerUtil.serializeECSpec(spec, new FileOutputStream(f));
FileUtils fileUtils = EasyMock.createMock(FileUtils.class);
EasyMock.expect(fileUtils.getFilesName(path, FileUtils.FILE_ENDING_XML)).andReturn(Arrays.asList(new String[] { fileName } ));
EasyMock.replay(fileUtils);
PersistenceConfig persistenceConfig = EasyMock.createMock(PersistenceConfig.class);
EasyMock.expect(persistenceConfig.getRealPathECSpecDir()).andReturn(path).atLeastOnce();
EasyMock.replay(persistenceConfig);
ALE ale = EasyMock.createMock(ALE.class);
ale.define(EasyMock.eq("ecspec"), EasyMock.isA(ECSpec.class));
EasyMock.expectLastCall();
EasyMock.replay(ale);
ReadConfigImpl readConfig = new ReadConfigImpl();
readConfig.setFileUtils(fileUtils);
readConfig.setPersistenceConfig(persistenceConfig);
readConfig.setAle(ale);
// TEST
readConfig.readECSpecs();
EasyMock.verify(fileUtils);
EasyMock.verify(persistenceConfig);
EasyMock.verify(ale);
}
示例2: beforeClass
import org.fosstrak.ale.server.ALE; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
LOG.info("Initializing Spring context.");
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/applicationContext.xml");
LOG.info("Spring context initialized.");
aleac = (ALEACImpl) applicationContext.getBean("aleac");
aleac.login("admin", "1111");
ale = (ALE) applicationContext.getBean("ale");
alecc = (ALECC) applicationContext.getBean("alecc");
alelr = (LogicalReaderManager) applicationContext.getBean("logicalReaderManager");
aletm = (ALETM) applicationContext.getBean("aletm");
LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALEACConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_A.xml"));
System.out.println("Please connect reader... (timeout: 5000ms)");
Thread.sleep(5000);
alelr.define("LogicalReader1", lrspec);
for(String permName : aleac.getPermissionNames()) {
aleac.undefinePermission(permName);
}
for(String roleName : aleac.getRoleNames()) {
aleac.undefineRole(roleName);
}
for(String userId : aleac.getClientIdentityNames()) {
if(!userId.equalsIgnoreCase("admin")) {
aleac.undefineClientIdentity(userId);
}
}
}
示例3: setAle
import org.fosstrak.ale.server.ALE; //导入依赖的package包/类
/**
* inject a handle to the ALE.
* @param ale the ALE to use.
*/
@Autowired
public void setAle(ALE ale) {
this.ale = ale;
}
示例4: 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);
}
示例5: beforeClass
import org.fosstrak.ale.server.ALE; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
LOG.info("Initializing Spring context.");
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/applicationContext.xml");
LOG.info("Spring context initialized.");
aletm = (ALETM) applicationContext.getBean("aletm");
lrm = (LogicalReaderManager) applicationContext.getBean("logicalReaderManager");
alecc = (ALECC) applicationContext.getBean("alecc");
ale = (ALE) applicationContext.getBean("ale");
LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALETMConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_W.xml"));
System.out.println("Please connect reader... (timeout: 5000ms)");
Thread.sleep(5000);
lrm.define("LogicalReader1", lrspec);
System.out.println("Waiting for reader initialization...");
Thread.sleep(5000);
}
示例6: beforeClass
import org.fosstrak.ale.server.ALE; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
LOG.info("Initializing Spring context.");
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/applicationContext.xml");
LOG.info("Spring context initialized.");
aletm = (ALETM) applicationContext.getBean("aletm");
ale = (ALE) applicationContext.getBean("ale");
lrm = (LogicalReaderManager) applicationContext.getBean("logicalReaderManager");
LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALETMConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_T4.xml"));
System.out.println("Please connect reader... (timeout: 5000ms)");
Thread.sleep(5000);
lrm.define("limg00n_emulator", lrspec);
System.out.println("Waiting for reader initialization...");
Thread.sleep(5000);
}
示例7: beforeClass
import org.fosstrak.ale.server.ALE; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
// please connect reader whose epc is 000011112222333344445555 and aaaa11112222333344445555
LOG.info("Initializing Spring context.");
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/applicationContext.xml");
LOG.info("Spring context initialized.");
aletm = (ALETM) applicationContext.getBean("aletm");
lrm = (LogicalReaderManager) applicationContext.getBean("logicalReaderManager");
alecc = (ALECC) applicationContext.getBean("alecc");
ale = (ALE) applicationContext.getBean("ale");
LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALETMConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_R.xml"));
LRSpec lrspec2 = DeserializerUtil.deserializeLRSpec(ALETMConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_R2.xml"));
System.out.println("Please connect reader... (timeout: 5000ms)");
Thread.sleep(5000);
lrm.define("LogicalReader1", lrspec);
lrm.define("LogicalReader2", lrspec2);
System.out.println("Waiting for reader initialization...");
Thread.sleep(5000);
}
示例8: beforeClass
import org.fosstrak.ale.server.ALE; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception {
// please connect readers of EPC 000011112222333344445555 and aaaa11112222333344445555
LOG.info("Initializing Spring context.");
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/applicationContext.xml");
LOG.info("Spring context initialized.");
alelr = (LogicalReaderManager) applicationContext.getBean("logicalReaderManager");
ale = (ALE) applicationContext.getBean("ale");
alecc = (ALECC) applicationContext.getBean("alecc");
LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_LR.xml"));
System.out.println("Please connect reader... (timeout: 5000ms)");
Thread.sleep(5000);
alelr.define("limg00n_emulator", lrspec);
System.out.println("Waiting for reader initialization...");
Thread.sleep(5000);
}