use of org.alfresco.repo.node.encryption.MetadataEncryptor in project alfresco-repository by Alfresco.
the class IntegrityTest method setUp.
public void setUp() throws Exception {
ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
DictionaryDAO dictionaryDao = (DictionaryDAO) ctx.getBean("dictionaryDAO");
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
// load the test model
InputStream modelStream = cl.getResourceAsStream("org/alfresco/repo/node/integrity/IntegrityTest_model.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
integrityChecker = (IntegrityChecker) ctx.getBean("integrityChecker");
integrityChecker.setEnabled(true);
integrityChecker.setFailOnViolation(true);
integrityChecker.setTraceOn(true);
// we want to count the correct number of errors
integrityChecker.setMaxErrorsPerTransaction(100);
MetadataEncryptor encryptor = (MetadataEncryptor) ctx.getBean("metadataEncryptor");
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
nodeService = serviceRegistry.getNodeService();
this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
this.authenticationComponent.setSystemUserAsCurrentUser();
// begin a transaction
TransactionService transactionService = serviceRegistry.getTransactionService();
txn = transactionService.getUserTransaction();
txn.begin();
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, getName());
if (!nodeService.exists(storeRef)) {
nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
}
rootNodeRef = nodeService.getRootNode(storeRef);
allProperties = new PropertyMap();
allProperties.put(TEST_PROP_TEXT_A, "ABC");
allProperties.put(TEST_PROP_TEXT_B, "DEF");
allProperties.put(TEST_PROP_INT_A, "123");
allProperties.put(TEST_PROP_INT_B, "456");
allProperties.put(TEST_PROP_ENCRYPTED_A, "ABC");
allProperties.put(TEST_PROP_ENCRYPTED_B, "DEF");
allProperties = encryptor.encrypt(allProperties);
}
Aggregations