@@ -0,0 +1,2226 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one%0A * or more contributor license agreements.  See the NOTICE file%0A * distributed with this work for additional information%0A * regarding copyright ownership.  The ASF licenses this file%0A * to you under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance%0A * with the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.glaf.test.core;%0A%0Aimport java.io.IOException;%0Aimport java.util.Date;%0Aimport java.util.Properties;%0A%0Aimport org.junit.Test;%0A%0Aimport com.glaf.core.config.Environment;%0Aimport com.glaf.core.domain.SysLog;%0Aimport com.glaf.core.service.ISysLogService;%0Aimport com.glaf.test.AbstractTest;%0A%0Apublic class MultiRoutingDataSourceTest extends AbstractTest %7B%0A%0A%09protected ISysLogService sysLogService;%0A%0A%09@Test%0A%09public void testMultiDS() throws IOException %7B%0A%09%09sysLogService = super.getBean(%22sysLogService%22);%0A%09%09// serice%D0%A3%D4%AD%F2%A3%A9%A3%D6%BB%DA%BF%C6%B2%0A%09%09String currentName = com.glaf.core.config.Environment%0A%09%09%09%09.getCurrentSystemName();// %D6%AE%C7%B0%D4%B4%C4%ACdefault%0A%09%09try %7B%0A%09%09%09java.util.Map%3CString, Properties%3E dataSourceProperties = com.glaf.core.config.DBConfiguration%0A%09%09%09%09%09.getDataSourceProperties();%0A%09%09%09java.util.Iterator%3CString%3E iter = dataSourceProperties.keySet()%0A%09%09%09%09%09.iterator();%0A%09%09%09while (iter.hasNext()) %7B%0A%09%09%09%09String systemName = (String) iter.next();%0A%09%09%09%09Environment.setCurrentSystemName(systemName);// %C3%B5%C7%B0%D2%AA%D2%B5%D4%B4%C6%A3%C3%B5ds02%0A%09%09%09%09// service%DF%BC%0A%09%09%09%09// dataService.doYourBussiness(....);//Service%C3%BF%DD%BF%C4%B6%C7%B6%F1%A3%A1%A3%0A%09%09%09%09for (int i = 0; i %3C 100; i++) %7B%0A%09%09%09%09%09SysLog bean = new SysLog();%0A%09%09%09%09%09bean.setAccount(%22test%22);%0A%09%09%09%09%09bean.setCreateTime(new Date());%0A%09%09%09%09%09bean.setFlag(1);%0A%09%09%09%09%09bean.setIp(%22127.0.0.1%22);%0A%09%09%09%09%09bean.setOperate(%22insert%22);%0A%09%09%09%09%09sysLogService.create(bean);%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D finally %7B%0A%09%09%09com.glaf.core.config.Environment.setCurrentSystemName(currentName);// %CB%BC%C7%B5%C3%BB%D4%AD%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

add MultiRoutingDataSourceTest