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


Java WPBUri類代碼示例

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


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

示例1: Refresh

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
public void Refresh() throws WPBIOException {
	synchronized (lock)
	{
		Map<Integer, Map<String, WPBUri>> tempMapUris = new HashMap<Integer, Map<String, WPBUri>>();
		
		List<WPBUri> recList = dataStorage.getAllRecords(WPBUri.class);
		for(WPBUri item: recList)
		{
			int httpIndex = httpToOperationIndex(item.getHttpOperation().toUpperCase());
			if (httpIndex >=0)
			{
				Map<String, WPBUri> aMap = tempMapUris.get(httpIndex);
				if (aMap == null)
				{
					aMap = new HashMap<String, WPBUri>();
					tempMapUris.put(httpIndex, aMap);
				}
				aMap.put(item.getUri(), item);
			}			
		}
		localCache = tempMapUris;
		cacheFingerPrint = UUID.randomUUID().toString();
	}

	
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:27,代碼來源:WPBLocalUrisCache.java

示例2: test_query_more_properties

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
@Test
public void test_query_more_properties()
{
	
	try
	{
		WPBSQLDataStoreDao dao = PowerMockito.spy(new WPBSQLDataStoreDao(dbProps));
		List<WPBUri> result = new ArrayList<WPBUri>();
		
		PowerMockito.doReturn(result).when(dao, "advanceQuery", any(Class.class), any(Set.class), any(Map.class), any(Map.class), any(String.class), any(WBSQLSortDirection.class));
		
		Set<String> properties = new HashSet<String>();
		Map<String, WBSQLQueryOperator> operators = new HashMap<String, WBSQLQueryOperator>();
		Map<String, Object> values = new HashMap<String, Object>();
		
		List<WPBUri> records = dao.query(WPBUri.class, properties, operators, values);
		assertTrue(records == result);
	} catch (Exception e)
	{
		assertTrue(false);
	}
	assertTrue(true);	
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:24,代碼來源:TestWBLocalDataStoreDao.java

示例3: test_query_no_conditions

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
@Test
public void test_query_no_conditions()
{
	
	try
	{
		WPBSQLDataStoreDao dao = PowerMockito.spy(new WPBSQLDataStoreDao(dbProps));
		List<WPBUri> result = new ArrayList<WPBUri>();
		
		PowerMockito.doReturn(result).when(dao, "advanceQuery", any(Class.class), any(Set.class), any(Map.class), any(Map.class), any(String.class), any(WBSQLSortDirection.class));
		
		Set<String> properties = new HashSet<String>();
		Map<String, WBSQLQueryOperator> operators = new HashMap<String, WBSQLQueryOperator>();
		Map<String, Object> values = new HashMap<String, Object>();
		
		List<WPBUri> records = dao.queryWithSort(WPBUri.class, properties, operators, values, "uri", WBSQLSortDirection.ASCENDING);
		assertTrue(records == result);
	} catch (Exception e)
	{
		assertTrue(false);
	}
	assertTrue(true);	
	
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:25,代碼來源:TestWBLocalDataStoreDao.java

示例4: test_build_queryAll_statement

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
@Test
public void test_build_queryAll_statement()
{
	try
	{
		String result = Whitebox.invokeMethod(sdbDataStorage, "build_queryAll_statement", "*", WPBUri.class);
		assertTrue (result.equals("select * from `test` where wpbclass=\"WPBUri\" "));
	} catch (Exception e)
	{
		assertTrue (false);
	}
}
 
開發者ID:webpagebytes,項目名稱:aws-cms-plugins,代碼行數:13,代碼來源:TestWPBAwsSdbAdminDataStorage.java

示例5: get

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
public WPBUri get(String uri, int httpIndex) throws WPBIOException
{
	if (localCache != null)
	{
		Map<String, WPBUri> uris = localCache.get(httpIndex);
		if (uris != null)
		{
			return uris.get(uri);
		}
	}
	return null;
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:13,代碼來源:WPBLocalUrisCache.java

示例6: getAllUris

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
public Set<String> getAllUris(int httpIndex) throws WPBIOException
{
	if (localCache != null)
	{
		Map<String, WPBUri> uris = localCache.get(httpIndex);
		if (uris != null)
		{
			return uris.keySet();
		}
	}
	return new HashSet<String>();
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:13,代碼來源:WPBLocalUrisCache.java

示例7: Refresh

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
public void Refresh() throws WPBIOException {
	synchronized (lock)
	{
		Map<Integer, Map<String, WPBUri>> tempMapUris = new HashMap<Integer, Map<String, WPBUri>>();
		
		List<WPBUri> recList = dataStorage.getAllRecords(WPBUri.class, "externalKey", AdminSortOperator.ASCENDING);
		MessageDigest md = null;
		try
		{
			md = MessageDigest.getInstance("MD5");
		} catch (NoSuchAlgorithmException e)
		{
			throw new WPBIOException("cannot calculate fingerprint", e);
		}
		
		for(WPBUri item: recList)
		{
			md.update(item.getVersion().getBytes());
			
			int httpIndex = httpToOperationIndex(item.getHttpOperation().toUpperCase());
			if (httpIndex >=0)
			{
				Map<String, WPBUri> aMap = tempMapUris.get(httpIndex);
				if (aMap == null)
				{
					aMap = new HashMap<String, WPBUri>();
					tempMapUris.put(httpIndex, aMap);
				}
				aMap.put(item.getUri(), item);
			}			
		}
		localCache = tempMapUris;
		cacheFingerPrint = CmsBase64Utility.toBase64(md.digest());
		memcacheClient.putFingerPrint(CACHE_KEY, cacheFingerPrint);
	}		
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:37,代碼來源:WPBMemCacheUrisCache.java

示例8: test_addRecord

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
@Test
public void test_addRecord()
{
	try
	{
		WPBSQLDataStoreDao dao = PowerMockito.spy(new WPBSQLDataStoreDao(dbProps));
		WPBUri uri = new WPBUri();
		
		Connection connectionMock = PowerMock.createMock(Connection.class);
		connectionMock.setAutoCommit(true);
		PowerMockito.doReturn(connectionMock).when(dao, "getConnection");
		
		String sqlStatement = "sql statement";
		PowerMockito.doReturn(sqlStatement).when(dao, "getSQLStringForInsert", Matchers.any(Object.class), Matchers.any(Set.class));
		
		PreparedStatement statementMock = PowerMock.createMock(PreparedStatement.class);
		EasyMock.expect(connectionMock.prepareStatement(sqlStatement)).andReturn(statementMock);
		PowerMockito.doReturn(1).when(dao, "buildStatementForInsertUpdate", any(), any(), any(), any());
		
		EasyMock.expect(statementMock.execute()).andReturn(true);
		
		ResultSet resultSetMock = PowerMock.createMock(ResultSet.class);
		EasyMock.expect(statementMock.getGeneratedKeys()).andReturn(resultSetMock);
		EasyMock.expect(resultSetMock.next()).andReturn(true);
		EasyMock.expect(resultSetMock.getLong(1)).andReturn(1L);
		PowerMockito.doNothing().when(dao, "setObjectProperty", any(), any(), any());
		statementMock.close();
		connectionMock.close();
		PowerMock.replay(connectionMock, statementMock, resultSetMock);
		WPBUri newUri = dao.addRecord(uri, "key");		
		PowerMock.verify(connectionMock, statementMock, resultSetMock);
		assertTrue (newUri == uri);
		
	} catch (Exception e)
	{
		assertTrue(false);
	}
	assertTrue(true);
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:40,代碼來源:TestWBLocalDataStoreDao.java

示例9: test_getRecord

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
@Test
public void test_getRecord()
{
	try
	{
		Object key = "123";
		Object result = "result";
		WPBSQLDataStoreDao dao = PowerMockito.spy(new WPBSQLDataStoreDao(dbProps));
		
		Connection connectionMock = PowerMock.createMock(Connection.class);
		PowerMockito.doReturn(connectionMock).when(dao, "getConnection");
		
		PreparedStatement statementMock = PowerMock.createMock(PreparedStatement.class);
		String sqlStatement = "SELECT * FROM WPBUri WHERE key=?";
		EasyMock.expect(connectionMock.prepareStatement(sqlStatement)).andReturn(statementMock);
		PowerMockito.doNothing().when(dao, "setPrepareStatementParameter", any(PreparedStatement.class), any(int.class), any(Object.class));
		
		ResultSet resultSetMock = PowerMock.createMock(ResultSet.class);
		EasyMock.expect(statementMock.executeQuery()).andReturn(resultSetMock);	
		EasyMock.expect(resultSetMock.next()).andReturn(true);
		
		PowerMockito.doReturn(result).when(dao, "copyResultSetToObject", any(), any());
		statementMock.close();
		connectionMock.close();
		resultSetMock.close();
		PowerMock.replay(connectionMock, statementMock, resultSetMock);
		Object res = dao.getRecord(WPBUri.class, "key", key);		
		PowerMock.verify(connectionMock, statementMock, resultSetMock);
		assertTrue (res == result);
		
	} catch (Exception e)
	{
		assertTrue(false);
	}
	assertTrue(true);
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:37,代碼來源:TestWBLocalDataStoreDao.java

示例10: test_updateRecord

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
@Test
public void test_updateRecord()
{

	try
	{
		WPBSQLDataStoreDao dao = PowerMockito.spy(new WPBSQLDataStoreDao(dbProps));
		WPBUri uri = new WPBUri();
		
		Connection connectionMock = PowerMock.createMock(Connection.class);
		connectionMock.setAutoCommit(true);
		PowerMockito.doReturn(connectionMock).when(dao, "getConnection");
		
		String sqlStatement = "UPDATE WPBUri SET ENABLED=?,VERSION=?,URI=?,LASTMODIFIED=?,HTTPOPERATION=?,CONTROLLERCLASS=?,RESOURCETYPE=?,RESOURCEEXTERNALKEY=? WHERE EXTERNALKEY=?";
		PowerMockito.doReturn(sqlStatement).when(dao, "getSQLStringForInsert", any(Object.class), any(Set.class));
		
		PreparedStatement statementMock = PowerMock.createMock(PreparedStatement.class);
		EasyMock.expect(connectionMock.prepareStatement(sqlStatement)).andReturn(statementMock);
		PowerMockito.doReturn(1).when(dao, "buildStatementForInsertUpdate", any(), any(), any(), any());
		Object keyValue = "123";
		PowerMockito.doReturn(keyValue).when(dao, "getObjectProperty", any(Object.class), any(String.class));
		PowerMockito.doNothing().when(dao, "setPrepareStatementParameter", any(PreparedStatement.class), any(int.class), any(Object.class));
		
		EasyMock.expect(statementMock.execute()).andReturn(true);
		
		statementMock.close();
		connectionMock.close();
		PowerMock.replay(connectionMock, statementMock);
		dao.updateRecord(uri, "externalKey");		
		PowerMock.verify(connectionMock, statementMock);
		
	} catch (Exception e)
	{
		assertTrue(false);
	}
	assertTrue(true);	
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:38,代碼來源:TestWBLocalDataStoreDao.java

示例11: test_deleteRecord

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
@Test
public void test_deleteRecord()
{
	try
	{
		WPBSQLDataStoreDao dao = PowerMockito.spy(new WPBSQLDataStoreDao(dbProps));
		
		Connection connectionMock = PowerMock.createMock(Connection.class);
		connectionMock.setAutoCommit(true);
		PowerMockito.doReturn(connectionMock).when(dao, "getConnection");
		
		String sqlStatement = "UPDATE WBUri SET ENABLED=?,URI=?,LASTMODIFIED=?,HTTPOPERATION=?,CONTROLLERCLASS=?,RESOURCETYPE=?,RESOURCEEXTERNALKEY=?,EXTERNALKEY=? WHERE key=?";
		PowerMockito.doReturn(sqlStatement).when(dao, "getSQLStringForDelete", any(Object.class), any(Set.class));
		
		PreparedStatement statementMock = PowerMock.createMock(PreparedStatement.class);
		EasyMock.expect(connectionMock.prepareStatement(sqlStatement)).andReturn(statementMock);
		Object keyValue = "123";
		PowerMockito.doNothing().when(dao, "setPrepareStatementParameter", any(PreparedStatement.class), any(int.class), any(Object.class));
		
		EasyMock.expect(statementMock.execute()).andReturn(true);
		
		statementMock.close();
		connectionMock.close();
		PowerMock.replay(connectionMock, statementMock);
		dao.deleteRecord(WPBUri.class, "key", keyValue);		
		PowerMock.verify(connectionMock, statementMock);
		
	} catch (Exception e)
	{
		assertTrue(false);
	}
	assertTrue(true);	
	
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:35,代碼來源:TestWBLocalDataStoreDao.java

示例12: getByExternalKey

import com.webpagebytes.cms.cmsdata.WPBUri; //導入依賴的package包/類
public WPBUri getByExternalKey(String key) throws WPBIOException
{
	return null;
}
 
開發者ID:webpagebytes,項目名稱:general-cms-plugins,代碼行數:5,代碼來源:WPBLocalUrisCache.java


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