本文整理汇总了Java中org.alfresco.util.EqualsHelper.getMapDifferenceReport方法的典型用法代码示例。如果您正苦于以下问题:Java EqualsHelper.getMapDifferenceReport方法的具体用法?Java EqualsHelper.getMapDifferenceReport怎么用?Java EqualsHelper.getMapDifferenceReport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.util.EqualsHelper
的用法示例。
在下文中一共展示了EqualsHelper.getMapDifferenceReport方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkAuditMaps
import org.alfresco.util.EqualsHelper; //导入方法依赖的package包/类
/**
* Utility method to compare a 'results' map with a map of expected values
*/
private void checkAuditMaps(Map<String, Serializable> result, Map<String, Serializable> expected)
{
String failure = EqualsHelper.getMapDifferenceReport(result, expected);
if (failure != null)
{
fail(failure);
}
}
示例2: marshallAndUnmarshall
import org.alfresco.util.EqualsHelper; //导入方法依赖的package包/类
/**
* Converts properties back and forth and ensures that the result is unchanged or
* at least doesn't show up in a deep equals check.
*/
private void marshallAndUnmarshall(final Map<QName, Serializable> in, final boolean exact) throws Throwable
{
RetryingTransactionCallback<Void> txnCallback = new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
String diffReport;
// Convert to raw and back
Map<NodePropertyKey, NodePropertyValue> rawProps1 = helper.convertToPersistentProperties(in);
Map<QName, Serializable> props1 = helper.convertToPublicProperties(rawProps1);
// We can't be sure that we have what we started with, because there may have been
// some mandatory conversions to the types defined by the model i.e. the values
// will get converted to the dictionary type rather than the incoming type
if (exact)
{
diffReport = EqualsHelper.getMapDifferenceReport(props1, in);
assertNull(diffReport, diffReport);
}
// Convert back to raw again
Map<NodePropertyKey, NodePropertyValue> rawProps2 = helper.convertToPersistentProperties(in);
diffReport = EqualsHelper.getMapDifferenceReport(rawProps2, rawProps1);
assertNull(diffReport, diffReport);
// But now, on the second time out, we expect to get exactly what we got before
Map<QName, Serializable> props2 = helper.convertToPublicProperties(rawProps2);
diffReport = EqualsHelper.getMapDifferenceReport(props2, props1);
assertNull(diffReport, diffReport);
return null;
}
};
txnHelper.doInTransaction(txnCallback);
}
示例3: testApplication
import org.alfresco.util.EqualsHelper; //导入方法依赖的package包/类
/**
* Test for MNT-10070 and MNT-14136
*/
public void testApplication() throws Exception
{
// Register the test model
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/testaudit/alfresco-audit-test-mnt-10070.xml");
auditModelRegistry.registerModel(testModelUrl);
auditModelRegistry.loadAuditModels();
auditModelRegistry.setProperty("audit.enabled", "true");
auditModelRegistry.setProperty("audit.app1.enabled", "true");
auditModelRegistry.setProperty("audit.filter.app1.default.enabled", "true");
auditModelRegistry.setProperty("audit.filter.app1.login.user", "~System;~null;.*");
auditModelRegistry.setProperty("audit.app2.enabled", "true");
auditModelRegistry.setProperty("audit.filter.app2.default.enabled", "true");
auditModelRegistry.setProperty("audit.filter.app2.login.user", "~System;~null;~admin;.*");
auditModelRegistry.setProperty("audit.app3.enabled", "true");
auditModelRegistry.setProperty("audit.filter.app3.default.enabled", "true");
auditModelRegistry.setProperty("audit.filter.app3.login.user", "~System;~null;.*");
auditModelRegistry.afterPropertiesSet();
AuthenticationUtil.setRunAsUserSystem();
AuditApplication applicationOne = auditModelRegistry.getAuditApplicationByName(APPLICATION_ONE);
assertNotNull("Application 'app1' dosn't exist", applicationOne);
AuditApplication applicationTwo = auditModelRegistry.getAuditApplicationByName(APPLICATION_TWO);
assertNotNull("Application 'app2' dosn't exist", applicationTwo);
AuditApplication applicationThree = auditModelRegistry.getAuditApplicationByName(APPLICATION_THREE);
assertNotNull("Application 'app3' dosn't exist", applicationThree);
// auditComponent
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
PropertyAuditFilter filter = new PropertyAuditFilter();
Properties properties = new Properties();
properties.put("audit.enabled", "true");
properties.put("audit.app1.enabled", "true");
properties.put("audit.filter.app1.default.enabled", "true");
properties.put("audit.filter.app1.default.user", "~System;~null;.*");
properties.put("audit.app2.enabled", "true");
properties.put("audit.filter.app2.default.enabled", "true");
properties.put("audit.filter.app2.default.user", "~System;~null;~admin;.*");
properties.put("audit.app3.enabled", "true");
properties.put("audit.filter.app3.default.enabled", "true");
properties.put("audit.filter.app3.default.user", "~System;~null;.*");
filter.setProperties(properties);
auditComponent.setAuditFilter(filter);
Map<String, Serializable> auditMap = new HashMap<String, Serializable>();
auditMap.put("/transaction/user", AuthenticationUtil.getFullyAuthenticatedUser());
auditMap.put("/transaction/action", "CREATE");
auditMap.put("/transaction/type", "cm:content");
Map<String, Serializable> recordedAuditMap = auditComponent.recordAuditValues("/alfresco-access", auditMap);
assertFalse("Audit values is empty.", recordedAuditMap.isEmpty());
Map<String, Serializable> expected = new HashMap<String, Serializable>();
// There should not be app2
expected.put("/" + APPLICATION_ONE + "/transaction/action", "CREATE");
expected.put("/" + APPLICATION_THREE + "/transaction/type", "cm:content");
String failure = EqualsHelper.getMapDifferenceReport(recordedAuditMap, expected);
if (failure != null)
{
fail(failure);
}
}