当前位置: 首页>>代码示例>>Java>>正文


Java ALE类代码示例

本文整理汇总了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);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:41,代码来源:ReadConfigTest.java

示例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);
       	}
       }
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:37,代码来源:ALEACConformanceTest.java

示例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;
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:9,代码来源:ReadConfigImpl.java

示例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);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:48,代码来源:ReadConfigTest.java

示例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);
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:25,代码来源:ALECCConformanceTest.java

示例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);
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:24,代码来源:ALETMConformanceTest.java

示例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);

}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:30,代码来源:ALEConformanceTest.java

示例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);
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:28,代码来源:ALELRConformanceTest.java


注:本文中的org.fosstrak.ale.server.ALE类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。