當前位置: 首頁>>代碼示例>>Java>>正文


Java PersistenceConfig類代碼示例

本文整理匯總了Java中org.fosstrak.ale.server.persistence.type.PersistenceConfig的典型用法代碼示例。如果您正苦於以下問題:Java PersistenceConfig類的具體用法?Java PersistenceConfig怎麽用?Java PersistenceConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PersistenceConfig類屬於org.fosstrak.ale.server.persistence.type包,在下文中一共展示了PersistenceConfig類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testReadECSpecs

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的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: testReadLRSpec

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的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);
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:41,代碼來源:ReadConfigTest.java

示例3: testReadAddROSpec

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的package包/類
/**
 * test the loading of the ro specs.
 * @throws Exception test failure.
 */
@Test
public void testReadAddROSpec() throws Exception {
	tempFolder.create();
	File f = tempFolder.newFile("rospec.llrp");
	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\"?><llrp:ADD_ROSPEC xmlns:llrp=\"http://www.llrp.org/ltk/schema/core/encoding/xml/1.0\" xmlns:Impinj=\"http://developer.impinj.com/ltk/schema/encoding/xml/1.0\" Version=\"1\" MessageID=\"4\"><llrp:ROSpec><llrp:ROSpecID>1</llrp:ROSpecID><llrp:Priority>0</llrp:Priority><llrp:CurrentState>Disabled</llrp:CurrentState><llrp:ROBoundarySpec><llrp:ROSpecStartTrigger><llrp:ROSpecStartTriggerType>Null</llrp:ROSpecStartTriggerType></llrp:ROSpecStartTrigger><llrp:ROSpecStopTrigger><llrp:ROSpecStopTriggerType>Null</llrp:ROSpecStopTriggerType><llrp:DurationTriggerValue>0</llrp:DurationTriggerValue></llrp:ROSpecStopTrigger></llrp:ROBoundarySpec><llrp:AISpec><llrp:AntennaIDs>0</llrp:AntennaIDs><llrp:AISpecStopTrigger><llrp:AISpecStopTriggerType>Null</llrp:AISpecStopTriggerType><llrp:DurationTrigger>0</llrp:DurationTrigger></llrp:AISpecStopTrigger><llrp:InventoryParameterSpec><llrp:InventoryParameterSpecID>9</llrp:InventoryParameterSpecID><llrp:ProtocolID>EPCGlobalClass1Gen2</llrp:ProtocolID></llrp:InventoryParameterSpec></llrp:AISpec></llrp:ROSpec></llrp:ADD_ROSPEC>".getBytes());
	bfos.close();
	
	FileUtils fileUtils = EasyMock.createMock(FileUtils.class);
	EasyMock.expect(fileUtils.getFilesName(path, FileUtils.FILE_ENDING_LLRP)).andReturn(Arrays.asList(new String[] { fileName } ));
	EasyMock.replay(fileUtils);
	
	PersistenceConfig persistenceConfig = EasyMock.createMock(PersistenceConfig.class);
	EasyMock.expect(persistenceConfig.getRealPathROSpecDir()).andReturn(path).atLeastOnce();
	EasyMock.replay(persistenceConfig);
	
	LLRPControllerManager logicalReaderManager = EasyMock.createMock(LLRPControllerManager.class);
	logicalReaderManager.define(EasyMock.eq("rospec"), EasyMock.isA(ADD_ROSPEC.class));
	EasyMock.replay(logicalReaderManager);
	
	ReadConfigImpl readConfig = new ReadConfigImpl();
	readConfig.setFileUtils(fileUtils);
	readConfig.setPersistenceConfig(persistenceConfig);
	readConfig.setLlrpControllerManager(logicalReaderManager);
	
	// TEST
	readConfig.readAddROSpecs();
	
	EasyMock.verify(fileUtils);
	EasyMock.verify(persistenceConfig);
	EasyMock.verify(logicalReaderManager);
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:41,代碼來源:ReadConfigTest.java

示例4: testAddAccessSpec

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的package包/類
/**
 * test the loading of the access specs.
 * @throws Exception test failure.
 */
