当前位置: 首页>>代码示例>>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;未经允许,请勿转载。