RA: Expose resource locking as DG node
[ccsdk/sli/adaptors.git] / resource-assignment / provider / src / test / resources / test-context.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3   ============LICENSE_START=======================================================
4   openECOMP : SDN-C
5   ================================================================================
6   Copyright (C) 2017 AT&T Intellectual Property. All rights
7                                                 reserved.
8   ================================================================================
9   Licensed under the Apache License, Version 2.0 (the "License");
10   you may not use this file except in compliance with the License.
11   You may obtain a copy of the License at
12   
13        http://www.apache.org/licenses/LICENSE-2.0
14   
15   Unless required by applicable law or agreed to in writing, software
16   distributed under the License is distributed on an "AS IS" BASIS,
17   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   See the License for the specific language governing permissions and
19   limitations under the License.
20   ============LICENSE_END=========================================================
21   -->
22
23 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24     xmlns:jdbc="http://www.springframework.org/schema/jdbc"
25     xmlns:context="http://www.springframework.org/schema/context"
26     xsi:schemaLocation="http://www.springframework.org/schema/beans
27         http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
28         http://www.springframework.org/schema/jdbc
29         http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
30         http://www.springframework.org/schema/context
31         http://www.springframework.org/schema/context/spring-context-3.1.xsd
32                                         ">
33
34     <context:annotation-config />
35
36         <!-- JDBC setup -->
37
38     <bean id="test.dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
39         lazy-init="false" primary="true">
40         <property name="driverClassName" value="org.h2.Driver" />
41         <property name="url" value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=MySQL" />
42     </bean>
43
44     <jdbc:initialize-database data-source="test.dataSource">
45         <jdbc:script location="sql/schema.sql" />
46         <jdbc:script location="sql/data.sql" />
47     </jdbc:initialize-database>
48
49     <bean id="lock.dataSource" class="org.onap.ccsdk.sli.adaptors.util.db.CachedDataSourceWrap">
50         <property name="dataSource" ref="test.dataSource" />
51     </bean>
52
53     <bean id="rm.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" primary="true">
54         <property name="dataSource" ref="test.dataSource" />
55     </bean>
56
57     <bean id="lock.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
58         <property name="dataSource" ref="lock.dataSource" />
59     </bean>
60
61     <bean id="testDb" class="jtest.util.org.onap.ccsdk.sli.adaptors.ra.TestDb">
62         <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
63     </bean>
64
65     <bean id="dataSetup" class="jtest.org.onap.ccsdk.sli.adaptors.ra.DataSetup">
66         <property name="testDb" ref="testDb" />
67     </bean>
68
69         <!-- Resource Lock Configuration -->
70
71     <bean id="resourceLockDao" class="org.onap.ccsdk.sli.adaptors.lock.dao.ResourceLockDaoImpl">
72         <property name="jdbcTemplate" ref="lock.jdbcTemplate" />
73     </bean>
74
75     <bean id="lockHelper" class="org.onap.ccsdk.sli.adaptors.lock.comp.LockHelperImpl">
76         <property name="resourceLockDao" ref="resourceLockDao" />
77         <property name="retryCount" value="10" />
78         <property name="lockWait" value="5" /> <!-- Seconds -->
79     </bean>
80
81         <!-- RM Configuration -->
82
83     <bean id="resourceJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceJdbcDaoImpl">
84         <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
85     </bean>
86
87     <bean id="allocationItemJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.AllocationItemJdbcDaoImpl">
88         <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
89     </bean>
90
91     <bean id="resourceLoadJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceLoadJdbcDaoImpl">
92         <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
93     </bean>
94
95     <bean id="resourceDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceDaoImpl">
96         <property name="resourceJdbcDao" ref="resourceJdbcDao" />
97         <property name="allocationItemJdbcDao" ref="allocationItemJdbcDao" />
98         <property name="resourceLoadJdbcDao" ref="resourceLoadJdbcDao" />
99     </bean>
100
101     <bean id="resourceManager" class="org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManagerImpl">
102         <property name="lockHelper" ref="lockHelper" />
103         <property name="resourceDao" ref="resourceDao" />
104         <property name="lockTimeout" value="600" /> <!-- Seconds -->
105     </bean>
106
107         <!-- Rule DAO Configuration -->
108
109     <bean id="resourceRuleDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDaoImpl">
110         <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
111     </bean>
112
113     <bean id="rangeRuleDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDaoImpl">
114         <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
115     </bean>
116
117         <!-- ResourceAllocator Configuration -->
118
119     <bean id="resourceAllocator" class="org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator">
120         <property name="resourceManager" ref="resourceManager" />
121         <property name="endPointAllocator" ref="endPointAllocator" />
122         <property name="speedUtil" ref="speedUtil" />
123     </bean>
124
125         <bean id="resourceLockNode" class="org.onap.ccsdk.sli.adaptors.ra.ResourceLockNode">
126                 <property name="lockHelper" ref="lockHelper" />
127         </bean>
128
129     <bean id="speedUtil" class="org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil" />
130
131         <!-- EndPointAllocator Configuration -->
132
133     <bean id="endPointAllocator" class="org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocatorImpl">
134         <property name="resourceManager" ref="resourceManager" />
135         <property name="allocationRuleMap">
136             <map>
137                 <entry key="DEFAULT">
138                     <list>
139                         <ref bean="dbAllocationRule" />
140                     </list>
141                 </entry>
142             </map>
143         </property>
144     </bean>
145
146         <!-- Resource Allocation Rule Configuration -->
147
148     <bean id="dbAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.DbAllocationRule">
149         <property name="resourceRuleDao" ref="resourceRuleDao" />
150         <property name="rangeRuleDao" ref="rangeRuleDao" />
151     </bean>
152
153 </beans>