You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ke...@apache.org on 2013/02/01 20:38:11 UTC
[46/50] [abbrv] Sync master to javelin one more time
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/server/test/resources/VpcApiUnitTestContext.xml
----------------------------------------------------------------------
diff --cc server/test/resources/VpcApiUnitTestContext.xml
index 0000000,0000000..d933022
new file mode 100644
--- /dev/null
+++ b/server/test/resources/VpcApiUnitTestContext.xml
@@@ -1,0 -1,0 +1,42 @@@
++<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
++ license agreements. See the NOTICE file distributed with this work for additional
++ information regarding copyright ownership. The ASF licenses this file to
++ you under the Apache License, Version 2.0 (the "License"); you may not use
++ this file except in compliance with the License. You may obtain a copy of
++ the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
++ by applicable law or agreed to in writing, software distributed under the
++ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
++ OF ANY KIND, either express or implied. See the License for the specific
++ language governing permissions and limitations under the License. -->
++<beans xmlns="http://www.springframework.org/schema/beans"
++ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
++ xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
++ xsi:schemaLocation="http://www.springframework.org/schema/beans
++ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
++ http://www.springframework.org/schema/tx
++ http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
++ http://www.springframework.org/schema/aop
++ http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
++ http://www.springframework.org/schema/context
++ http://www.springframework.org/schema/context/spring-context-3.0.xsd">
++
++ <context:annotation-config />
++ <context:component-scan base-package="org.apache.cloudstack, com.cloud" />
++
++ <!-- @DB support -->
++ <aop:config proxy-target-class="true">
++ <aop:aspect id="dbContextBuilder" ref="transactionContextBuilder">
++ <aop:pointcut id="captureAnyMethod" expression="execution(* *(..))" />
++
++ <aop:around pointcut-ref="captureAnyMethod" method="AroundAnyMethod" />
++ </aop:aspect>
++
++ </aop:config>
++
++ <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" />
++ <bean id="componentContext" class="com.cloud.utils.component.ComponentContext"/>
++ <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor">
++ <property name="requiredParameterValue" value="false" />
++ </bean>
++
++</beans>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/setup/db/create-schema.sql
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/utils/conf/db.properties
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/utils/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --cc utils/src/com/cloud/utils/db/GenericDaoBase.java
index 623c349,4ecf242..cf30474
--- a/utils/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/utils/src/com/cloud/utils/db/GenericDaoBase.java
@@@ -1799,7 -1802,12 +1799,12 @@@ public abstract class GenericDaoBase<T
factory.setCallback(0, sc);
return sc;
}
-
+
+ @Override
+ public int getRegionId(){
+ return Transaction.s_region_id;
+ }
+
public Integer getCount(SearchCriteria<T> sc) {
String clause = sc != null ? sc.getWhereClause() : null;
if (clause != null && clause.length() == 0) {
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7b75f0d9/utils/src/com/cloud/utils/db/Transaction.java
----------------------------------------------------------------------
diff --cc utils/src/com/cloud/utils/db/Transaction.java
index 6884fb1,13125f8..73f5bb1
--- a/utils/src/com/cloud/utils/db/Transaction.java
+++ b/utils/src/com/cloud/utils/db/Transaction.java
@@@ -1066,21 -1050,22 +1067,27 @@@ public class Transaction
System.setProperty("javax.net.ssl.trustStorePassword", dbProps.getProperty("db.cloud.trustStorePassword"));
}
+ String regionId = dbProps.getProperty("region.id");
+ if(regionId == null){
+ s_region_id = 1;
+ } else {
+ s_region_id = Integer.parseInt(regionId);
+ }
final GenericObjectPool cloudConnectionPool = new GenericObjectPool(null, cloudMaxActive, GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION,
cloudMaxWait, cloudMaxIdle, cloudTestOnBorrow, false, cloudTimeBtwEvictionRunsMillis, 1, cloudMinEvcitableIdleTimeMillis, cloudTestWhileIdle);
- final ConnectionFactory cloudConnectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://"+cloudHost + ":" + cloudPort + "/" + cloudDbName +
- "?autoReconnect="+cloudAutoReconnect + (url != null ? "&" + url : "")+ (useSSL ? "&useSSL=true" : ""), cloudUsername, cloudPassword);
+
+ final ConnectionFactory cloudConnectionFactory = new DriverManagerConnectionFactory("jdbc:mysql://" + cloudHost + ":" + cloudPort + "/" + cloudDbName +
+ "?autoReconnect=" + cloudAutoReconnect + (url != null ? "&" + url : "") + (useSSL ? "&useSSL=true" : ""), cloudUsername, cloudPassword);
+
final KeyedObjectPoolFactory poolableObjFactory = (cloudPoolPreparedStatements ? new StackKeyedObjectPoolFactory() : null);
+
final PoolableConnectionFactory cloudPoolableConnectionFactory = new PoolableConnectionFactory(cloudConnectionFactory, cloudConnectionPool, poolableObjFactory,
cloudValidationQuery, false, false, isolationLevel);
+
+ // Default Data Source for CloudStack
s_ds = new PoolingDataSource(cloudPoolableConnectionFactory.getPool());
- // configure the usage db
+ // Configure the usage db
final int usageMaxActive = Integer.parseInt(dbProps.getProperty("db.usage.maxActive"));
final int usageMaxIdle = Integer.parseInt(dbProps.getProperty("db.usage.maxIdle"));
final long usageMaxWait = Long.parseLong(dbProps.getProperty("db.usage.maxWait"));