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;
}
// @RequestMapping(method = { RequestMethod.GET, RequestMethod.POST })
// @ResponseBody
// public ServerStatusModel reset() {
//
// }
}

View File

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

View File

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

View File

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

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.master.exception.ExceptionUtils.EntityUniqueAlReadyExistException;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Order;
@ -158,7 +159,8 @@ public class AgentRepository extends AbstractRepositoty {
Session session = this.getSessionHelper().openSession();
try {
return session.createCriteria(Agent.class)
.addOrder(Order.desc("remainLoad")).list();
.addOrder(Order.desc("remainLoad"))
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
} catch (Exception e) {
e.printStackTrace();
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.exception.ExceptionLog;
import org.bench4q.master.exception.ExceptionUtils.EntityUniqueAlReadyExistException;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Criterion;
@ -20,9 +21,9 @@ public class ScriptRepositoty extends AbstractRepositoty {
Session session = this.getSessionHelper().openSession();
Transaction transaction = session.beginTransaction();
try {
Script script=(Script)session.merge(scriptWithoutId);
Script script = (Script) session.merge(scriptWithoutId);
transaction.commit();
return script;
} catch (Exception e) {
transaction.rollback();
@ -115,7 +116,8 @@ public class ScriptRepositoty extends AbstractRepositoty {
Session session = this.getSessionHelper().openSession();
@SuppressWarnings("unchecked")
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);
return scripts;
}

View File

@ -140,7 +140,8 @@ public class TestPlanRepository extends AbstractRepositoty {
for (Criterion criterion : criterions) {
criteria.add(criterion);
}
return criteria.addOrder(order).list();
return criteria.addOrder(order)
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
} catch (Exception e) {
logger.error(ExceptionLog.getStackTrace(e));
return new LinkedList<TestPlan>();
@ -200,7 +201,8 @@ public class TestPlanRepository extends AbstractRepositoty {
try {
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) {
logger.error(ExceptionLog.getStackTrace(e));
@ -216,7 +218,7 @@ public class TestPlanRepository extends AbstractRepositoty {
return session.createCriteria(TestPlanScriptResult.class)
.add(Restrictions.eq("testPlanScript", testPlanScript))
.list();
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
} catch (Exception 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.ScriptBriefResultModel;
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
@ -54,6 +55,8 @@ public class TestPlanScriptResultService {
List<TestPlanScriptResult> scriptResults = doGetTestPlanScriptResults(
testPlanId, scriptId, startTime,
ScriptBriefResultModel.class, session);
System.out.println("Script Result Size from DB : "
+ scriptResults.size());
for (TestPlanScriptResult testPlanScriptResult : scriptResults) {
result.add((ScriptBriefResultModel) MarshalHelper.unmarshal(
ScriptBriefResultModel.class,
@ -81,12 +84,12 @@ public class TestPlanScriptResultService {
.add(Restrictions.eq("testPlanScript", testPlanScript))
.add(Restrictions.eq("resultType", resultType.getName()))
.add(Restrictions.ge("createDatetime", new Date(startTime)))
.list();
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
return results;
}
public ScriptBehaviorsBriefModel getLatestScriptBehaviorsBrief(UUID testPlanId,
int scriptId) {
public ScriptBehaviorsBriefModel getLatestScriptBehaviorsBrief(
UUID testPlanId, int scriptId) {
Session session = this.getSessionHelper().openSession();
try {
TestPlanScriptResult testPlanScriptResult = doGetLastSampleResult(
@ -160,5 +163,5 @@ public class TestPlanScriptResultService {
ScriptBriefResultModel.class,
testPlanScriptResult.getResultContent());
}
}

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() {
heartBeatsAndUpdateHAPool();
doSubstituteIfRequired();

View File

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

View File

@ -3,11 +3,11 @@
<hibernate-configuration>
<session-factory>
<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 name="hibernate.connection.username">root</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="format_sql">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"
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>
<groupId>bench4q-web</groupId>
<artifactId>bench4q-web</artifactId>
@ -178,8 +153,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>

View File

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