@Test
public void testAddAccessSpec() throws Exception {
	tempFolder.create();
	File f = tempFolder.newFile("access.llrp");
	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\"?><llrp:ADD_ACCESSSPEC xmlns:llrp=\"http://www.llrp.org/ltk/schema/core/encoding/xml/1.0\" xmlns:Impinj=\"http://developer.impinj.com/ltk/schema/encoding/xml/1.0\" Version=\"1\" MessageID=\"5\"><llrp:AccessSpec><llrp:AccessSpecID>1</llrp:AccessSpecID><llrp:AntennaID>0</llrp:AntennaID><llrp:ProtocolID>EPCGlobalClass1Gen2</llrp:ProtocolID><llrp:CurrentState>Disabled</llrp:CurrentState><llrp:ROSpecID>1</llrp:ROSpecID><llrp:AccessSpecStopTrigger><llrp:AccessSpecStopTrigger>Null</llrp:AccessSpecStopTrigger><llrp:OperationCountValue>0</llrp:OperationCountValue></llrp:AccessSpecStopTrigger><llrp:AccessCommand><llrp:C1G2TagSpec><llrp:C1G2TargetTag><llrp:MB>0</llrp:MB><llrp:Match>1</llrp:Match><llrp:Pointer>0</llrp:Pointer><llrp:TagMask>ffffffff</llrp:TagMask><llrp:TagData>01010101</llrp:TagData></llrp:C1G2TargetTag></llrp:C1G2TagSpec><llrp:C1G2Write><llrp:OpSpecID>1</llrp:OpSpecID><llrp:AccessPassword>0</llrp:AccessPassword><llrp:MB>0</llrp:MB><llrp:WordPointer>0</llrp:WordPointer><llrp:WriteData>ffff ffff</llrp:WriteData></llrp:C1G2Write></llrp:AccessCommand></llrp:AccessSpec></llrp:ADD_ACCESSSPEC>".getBytes());
	bfos.close();
	
	FileUtils fileUtils = EasyMock.createMock(FileUtils.class);
	EasyMock.expect(fileUtils.getFilesName(path, FileUtils.FILE_ENDING_LLRP)).andReturn(Arrays.asList(new String[] { fileName } ));
	EasyMock.replay(fileUtils);
	
	PersistenceConfig persistenceConfig = EasyMock.createMock(PersistenceConfig.class);
	EasyMock.expect(persistenceConfig.getRealPathAccessSpecDir()).andReturn(path).atLeastOnce();
	EasyMock.replay(persistenceConfig);
	
	LLRPControllerManager logicalReaderManager = EasyMock.createMock(LLRPControllerManager.class);
	logicalReaderManager.defineAccessSpec(EasyMock.eq("access"), EasyMock.isA(ADD_ACCESSSPEC.class));
	EasyMock.replay(logicalReaderManager);
	
	ReadConfigImpl readConfig = new ReadConfigImpl();
	readConfig.setFileUtils(fileUtils);
	readConfig.setPersistenceConfig(persistenceConfig);
	readConfig.setLlrpControllerManager(logicalReaderManager);
	
	// TEST
	readConfig.readAddAccessSpecs();
	
	EasyMock.verify(fileUtils);
	EasyMock.verify(persistenceConfig);
	EasyMock.verify(logicalReaderManager);
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:41,代碼來源:ReadConfigTest.java

示例5: testInit

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的package包/類
/**
 * verify that the servlets context settings are correctly passed to the persistence API.
 * @throws ServletException test failure.
 */
@Test
public void testInit() throws ServletException {
	final String realPath = "realPath";
	PersistenceConfig pConfig = EasyMock.createMock(PersistenceConfig.class);
	pConfig.setRealPathWebapp(realPath);
	EasyMock.expectLastCall();
	EasyMock.replay(pConfig);
	
	ReadConfig readConfig = EasyMock.createMock(ReadConfig.class);
	readConfig.init();
	EasyMock.expectLastCall();
	EasyMock.replay(readConfig);
	
	ServletContext servletContext = EasyMock.createMock(ServletContext.class);
	EasyMock.expect(servletContext.getRealPath("/")).andReturn(realPath);
	EasyMock.replay(servletContext);
	
	PersistenceInitImpl persistenceInit = new PersistenceInitImpl();
	persistenceInit.setPersistenceConfig(pConfig);
	persistenceInit.setPersistenceReadConfig(readConfig);
	
	persistenceInit.init(servletContext);
	
	EasyMock.verify(pConfig);
	EasyMock.verify(readConfig);
	EasyMock.verify(servletContext);
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:32,代碼來源:PersistenceInitTest.java

示例6: setPersistenceConfig

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的package包/類
/**
 * inject a handle to the persistence config.
 * @param persistenceConfig the persistence config to use.
 */
@Autowired
public void setPersistenceConfig(PersistenceConfig persistenceConfig) {
	this.persistenceConfig = persistenceConfig;
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:9,代碼來源:ReadConfigImpl.java

示例7: beforeTest

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的package包/類
@Before
public void beforeTest() {
	config = new PersistenceConfig();
	config.setRealPathWebapp(null);
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:6,代碼來源:PersistenceConfigTest.java

示例8: testReadECSpecsSubscriber

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的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

示例9: setPersistenceConfig

import org.fosstrak.ale.server.persistence.type.PersistenceConfig; //導入依賴的package包/類
/**
 * allow to inject the persistence config API.
 * 
 * @param persistenceRemoveAPI
 *            the persistence config API.
 */
@Autowired
public void setPersistenceConfig(PersistenceConfig persistenceConfig) {
	this.persistenceConfig = persistenceConfig;
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:11,代碼來源:PersistenceInitImpl.java


注:本文中的org.fosstrak.ale.server.persistence.type.PersistenceConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。