cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco + Spring + Junit

yago
Champ in-the-making
Champ in-the-making
Hi

I'm trying to develop some unit tests for my application, and I have to inject some Alfresco beans in my context . Based on the folder 'shared/classes/alfresco/extension' I have read (because it's a legacy code) that the bean I want to retrieve is defined like that :


<bean name="GenericNodeService"
        class="es.in2.signingpad.service.impl.GenericNodeServiceImpl">
        <property name="nodeService"             ref="NodeService" />
        <property name="searchService"              ref="SearchService" />
        <property name="fileFolderService"           ref="FileFolderService" />
        <property name="permissionService"           ref="PermissionService" />
        <property name="authenticationComponent" ref="AuthenticationComponent" />
        <property name="contentService"           ref="ContentService" />
        <property name="authorityService"           ref="AuthorityService" /> 
        <property name="personService"              ref="PersonService"/>
        <property name="transactionService"        ref="TransactionService" />
        <property name="genericNodeService"        ref="GenericNodeService" />
        <property name="documentGenerationService" ref="DocumentGenerationService" />
        <property name="mailNotificationService"   ref="MailNotificationService"/>
        <property name="groupDAO"                 ref="groupDao"/>
    </bean>


But I can't find where is 'ref="NodeService"'. I'm quite newbie, and as I understand, these beans are from Alfresco, but how I can add these Alfresco Beans to my application-context.xml so I can inject them in my tests and manage alfresco from my unit tests ? .

Thanks in advance . Best regards
Yago
3 REPLIES 3

yago
Champ in-the-making
Champ in-the-making
I think the solution of my problem is in this two classes . I have tried them but I dont know exactly the .xml neccesary to add to manage the beans creation

mrogers
Star Contributor
Star Contributor
You need to use alfresco's context file. (Application-context.xml)  that will pull in yours or some sort of cut down context file.     Or mock your dependencies.

See how alfresco's own unit tests work which use all three of the above approaches.

yago
Champ in-the-making
Champ in-the-making
Ok . I'll give a try and I will coment . Thanks