use of org.alfresco.repo.dictionary.DictionaryComponent in project alfresco-repository by Alfresco.
the class DbNodeServiceImplPropagationTest method loadModel.
/**
* Loads the test model required for building the node graphs
*/
public static DictionaryService loadModel(ApplicationContext applicationContext) {
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
DictionaryComponent dictionary = new DictionaryComponent();
dictionary.setDictionaryDAO(dictionaryDao);
// done
return dictionary;
}
use of org.alfresco.repo.dictionary.DictionaryComponent in project alfresco-repository by Alfresco.
the class DbNodeServiceImplPropagationTest method before.
@Before
public void before() throws Exception {
txnService = (TransactionService) applicationContext.getBean("transactionComponent");
nodeDAO = (NodeDAO) applicationContext.getBean("nodeDAO");
dialect = (Dialect) applicationContext.getBean("dialect");
nodeService = (NodeService) applicationContext.getBean("dbNodeService");
authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
authenticationComponent.setSystemUserAsCurrentUser();
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
DictionaryComponent dictionary = new DictionaryComponent();
dictionary.setDictionaryDAO(dictionaryDao);
dictionaryService = loadModel(applicationContext);
restartAuditableTxn();
}
use of org.alfresco.repo.dictionary.DictionaryComponent in project alfresco-repository by Alfresco.
the class BaseNodeServiceTest method before.
@Before
public void before() {
metadataEncryptor = (MetadataEncryptor) applicationContext.getBean("metadataEncryptor");
transactionService = (TransactionService) applicationContext.getBean("transactionComponent");
retryingTransactionHelper = (RetryingTransactionHelper) applicationContext.getBean("retryingTransactionHelper");
policyComponent = (PolicyComponent) applicationContext.getBean("policyComponent");
authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
contentService = (ContentService) applicationContext.getBean("contentService");
authenticationComponent.setSystemUserAsCurrentUser();
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
DictionaryComponent dictionary = new DictionaryComponent();
dictionary.setDictionaryDAO(dictionaryDao);
dictionaryService = loadModel(applicationContext);
nodeService = getNodeService();
// create a first store directly
StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
rootNodeRef = nodeService.getRootNode(storeRef);
StoreRef catStoreRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_cat_" + System.currentTimeMillis());
NodeRef catRootNodeRef = nodeService.getRootNode(catStoreRef);
cat = nodeService.createNode(catRootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}cat"), ContentModel.TYPE_CATEGORY).getChildRef();
// downgrade integrity checks
IntegrityChecker.setWarnInTransaction();
}
use of org.alfresco.repo.dictionary.DictionaryComponent in project alfresco-repository by Alfresco.
the class BaseNodeServiceTest method loadModel.
/**
* Loads the test model required for building the node graphs
*/
public static DictionaryService loadModel(ApplicationContext applicationContext) {
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
DictionaryComponent dictionary = new DictionaryComponent();
dictionary.setDictionaryDAO(dictionaryDao);
// done
return dictionary;
}
use of org.alfresco.repo.dictionary.DictionaryComponent in project alfresco-repository by Alfresco.
the class TemplateServiceImplTest method setUp.
@Before
public void setUp() throws Exception {
transactionService = (TransactionService) applicationContext.getBean("transactionComponent");
nodeService = (NodeService) applicationContext.getBean("nodeService");
templateService = (TemplateService) applicationContext.getBean("templateService");
serviceRegistry = (ServiceRegistry) applicationContext.getBean("ServiceRegistry");
this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
this.authenticationComponent.setSystemUserAsCurrentUser();
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
DictionaryComponent dictionary = new DictionaryComponent();
dictionary.setDictionaryDAO(dictionaryDao);
BaseNodeServiceTest.loadModel(applicationContext);
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>() {
@SuppressWarnings("unchecked")
public Object execute() throws Exception {
StoreRef store = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "template_" + System.currentTimeMillis());
root_node = nodeService.getRootNode(store);
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(11);
properties.put(ContentModel.PROP_NAME, (Serializable) "subFolder");
NodeRef subFolderRef = nodeService.createNode(root_node, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("subFolder")), ContentModel.TYPE_FOLDER, properties).getChildRef();
properties.put(ContentModel.PROP_NAME, (Serializable) "subSubFolder");
NodeRef subSubFolderRef = nodeService.createNode(subFolderRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("subSubFolder")), ContentModel.TYPE_FOLDER, properties).getChildRef();
properties.put(ContentModel.PROP_NAME, (Serializable) "subSubSubFolder");
nodeService.createNode(subSubFolderRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, QName.createValidLocalName("subSubSubFolder")), ContentModel.TYPE_FOLDER, properties);
BaseNodeServiceTest.buildNodeGraph(nodeService, root_node);
return null;
}
});
}
Aggregations