add test about ScriptSampler

add test about ScriptSampler
This commit is contained in:
coderfengyun 2014-08-22 14:18:03 +08:00
parent 6831f0ab93
commit ab845abf2a
3 changed files with 42 additions and 14 deletions

View File

@ -1,18 +1,5 @@
package org.bench4q.agent.test;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import org.junit.Test;
public class Solution {

View File

@ -0,0 +1,42 @@
package org.bench4q.master.unitTest.datastatistics;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.xml.bind.JAXBException;
import org.bench4q.master.domain.RunningAgentInterface;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.domain.entity.RunningAgentDB;
import org.bench4q.master.domain.factory.RunningAgentFactory;
import org.bench4q.master.domain.valueobject.datastatistics.RunningScriptSampler;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:mockHttpMesseger-context.xml" })
public class Test_ScriptSample {
@Autowired
private RunningAgentFactory runningAgentFactory;
private List<Agent> testcase2 = new ArrayList<Agent>();
{
testcase2.add(Agent.createAgentWithoutId("127.0.0.1", 6565, 500));
testcase2.add(Agent.createAgentWithoutId("127.0.0.2", 6565, 500));
}
@Test
public void test() throws JAXBException {
ArrayList<RunningAgentInterface> runningAgents = new ArrayList<RunningAgentInterface>();
runningAgents.add(this.runningAgentFactory
.buildRunningAgentWithOutIdAndRunningScript(
this.testcase2.get(0), 10, UUID.randomUUID()));
RunningScriptSampler sampler = new RunningScriptSampler(runningAgents);
assertNotNull(sampler.getResultModelFromAgent());
}
}

View File

@ -26,7 +26,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:mockHttpMesseger-context.xml" })
public class Test_RunningAgent extends TestBase_MakeUpTestPlan {
@Autowired
private RunningAgentFactory runningAgentFactory;