本文整理汇总了Java中org.fosstrak.ale.server.readers.LogicalReaderManager.define方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalReaderManager.define方法的具体用法?Java LogicalReaderManager.define怎么用?Java LogicalReaderManager.define使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fosstrak.ale.server.readers.LogicalReaderManager
的用法示例。
在下文中一共展示了LogicalReaderManager.define方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReadLRSpec
import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入方法依赖的package包/类
/**
* test the loading of the logical readers.
* @throws Exception test failure.
*/
@Test
public void testReadLRSpec() throws Exception {
tempFolder.create();
File f = tempFolder.newFile("LogicalReader1.xml");
final String fileName = f.getName();
// absolute path encodes the filename, thus remove it.
final String path = f.getAbsolutePath().replace(fileName, "");
FileOutputStream fos = new FileOutputStream(f);
BufferedOutputStream bfos = new BufferedOutputStream(fos);
bfos.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ns3:LRSpec xmlns:ns2=\"urn:epcglobal:ale:wsdl:1\" xmlns:ns3=\"urn:epcglobal:ale:xsd:1\"><isComposite>false</isComposite><readers/><properties><property><name>ReaderType</name><value>org.fosstrak.ale.server.readers.hal.HALAdaptor</value></property><property><name>Description</name><value>My first HAL device reader</value></property><property><name>PhysicalReaderName</name><value>MyReader1</value></property><property><name>ReadTimeInterval</name><value>1000</value></property><property><name>PropertiesFile</name><value>/props/SimulatorController.xml</value></property></properties></ns3:LRSpec>".getBytes());
bfos.close();
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.getRealPathLRSpecDir()).andReturn(path).atLeastOnce();
EasyMock.replay(persistenceConfig);
LogicalReaderManager logicalReaderManager = EasyMock.createMock(LogicalReaderManager.class);
logicalReaderManager.define(EasyMock.eq("LogicalReader1"), EasyMock.isA(LRSpec.class));
EasyMock.replay(logicalReaderManager);
ReadConfigImpl readConfig = new ReadConfigImpl();
readConfig.setFileUtils(fileUtils);
readConfig.setPersistenceConfig(persistenceConfig);
readConfig.setLogicalReaderManager(logicalReaderManager);
// TEST
readConfig.readLRSpecs();
EasyMock.verify(fileUtils);
EasyMock.verify(persistenceConfig);
EasyMock.verify(logicalReaderManager);
}
示例2: beforeClass
import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入方法依赖的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: beforeClass
import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入方法依赖的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);
}
示例4: beforeClass
import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入方法依赖的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);
}
示例5: beforeClass
import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入方法依赖的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);
}
示例6: beforeClass
import org.fosstrak.ale.server.readers.LogicalReaderManager; //导入方法依赖的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);
}