remove that outer right join

remove that outer right join
This commit is contained in:
coderfengyun 2014-07-21 13:47:34 +08:00
parent 37f0a1b49f
commit f0296eb398
13 changed files with 40 additions and 47 deletions

View File

@ -46,4 +46,10 @@ public class HomeController {
} }
return serverStatusModel; return serverStatusModel;
} }
// @RequestMapping(method = { RequestMethod.GET, RequestMethod.POST })
// @ResponseBody
// public ServerStatusModel reset() {
//
// }
} }

View File

@ -62,7 +62,7 @@ public class TestWithScriptFile {
public TestWithScriptFile() { public TestWithScriptFile() {
this.setFilePath("Scripts" + System.getProperty("file.separator") this.setFilePath("Scripts" + System.getProperty("file.separator")
+ "http.xml"); + "httpWithoutTimer.xml");
this.setHttpRequester(new HttpRequester()); this.setHttpRequester(new HttpRequester());
} }

View File

@ -146,7 +146,8 @@ public class Test_HttpPlugin extends TestBase {
public void buildAScenario() throws IOException { public void buildAScenario() throws IOException {
RunScenarioModel scenarioMode = (RunScenarioModel) MarshalHelper RunScenarioModel scenarioMode = (RunScenarioModel) MarshalHelper
.tryUnmarshal(RunScenarioModel.class, FileUtils .tryUnmarshal(RunScenarioModel.class, FileUtils
.readFileToString(new File("Scripts/http.xml"))); .readFileToString(new File(
"Scripts/httpWithoutTimer.xml")));
VUser vUser = createVUser( VUser vUser = createVUser(
Scenario.scenarioBuilderWithCompile(scenarioMode), Scenario.scenarioBuilderWithCompile(scenarioMode),
UUID.randomUUID()); UUID.randomUUID());

View File

@ -161,6 +161,8 @@ public class TestPlanController extends BaseController {
List<ScriptBriefResultModel> scriptBriefResultModels = this List<ScriptBriefResultModel> scriptBriefResultModels = this
.getTestPlanScriptResultService().loadScriptBriefWithDuation( .getTestPlanScriptResultService().loadScriptBriefWithDuation(
testPlanId, scriptId, duationBegin); testPlanId, scriptId, duationBegin);
System.out.println("Script Result Size : "
+ scriptBriefResultModels.size());
TestPlanScriptBriefResultModel ret = new TestPlanScriptBriefResultModel(); TestPlanScriptBriefResultModel ret = new TestPlanScriptBriefResultModel();
ret.setScriptBriefResultModels(scriptBriefResultModels); ret.setScriptBriefResultModels(scriptBriefResultModels);
return ret; return ret;
@ -176,8 +178,8 @@ public class TestPlanController extends BaseController {
+ "when get behaviors's brief", "/getBehaviorsBrief"); + "when get behaviors's brief", "/getBehaviorsBrief");
} }
ScriptBehaviorsBriefModel result = this ScriptBehaviorsBriefModel result = this
.getTestPlanScriptResultService().getLatestScriptBehaviorsBrief( .getTestPlanScriptResultService()
testPlanRunID, scriptId); .getLatestScriptBehaviorsBrief(testPlanRunID, scriptId);
return result; return result;
} }

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.bench4q.master.domain.entity.Agent; import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.exception.ExceptionLog; import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.master.exception.ExceptionUtils.EntityUniqueAlReadyExistException; import org.bench4q.master.exception.ExceptionUtils.EntityUniqueAlReadyExistException;
import org.hibernate.Criteria;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.criterion.Order; import org.hibernate.criterion.Order;
@ -158,7 +159,8 @@ public class AgentRepository extends AbstractRepositoty {
Session session = this.getSessionHelper().openSession(); Session session = this.getSessionHelper().openSession();
try { try {
return session.createCriteria(Agent.class) return session.createCriteria(Agent.class)
.addOrder(Order.desc("remainLoad")).list(); .addOrder(Order.desc("remainLoad"))
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;

View File

@ -7,6 +7,7 @@ import org.bench4q.master.domain.entity.Script;
import org.bench4q.master.domain.entity.User; import org.bench4q.master.domain.entity.User;
import org.bench4q.master.exception.ExceptionLog; import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.master.exception.ExceptionUtils.EntityUniqueAlReadyExistException; import org.bench4q.master.exception.ExceptionUtils.EntityUniqueAlReadyExistException;
import org.hibernate.Criteria;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Criterion;
@ -115,7 +116,8 @@ public class ScriptRepositoty extends AbstractRepositoty {
Session session = this.getSessionHelper().openSession(); Session session = this.getSessionHelper().openSession();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Script> scripts = session.createCriteria(Script.class) List<Script> scripts = session.createCriteria(Script.class)
.add(Restrictions.eq("user", user)).list(); .add(Restrictions.eq("user", user))
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
releaseSession(session); releaseSession(session);
return scripts; return scripts;
} }

View File

@ -140,7 +140,8 @@ public class TestPlanRepository extends AbstractRepositoty {
for (Criterion criterion : criterions) { for (Criterion criterion : criterions) {
criteria.add(criterion); criteria.add(criterion);
} }
return criteria.addOrder(order).list(); return criteria.addOrder(order)
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
} catch (Exception e) { } catch (Exception e) {
logger.error(ExceptionLog.getStackTrace(e)); logger.error(ExceptionLog.getStackTrace(e));
return new LinkedList<TestPlan>(); return new LinkedList<TestPlan>();
@ -200,7 +201,8 @@ public class TestPlanRepository extends AbstractRepositoty {
try { try {
return session.createCriteria(MonitorResult.class) return session.createCriteria(MonitorResult.class)
.add(Restrictions.eq("monitor", monitor)).list(); .add(Restrictions.eq("monitor", monitor))
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
} catch (Exception e) { } catch (Exception e) {
logger.error(ExceptionLog.getStackTrace(e)); logger.error(ExceptionLog.getStackTrace(e));
@ -216,7 +218,7 @@ public class TestPlanRepository extends AbstractRepositoty {
return session.createCriteria(TestPlanScriptResult.class) return session.createCriteria(TestPlanScriptResult.class)
.add(Restrictions.eq("testPlanScript", testPlanScript)) .add(Restrictions.eq("testPlanScript", testPlanScript))
.list(); .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
} catch (Exception e) { } catch (Exception e) {
logger.error(ExceptionLog.getStackTrace(e)); logger.error(ExceptionLog.getStackTrace(e));

View File

@ -15,6 +15,7 @@ import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel; import org.bench4q.share.models.master.statistics.ScriptBehaviorsBriefModel;
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel; import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel; import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
import org.hibernate.Criteria;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.criterion.Order; import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions; import org.hibernate.criterion.Restrictions;
@ -54,6 +55,8 @@ public class TestPlanScriptResultService {
List<TestPlanScriptResult> scriptResults = doGetTestPlanScriptResults( List<TestPlanScriptResult> scriptResults = doGetTestPlanScriptResults(
testPlanId, scriptId, startTime, testPlanId, scriptId, startTime,
ScriptBriefResultModel.class, session); ScriptBriefResultModel.class, session);
System.out.println("Script Result Size from DB : "
+ scriptResults.size());
for (TestPlanScriptResult testPlanScriptResult : scriptResults) { for (TestPlanScriptResult testPlanScriptResult : scriptResults) {
result.add((ScriptBriefResultModel) MarshalHelper.unmarshal( result.add((ScriptBriefResultModel) MarshalHelper.unmarshal(
ScriptBriefResultModel.class, ScriptBriefResultModel.class,
@ -81,12 +84,12 @@ public class TestPlanScriptResultService {
.add(Restrictions.eq("testPlanScript", testPlanScript)) .add(Restrictions.eq("testPlanScript", testPlanScript))
.add(Restrictions.eq("resultType", resultType.getName())) .add(Restrictions.eq("resultType", resultType.getName()))
.add(Restrictions.ge("createDatetime", new Date(startTime))) .add(Restrictions.ge("createDatetime", new Date(startTime)))
.list(); .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
return results; return results;
} }
public ScriptBehaviorsBriefModel getLatestScriptBehaviorsBrief(UUID testPlanId, public ScriptBehaviorsBriefModel getLatestScriptBehaviorsBrief(
int scriptId) { UUID testPlanId, int scriptId) {
Session session = this.getSessionHelper().openSession(); Session session = this.getSessionHelper().openSession();
try { try {
TestPlanScriptResult testPlanScriptResult = doGetLastSampleResult( TestPlanScriptResult testPlanScriptResult = doGetLastSampleResult(

View File

@ -143,7 +143,7 @@ public class HighAvailablePoolImpl extends CurrentLoadSubject implements
} }
} }
@Scheduled(cron = "0,30 */2 * * * *") @Scheduled(cron = "0,30 */1 * * * *")
public synchronized void checkAllHeartBeat() { public synchronized void checkAllHeartBeat() {
heartBeatsAndUpdateHAPool(); heartBeatsAndUpdateHAPool();
doSubstituteIfRequired(); doSubstituteIfRequired();

View File

@ -1,4 +1,4 @@
portToServe=7979 portToServe=8901
pickTestPlanCycleInSeconds=60 pickTestPlanCycleInSeconds=60
maxFailTime=10 maxFailTime=10
minExcuteIntervalInSeconds=600 minExcuteIntervalInSeconds=600

View File

@ -3,11 +3,11 @@
<hibernate-configuration> <hibernate-configuration>
<session-factory> <session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver </property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver </property>
<property name="hibernate.connection.url"> jdbc:mysql://localhost:3306/bench4q <property name="hibernate.connection.url"> jdbc:mysql://localhost:3306/bench4q_master
</property> </property>
<property name="hibernate.connection.username">root</property> <property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">123456 </property> <property name="hibernate.connection.password">123456 </property>
<property name="hibernate.connection.pool.size">100 </property> <property name="hibernate.connection.pool.size">1000</property>
<property name="hibernate.show_sql">false</property> <property name="hibernate.show_sql">false</property>
<property name="format_sql">true</property> <property name="format_sql">true</property>
<property name="Connection.useUnicode">true </property> <property name="Connection.useUnicode">true </property>

View File

@ -1,30 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.0.5.RELEASE</spring.version>
<java.home>C:\Program Files (x86)\Java\jdk1.6</java.home>
</properties>
<profiles>
<profile>
<id>default-tools.jar</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
<systemPath>${java.home}/lib/tools.jar</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>bench4q-web</groupId> <groupId>bench4q-web</groupId>
<artifactId>bench4q-web</artifactId> <artifactId>bench4q-web</artifactId>
@ -178,8 +153,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version> <version>2.3.2</version>
<configuration> <configuration>
<source>1.6</source> <source>1.7</source>
<target>1.6</target> <target>1.7</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

View File

@ -1 +1 @@
masterAddress=127.0.0.1:7979 masterAddress=127.0.0.1:8901